Skip to content

Commit

Permalink
Add Theia Helm chart to release (#69)
Browse files Browse the repository at this point in the history
Signed-off-by: Yanjun Zhou <[email protected]>
  • Loading branch information
yanjunz97 authored Jul 7, 2022
1 parent f95e7ee commit 7ac8617
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/upload_release_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,12 @@ jobs:
asset_path: ./assets/theia-windows-x86_64.exe
asset_name: theia-windows-x86_64.exe
asset_content_type: application/octet-stream
- name: Upload Theia Helm chart archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/theia-chart.tgz
asset_name: theia-chart.tgz
asset_content_type: application/octet-stream
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ bin
.vscode/
.idea/

# Common backup files
*.bak

ci/jenkins/jobs/defaults.yaml

plugins/grafana-custom-plugins/grafana-sankey-plugin/node_modules/
Expand Down
4 changes: 4 additions & 0 deletions build/charts/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
USERID := $(shell id -u)
GRPID := $(shell id -g)

VERSION := $(shell head -n 1 ../../VERSION | cut -c 2-)

.PHONY: helm-docs
helm-docs:
docker run --rm --volume "$(CURDIR):/helm-docs" --user=$(USERID):$(GRPID) jnorwood/helm-docs:v1.7.0
sed -i.bak "s/0.0.0/$(VERSION)/g" theia/README.md # replace version placeholder
sed -i.bak "s/-dev-informational/--dev-informational/g" theia/README.md # fix img.shields.io badge URLs
8 changes: 6 additions & 2 deletions build/charts/theia/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: theia
type: application
displayName: Theia
home: https://antrea.io/
version: 0.2.0-dev
appVersion: 0.2.0-dev
version: 0.0.0
appVersion: 0.0.0
kubeVersion: ">= 1.16.0-0"
icon: https://raw.githubusercontent.com/antrea-io/antrea/main/docs/assets/logo/antrea_logo.svg
description: Antrea Network Flow Visibility
Expand All @@ -14,6 +14,10 @@ keywords:
- Networking
- CNI
- Security
- Open vSwitch
- OVS
- Antrea
- Observability
- Flow visibility
sources:
- https://github.com/antrea-io/theia
6 changes: 5 additions & 1 deletion build/charts/theia/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
Theia has been successfully installed.
Theia has been successfully installed

You are using version {{ .Chart.Version }}

For the Antrea documentation, please visit https://antrea.io
93 changes: 93 additions & 0 deletions hack/generate-helm-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/usr/bin/env bash

# Copyright 2022 Antrea Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

function echoerr {
>&2 echo "$@"
}

_usage="Usage: $0 [--mode (dev|release)] --out <DIR>
Package the Theia chart into a chart archive.
Environment variable VERSION must be set.
--out <DIR> Output directory for chart archive
--help, -h Print this message and exit
You can set the HELM environment variable to the path of the helm binary you want us to
use. Otherwise we will download the appropriate version of the helm binary and use it."

function print_usage {
echoerr "$_usage"
}

function print_help {
echoerr "Try '$0 --help' for more information."
}

MODE="dev"
OUT=""

while [[ $# -gt 0 ]]
do
key="$1"

case $key in
--mode)
MODE="$2"
shift 2
;;
--out)
OUT="$2"
shift 2
;;
-h|--help)
print_usage
exit 0
;;
*) # unknown option
echoerr "Unknown option $1"
exit 1
;;
esac
done

if [ -z "$VERSION" ]; then
echoerr "Environment variable VERSION must be set"
print_help
exit 1
fi

if [ "$OUT" == "" ]; then
echoerr "--out is required to provide output path"
print_help
exit 1
fi

THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

source $THIS_DIR/verify-helm.sh

if [ -z "$HELM" ]; then
HELM="$(verify_helm)"
elif ! $HELM version > /dev/null 2>&1; then
echoerr "$HELM does not appear to be a valid helm binary"
print_help
exit 1
fi

THEIA_CHART="$THIS_DIR/../build/charts/theia"
$HELM package --app-version $VERSION --version $VERSION $THEIA_CHART
mv "theia-$VERSION.tgz" "$OUT/theia-chart.tgz"
7 changes: 7 additions & 0 deletions hack/release/prepare-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ export IMG_TAG=$VERSION
export IMG_NAME=projects.registry.vmware.com/antrea/theia-clickhouse-monitor
./hack/generate-manifest.sh --mode release > "$OUTPUT_DIR"/flow-visibility.yml

cd -

# Package the Theia chart
# We need to strip the leading "v" from the version string to ensure that we use
# a valid SemVer 2 version.
VERSION=${VERSION:1} ./hack/generate-helm-release.sh --out "$OUTPUT_DIR"

ls "$OUTPUT_DIR" | cat

0 comments on commit 7ac8617

Please sign in to comment.