Skip to content

Commit

Permalink
fix: release chart with native helm install method (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
StarpTech authored Nov 22, 2023
1 parent 8cdb17a commit e50d00f
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 15 deletions.
2 changes: 2 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
### Install helm dependencies

```shell
# Add bitnami repo to install dependencies like postgresql, keycloak and clickhouse
helm repo add bitnami https://charts.bitnami.com/bitnami
# Install the helm dependencies (Only needed once)
helm dependency build ./cosmo
```
Expand Down
8 changes: 4 additions & 4 deletions helm/cosmo/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ dependencies:
version: 12.8.0
- name: keycloak
repository: https://charts.bitnami.com/bitnami
version: 17.3.1
version: 17.3.4
- name: clickhouse
repository: https://charts.bitnami.com/bitnami
version: 4.1.5
digest: sha256:29b383d0573b51532a262fbf0ec65c78c5e78c754aa6fcad02fc520a38c4268a
generated: "2023-11-20T10:48:23.4318274+01:00"
version: 4.1.7
digest: sha256:d4b25197a67d2223e46b8d89db5cdcd5a6cef1e7026789902751610ae5c0ac00
generated: "2023-11-21T22:21:23.451763679+01:00"
52 changes: 48 additions & 4 deletions helm/cosmo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,51 @@ helm repo add bitnami https://charts.bitnami.com/bitnami
# Install the helm dependencies
helm dependency build
# Install the helm chart with the release name "cosmo" the name is important it used to reference services in values file.
helm install cosmo -f values.full.yaml ./cosmo
# --atomic ensures that the release is rolled back if it fails to install
helm install cosmo --atomic -f values.full.yaml .
```

### Run Helm Tests

The Helm chart comes with a set of tests that you can run to ensure that the stack is working as expected.
Modify the `values.full.yaml` file to enable the tests:

```yaml
global:
helmTests:
enabled: true
```
and run:
```shell
helm test cosmo
```

you should see the following output after a few seconds:

```shell
❯ helm test cosmo
NAME: cosmo cosmo
LAST DEPLOYED: Tue Nov 21 22:50:40 2023
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: cosmo-controlplane-test-connection
Last Started: Tue Nov 21 22:51:07 2023
Last Completed: Tue Nov 21 22:51:10 2023
Phase: Succeeded
TEST SUITE: cosmo-graphqlmetrics-test-connection
Last Started: Tue Nov 21 22:51:10 2023
Last Completed: Tue Nov 21 22:51:14 2023
Phase: Succeeded
TEST SUITE: cosmo-otelcollector-test-connection
Last Started: Tue Nov 21 22:51:14 2023
Last Completed: Tue Nov 21 22:51:18 2023
Phase: Succeeded
TEST SUITE: cosmo-studio-test-connection
Last Started: Tue Nov 21 22:51:18 2023
Last Completed: Tue Nov 21 22:51:22 2023
Phase: Succeeded
```

### Removing stack after use
Expand Down Expand Up @@ -67,7 +111,7 @@ helm upgrade cosmo ./cosmo \

### CLI Key

In the `global.seed.apiKey` of your `values.yaml` we defined your API key. You can use this API key to authenticate with the Cosmo CLI.
In the `global.seed.apiKey` of your `values.full.yaml` we defined your API key. You can use this API key to authenticate with the Cosmo CLI.

```sh
export COSMO_API_KEY="cosmo_669b576aaadc10ee1ae81d9193425705"
Expand All @@ -76,7 +120,7 @@ npx wgc -h
```

### Router
The router is not enabled by default because it requires an API token to be set and a published federated graph. After you have created an API token with the Cosmo CLI `wgc federated-graph create-token <graph-name>`, set the right configurations in the `values.yaml` file.
The router is not enabled by default because it requires an API token to be set and a published federated graph. After you have created an API token with the Cosmo CLI `wgc federated-graph create-token <graph-name>`, set the right configurations in the `values.full.yaml` file.

```yaml
router:
Expand All @@ -85,7 +129,7 @@ router:
graphApiToken: "<changeme>"
```
Run `helm install cosmo` to apply the changes.
Run `helm upgrade cosmo -f values.full.yaml .` to apply the changes.

## Kapp support

Expand Down
Binary file removed helm/cosmo/charts/clickhouse-4.1.5.tgz
Binary file not shown.
Binary file added helm/cosmo/charts/clickhouse-4.1.7.tgz
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ metadata:
{{- include "controlplane.labels" . | nindent 4 }}
annotations:
# Run migration job before helm install/upgrade
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
# Less priority than the migration job so the secret is created before the migration job
"helm.sh/hook-weight": "-10"
"helm.sh/hook-weight": "-5"
# Support for k14s.io. This annotation ensure that the job is run after clickhouse deployment
{{- if .Values.global.clickhouse.enabled }}
kapp.k14s.io/change-rule.clickhouse: "upsert after upserting cosmo.apps.clickhouse.wundergraph.com/deployment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ metadata:
{{- include "controlplane.labels" . | nindent 4 }}
annotations:
# Run migration job before helm install/upgrade
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
# Less priority than the migration job so the secret is created before the migration job
"helm.sh/hook-weight": "-10"
"helm.sh/hook-weight": "-5"
# Support for k14s.io. This annotation ensure that the job is run after the postgresql deployment
{{- if .Values.global.postgresql.enabled }}
kapp.k14s.io/change-rule.postgres: "upsert after upserting cosmo.apps.postgresql.wundergraph.com/deployment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
{{- include "controlplane.labels" . | nindent 4 }}
annotations:
# Run the job before installing the helm chart
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
# Support for k14s.io. This annotation ensure that the job is run after the postgresql and keycloak deployment
kapp.k14s.io/change-rule.postgres: "upsert after upserting cosmo.apps.postgresql.wundergraph.com/deployment"
Expand Down
2 changes: 1 addition & 1 deletion helm/cosmo/charts/controlplane/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
# Create secrets before the release
"helm.sh/hook": pre-install,pre-upgrade
# Ensure secrets are created before the migrations jobs are run
"helm.sh/hook-weight": "-5"
"helm.sh/hook-weight": "-10"
# Support for k14s.io. This annotation will produce a redeployment when the secret changes.
kapp.k14s.io/versioned: ""
labels:
Expand Down
Binary file removed helm/cosmo/charts/keycloak-17.3.1.tgz
Binary file not shown.
Binary file added helm/cosmo/charts/keycloak-17.3.4.tgz
Binary file not shown.

0 comments on commit e50d00f

Please sign in to comment.