Skip to content

Commit

Permalink
add workflow to release helm charts (#569)
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander authored Jun 7, 2024
1 parent 877d43e commit b1f55e4
Show file tree
Hide file tree
Showing 14 changed files with 171 additions and 44 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: release
on:
push:
branches:
- 'release/**'

jobs:
release-helm-charts:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# TODO: find a way to let the release workflow depends on the lint & test ones
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: "**/*.sum"
- name: Check helm docs
run: |
make gen-helm-docs
if ! git diff --exit-code; then
echo "Generated files are not up-to-date. Please run 'make gen-helm-docs' and commit changes."
exit 1
fi
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Add repositories
run: |
for dir in $(ls -d ./manifests/charts/*/); do
helm dependency list $dir 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
done
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: ./manifests/charts
mark_as_latest: false
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
24 changes: 14 additions & 10 deletions MAINTAIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ This doc tracks how to maintain the source code of HTNN.

To release a new version, please follow the steps below:

1. Create a new release branch `release/v${version}` from the main branch.
2. Create tag `api/v${version}`, then update the `go.mod` which depend on `mosn.io/htnn/api`.
3. Do the same things with `types`, `controller` and `plugins`.
4. Remove the `go.work` file.
* Create a new release branch `release/v${version}` from the main branch.
* Create tag `api/v${version}`, then update the `go.mod` which depend on `mosn.io/htnn/api`.
* Do the same things with `types`, `controller` and `plugins`.
* Remove the `go.work` file.
* Update the version in the `manifests/charts/*/Chart.yaml`.
* Change the version in the documentation, including:
* quick_start.md
* installation.md
(TBD)

## Upgrade components
Expand All @@ -16,9 +20,9 @@ To release a new version, please follow the steps below:

To upgrade Istio, please follow the steps below:

1. Discuss the impact of the upgrade. For example, is there any break change, do we need to upgrade K8S, etc.
2. Update the base image used in the integration / e2e tests.
3. Update the ISTIO_VERSION we define in the Makefile.
4. Update the versions of istio, envoy and go-control-plane package in the `go.mod` and `go.sum`.
5. Update the link `/envoy/v1.xx.y/configuration/` in the doc to the new Envoy version. And `istio/istio/xxx` to the new Istio version.
6. Update the charts' versions used in the `manifests/charts/htnn/Chart.yaml`.
* Discuss the impact of the upgrade. For example, is there any break change, do we need to upgrade K8S, etc.
* Update the base image used in the integration / e2e tests.
* Update the ISTIO_VERSION we define in the Makefile.
* Update the versions of istio, envoy and go-control-plane package in the `go.mod` and `go.sum`.
* Update the link `/envoy/v1.xx.y/configuration/` in the doc to the new Envoy version. And `istio/istio/xxx` to the new Istio version.
* Update the charts' dependency versions used in the `manifests/charts/*/Chart.yaml`.
5 changes: 5 additions & 0 deletions artifacthub-repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Artifact Hub repository metadata file
repositoryID: 050ffa18-7f5a-48d6-8000-ff005d1e4e00
owners: # (used to claim repository ownership)
- name: spacewander
email: [email protected]
3 changes: 2 additions & 1 deletion manifests/charts/htnn-controller/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apiVersion: v2
name: htnn-controller
description: A Helm chart for HTNN controller
icon: https://avatars.githubusercontent.com/u/58020396
sources:
- https://github.com/mosn/htnn
maintainers:
Expand All @@ -11,7 +12,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.1.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
12 changes: 8 additions & 4 deletions manifests/charts/htnn-controller/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# htnn-controller

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.1](https://img.shields.io/badge/AppVersion-0.2.1-informational?style=flat-square)
![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.1](https://img.shields.io/badge/AppVersion-0.2.1-informational?style=flat-square)

A Helm chart for HTNN controller

Expand All @@ -9,12 +9,14 @@ A Helm chart for HTNN controller
To install the chart with the release `htnn-controller`:

```shell
helm repo add mosn xxx # TODO: given the real one
helm repo add htnn https://mosn.github.io/htnn
helm repo update

helm install htnn-controller mosn/htnn-controller --namespace istio-system --create-namespace --wait --debug
helm install htnn-controller htnn/htnn-controller --namespace istio-system --create-namespace
```

For more information like how to configure and troubleshoot, please refer to the [Installation Guide](https://github.com/mosn/htnn/blob/main/site/content/en/docs/getting-started/installation.md).

## Uninstall

To uninstall the Helm release `htnn-controller`:
Expand Down Expand Up @@ -46,6 +48,8 @@ helm uninstall htnn-controller -n istio-system
| istiod.pilot.env.PILOT_ENABLE_HTNN | string | `"true"` | |
| istiod.pilot.env.PILOT_ENABLE_HTNN_STATUS | string | `"true"` | |
| istiod.pilot.env.PILOT_SCOPE_GATEWAY_TO_NAMESPACE | string | `"true"` | |
| istiod.pilot.image | string | `"ghcr.io/mosn/htnn-controller:dev"` | |
| istiod.pilot.hub | string | `"ghcr.io/mosn"` | |
| istiod.pilot.image | string | `"htnn-controller"` | |
| istiod.pilot.tag | string | `"dev"` | |
| istiod.revision | string | `""` | |

6 changes: 4 additions & 2 deletions manifests/charts/htnn-controller/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
To install the chart with the release `htnn-controller`:

```shell
helm repo add mosn xxx # TODO: given the real one
helm repo add htnn https://mosn.github.io/htnn
helm repo update

helm install htnn-controller mosn/htnn-controller --namespace istio-system --create-namespace --wait --debug
helm install htnn-controller htnn/htnn-controller --namespace istio-system --create-namespace
```

For more information like how to configure and troubleshoot, please refer to the [Installation Guide](https://github.com/mosn/htnn/blob/main/site/content/en/docs/getting-started/installation.md).

## Uninstall

To uninstall the Helm release `htnn-controller`:
Expand Down
4 changes: 3 additions & 1 deletion manifests/charts/htnn-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ istiod:
revision: ""
pilot:
# FIXME: use the released image once we have a release
image: ghcr.io/mosn/htnn-controller:dev
hub: ghcr.io/mosn
image: htnn-controller
tag: dev
env:
PILOT_SCOPE_GATEWAY_TO_NAMESPACE: "true"
PILOT_ENABLE_HTNN: "true"
Expand Down
3 changes: 2 additions & 1 deletion manifests/charts/htnn-gateway/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apiVersion: v2
name: htnn-gateway
description: A Helm chart for HTNN data plane running as gateway
icon: https://avatars.githubusercontent.com/u/58020396
sources:
- https://github.com/mosn/htnn
maintainers:
Expand All @@ -11,7 +12,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.1.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
20 changes: 17 additions & 3 deletions manifests/charts/htnn-gateway/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# htnn-gateway

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.1](https://img.shields.io/badge/AppVersion-0.2.1-informational?style=flat-square)
![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.1](https://img.shields.io/badge/AppVersion-0.2.1-informational?style=flat-square)

A Helm chart for HTNN data plane running as gateway

Expand All @@ -9,12 +9,26 @@ A Helm chart for HTNN data plane running as gateway
To install the chart with the release `htnn-gateway`:

```shell
helm repo add mosn xxx # TODO: given the real one
helm repo add htnn https://mosn.github.io/htnn
helm repo update

helm install htnn-gateway mosn/htnn-gateway --namespace istio-system --create-namespace --wait --debug
helm install htnn-gateway htnn/htnn-gateway --namespace istio-system --create-namespace
```

For more information like how to configure and troubleshoot, please refer to the [Installation Guide](https://github.com/mosn/htnn/blob/main/site/content/en/docs/getting-started/installation.md).

### `image: auto` Information

The image used by the chart, `auto`, may be unintuitive.
This exists because the pod spec will be automatically populated at runtime, using the same mechanism as [Sidecar Injection](istio.io/latest/docs/setup/additional-setup/sidecar-injection).
This allows the same configurations and lifecycle to apply to gateways as sidecars.

Note: this does mean two things:

1. the namespace the gateway is deployed in must not have the `istio-injection=disabled` label.
See [Controlling the injection policy](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/#controlling-the-injection-policy) for more info.
2. the gateway must be installed after `htnn/htnn-controller` is installed so that the pod spec can be injected.

## Uninstall

To uninstall the Helm release `htnn-gateway`:
Expand Down
18 changes: 16 additions & 2 deletions manifests/charts/htnn-gateway/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,26 @@
To install the chart with the release `htnn-gateway`:

```shell
helm repo add mosn xxx # TODO: given the real one
helm repo add htnn https://mosn.github.io/htnn
helm repo update

helm install htnn-gateway mosn/htnn-gateway --namespace istio-system --create-namespace --wait --debug
helm install htnn-gateway htnn/htnn-gateway --namespace istio-system --create-namespace
```

For more information like how to configure and troubleshoot, please refer to the [Installation Guide](https://github.com/mosn/htnn/blob/main/site/content/en/docs/getting-started/installation.md).

### `image: auto` Information

The image used by the chart, `auto`, may be unintuitive.
This exists because the pod spec will be automatically populated at runtime, using the same mechanism as [Sidecar Injection](istio.io/latest/docs/setup/additional-setup/sidecar-injection).
This allows the same configurations and lifecycle to apply to gateways as sidecars.

Note: this does mean two things:

1. the namespace the gateway is deployed in must not have the `istio-injection=disabled` label.
See [Controlling the injection policy](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/#controlling-the-injection-policy) for more info.
2. the gateway must be installed after `htnn/htnn-controller` is installed so that the pod spec can be injected.

## Uninstall

To uninstall the Helm release `htnn-gateway`:
Expand Down
18 changes: 14 additions & 4 deletions site/content/en/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ title: Installation
* Configure helm repository address. Execute the following command to add the repository:

```shell
helm repo add mosn xxxx # TODO: setup such a repo
helm repo add htnn https://mosn.github.io/htnn
helm repo update
```

Expand All @@ -19,26 +19,36 @@ helm repo update
Installation command:

```shell
$ helm install $package_name mosn/$package_name --namespace istio-system --create-namespace --wait
$ helm install $package_name htnn/$package_name --namespace istio-system --create-namespace --wait
```

Where `$package_name` can be:

* `htnn-controller`: control plane component
* `htnn-gateway`: data plane component

Note that the pod spec of `htnn-gateway` will be automatically populated at runtime, using the same mechanism as [Sidecar Injection](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection).

This does mean two things:

1. the namespace the `htnn-gateway` is deployed in must not have the `istio-injection=disabled` label.
See [Controlling the injection policy](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/#controlling-the-injection-policy) for more info.
2. the `htnn-gateway` must be installed after `htnn-controller` is installed so that the pod spec can be injected.

If you set up the k8s environment with `kind`, the `helm install ... htnn/htnn-gateway --wait` will fail because `kind` doesn't support LoadBalancer service by default. You can use `kubectl wait --timeout=5m -n istio-system deployment/istio-ingressgateway --for=condition=Available` to indicate if the installation is finished.

### Configuration

We can use Helm's [Value files](https://helm.sh/docs/chart_template_guide/values_files/) to configure the default values of the Helm Chart. For example:

```shell
helm install htnn-controller mosn/htnn-controller ... --set istiod.pilot.env.HTNN_ENABLE_LDS_PLUGIN_VIA_ECDS=true
helm install htnn-controller htnn/htnn-controller ... --set istiod.pilot.env.HTNN_ENABLE_LDS_PLUGIN_VIA_ECDS=true
```

Configurations related to the control plane start with `istiod`, for specific configuration items please refer to the [control plane configuration](https://github.com/istio/istio/blob/1.21.2/manifests/charts/istio-control/istio-discovery/values.yaml).

```shell
helm install htnn-gateway mosn/htnn-gateway ... --set gateway.podAnnotations.test=ok
helm install htnn-gateway htnn/htnn-gateway ... --set gateway.podAnnotations.test=ok
```

Configurations related to the data plane start with `gateway`, for specific configuration items please refer to the [data plane configuration](https://github.com/istio/istio/blob/1.21.2/manifests/charts/gateway/values.yaml).
8 changes: 4 additions & 4 deletions site/content/en/docs/getting-started/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: Quick Start
* Configure helm repository address. Execute the following commands to add the repository:

```shell
helm repo add mosn xxxx # TODO: setup such a repo
helm repo add htnn https://mosn.github.io/htnn
helm repo update
```

Expand All @@ -18,7 +18,7 @@ helm repo update
1. Install the control plane component:

```shell
$ helm install htnn-controller mosn/htnn-controller --namespace istio-system --create-namespace --wait
$ helm install htnn-controller htnn/htnn-controller --namespace istio-system --create-namespace --debug --wait
NAME: htnn-controller
LAST DEPLOYED: Wed May 29 18:42:18 2024
NAMESPACE: istio-system
Expand All @@ -30,7 +30,7 @@ TEST SUITE: None
2. Install the data plane component:

```shell
$ helm install htnn-gateway mosn/htnn-gateway --namespace istio-system --create-namespace && \
$ helm install htnn-gateway htnn/htnn-gateway --namespace istio-system --create-namespace && \
kubectl wait --timeout=5m -n istio-system deployment/istio-ingressgateway --for=condition=Available
NAME: htnn-gateway
LAST DEPLOYED: Wed May 29 19:59:22 2024
Expand All @@ -40,7 +40,7 @@ REVISION: 1
TEST SUITE: None
```

Here we have not used the `--wait` parameter, instead, we used the `kubectl wait` command to wait for the `istio-ingressgateway` deployment to complete. Because kind does not support LoadBalancer type of Service by default, the ExternalIP for Service `istio-ingressgateway` will remain in `Pending` status. This does not affect our hands-on experience. If you're interested in this, refer to the [kind official documentation](https://kind.sigs.k8s.io/docs/user/loadbalancer/) and consider installing metallb.
Here we have not used the `--wait` parameter, instead, we used the `kubectl wait` command to wait for the `istio-ingressgateway` deployment to complete. Because `kind` does not support LoadBalancer type of Service by default, the ExternalIP for Service `istio-ingressgateway` will remain in `Pending` status. This does not affect our hands-on experience. If you're interested in this, refer to the [kind official documentation](https://kind.sigs.k8s.io/docs/user/loadbalancer/) and consider installing metallb.

## Configuring Routes

Expand Down
Loading

0 comments on commit b1f55e4

Please sign in to comment.