From 279ca0490a42854310543f36d2d36672c8a371ca Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Tue, 8 Nov 2022 09:39:36 -0500 Subject: [PATCH] Set chart appVersion with 'helm package' on release Use the '--app-version' parameter to 'helm package' to dynamically set the chart 'appVersion' field. We can then omit the hardcoded 'appVersion' field in the Chart.yaml file. The chart 'version' field is also set by 'helm package' but we still need to define it in the Chart.yaml file since 'help dep update' requires it. The placeholder 'version' field is now set to 0.0.0 just to give it some value. For E2E, since the version fields are no longer hardcoded, it now simulates a release by running 'helm package' and extracting the tar files to HELM_REPO_LOCATION, now set to ./helm_repo. Signed-off-by: Tom Pantelis --- .github/workflows/e2e-full.yml | 2 +- .github/workflows/linting.yml | 3 +++ .gitignore | 1 + Makefile | 17 +++++++++++++---- ct.yaml | 4 ++-- submariner-k8s-broker/Chart.yaml | 3 +-- submariner-operator/Chart.yaml | 3 +-- submariner-operator/README.md | 2 -- submariner-operator/templates/NOTES.txt | 4 ---- submariner-operator/templates/submariner.yaml | 2 +- submariner-operator/values.yaml | 8 ++------ 11 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/e2e-full.yml b/.github/workflows/e2e-full.yml index 3ae3d27..1a2b87a 100644 --- a/.github/workflows/e2e-full.yml +++ b/.github/workflows/e2e-full.yml @@ -11,7 +11,7 @@ jobs: e2e: name: E2E if: contains(github.event.pull_request.labels.*.name, 'ready-to-test') - timeout-minutes: 45 + timeout-minutes: 120 runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 7004527..1bf8b5a 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -53,6 +53,9 @@ jobs: - name: Set up helm/chart-testing uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 + - name: Set up local helm repo + run: make local-helm-repo + - name: Run helm/chart-testing (lint) run: ct lint --config ct.yaml diff --git a/.gitignore b/.gitignore index 9229891..6af83bf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ *.tgz Makefile.dapper Dockerfile.* +helm_repo diff --git a/Makefile b/Makefile index 61aff56..744a73d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ BASE_BRANCH ?= release-0.14 export BASE_BRANCH -export HELM_REPO_LOCATION=. +export HELM_REPO_LOCATION=./helm_repo ifneq (,$(DAPPER_HOST_ARCH)) @@ -25,11 +25,20 @@ export SUBCTL_VERSION # Targets to make -e2e: E2E_ARGS=cluster1 cluster2 +CHART_PACKAGES := submariner-k8s-broker-$(CHARTS_VERSION).tgz submariner-operator-$(CHARTS_VERSION).tgz + +local-helm-repo: $(CHART_PACKAGES) + mkdir -p $(HELM_REPO_LOCATION) + for archive in $^; do \ + tar xzf $$archive -C $(HELM_REPO_LOCATION); \ + done + +e2e: local-helm-repo + $(SCRIPTS_DIR)/e2e.sh %.tgz: helm dep update $(subst -$(CHARTS_VERSION),,$(basename $(@F))) - helm package --version $(CHARTS_VERSION) $(subst -$(CHARTS_VERSION),,$(basename $(@F))) + helm package --version $(CHARTS_VERSION) --app-version $(CHARTS_VERSION) $(subst -$(CHARTS_VERSION),,$(basename $(@F))) helm-docs: # Avoid polluting repo with helm-docs' README/LICENSE or other files in the release archive @@ -45,7 +54,7 @@ helm-docs: exit 1; \ fi -release: submariner-k8s-broker-$(CHARTS_VERSION).tgz submariner-operator-$(CHARTS_VERSION).tgz +release: $(CHART_PACKAGES) git checkout gh-pages mv *.tgz $(CHARTS_DIR) if [ -f $(CHARTS_DIR)/index.yaml ]; then \ diff --git a/ct.yaml b/ct.yaml index 6becc5b..263e652 100644 --- a/ct.yaml +++ b/ct.yaml @@ -1,7 +1,7 @@ --- charts: - - submariner-operator - - submariner-k8s-broker + - ./helm_repo/submariner-operator + - ./helm_repo/submariner-k8s-broker # Tests that maintainer name is valid GitHub account, which isn't what we want # See: https://github.com/helm/chart-testing/issues/192 validate-maintainers: false diff --git a/submariner-k8s-broker/Chart.yaml b/submariner-k8s-broker/Chart.yaml index a5305eb..ef8962c 100644 --- a/submariner-k8s-broker/Chart.yaml +++ b/submariner-k8s-broker/Chart.yaml @@ -1,8 +1,7 @@ --- name: submariner-k8s-broker -version: 0.14.0-m1 +version: 0.0.0 apiVersion: v2 -appVersion: 0.14.0-m1 description: Submariner Kubernetes Broker keywords: home: https://submariner-io.github.io/ diff --git a/submariner-operator/Chart.yaml b/submariner-operator/Chart.yaml index 469c8fe..613aa0a 100644 --- a/submariner-operator/Chart.yaml +++ b/submariner-operator/Chart.yaml @@ -1,8 +1,7 @@ --- name: submariner-operator -version: 0.14.0-m1 +version: 0.0.0 apiVersion: v2 -appVersion: 0.14.0-m1 description: Submariner enables direct networking between Pods and Services in different Kubernetes clusters keywords: home: https://submariner-io.github.io/ diff --git a/submariner-operator/README.md b/submariner-operator/README.md index 8e14df0..64d1255 100644 --- a/submariner-operator/README.md +++ b/submariner-operator/README.md @@ -24,8 +24,6 @@ Submariner enables direct networking between Pods and Services in different Kube | broker.namespace | string | `"xyz"` | | | broker.server | string | `"example.k8s.apiserver"` | | | broker.token | string | `"test"` | | -| gateway.image.repository | string | `"quay.io/submariner/submariner-gateway"` | | -| gateway.image.tag | string | `"0.14.0"` | | | ipsec.debug | bool | `false` | | | ipsec.forceUDPEncaps | bool | `false` | | | ipsec.ikePort | int | `500` | | diff --git a/submariner-operator/templates/NOTES.txt b/submariner-operator/templates/NOTES.txt index 1ea590c..509c9bd 100644 --- a/submariner-operator/templates/NOTES.txt +++ b/submariner-operator/templates/NOTES.txt @@ -1,7 +1,3 @@ Submariner is now installed. -{{- if .Values.gateway.nodeSelectorEnabled }} -If you haven't done so yet, please label a node as `submariner.io/gateway=true` to elect it for running Submariner. -{{- end }} - By default, Submariner runs with 1 replica. If you have more than one Gateway host, you can scale Submariner to N replicas, and the other Submariner pods will simply join the leader election pool. \ No newline at end of file diff --git a/submariner-operator/templates/submariner.yaml b/submariner-operator/templates/submariner.yaml index 4ae4b0f..c47f97c 100644 --- a/submariner-operator/templates/submariner.yaml +++ b/submariner-operator/templates/submariner.yaml @@ -23,7 +23,7 @@ spec: namespace: {{ .Release.Namespace }} natEnabled: {{ .Values.submariner.natEnabled }} repository: {{ .Values.submariner.images.repository }} - version: {{ .Values.submariner.images.tag }} + version: {{ default .Chart.AppVersion .Values.submariner.images.tag }} {{- with .Values.images }} {{- if . }} imageOverrides: diff --git a/submariner-operator/values.yaml b/submariner-operator/values.yaml index d7b1ac6..df9f988 100644 --- a/submariner-operator/values.yaml +++ b/submariner-operator/values.yaml @@ -15,7 +15,7 @@ submariner: coreDNSCustomConfig: {} images: repository: quay.io/submariner - tag: "0.14.0-m1" + tag: "" broker: server: example.k8s.apiserver token: test @@ -39,15 +39,11 @@ leadership: operator: image: repository: quay.io/submariner/submariner-operator - tag: "0.14.0-m1" + tag: "" pullPolicy: IfNotPresent resources: {} tolerations: [] affinity: {} -gateway: - image: - repository: quay.io/submariner/submariner-gateway - tag: "0.14.0-m1" serviceAccounts: operator: create: true