Skip to content

Commit

Permalink
Add --wait to helm tests and other improvements to support CD tools (#…
Browse files Browse the repository at this point in the history
…8738)

* Add --wait to helm tests and other improvements to support CD tools

* Adding changelog

* Adding upgrade tests

* Adding changelog file to new location

* Deleting changelog file from old location

---------

Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: changelog-bot <changelog-bot>
  • Loading branch information
davidjumani and soloio-bulldozer[bot] authored Oct 3, 2023
1 parent e9f6ab6 commit 55ad3e9
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog/v1.16.0-beta13/helm-wait.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
- type: NON_USER_FACING
description: Most CI tools wait until resources are ready to mark a release as successful such as ArgoCD and Flux. We can emulate this by passing the --wait flag to helm rather than individually adding support for every CD tool out there.

1 change: 1 addition & 0 deletions install/helm/gloo/templates/0-namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ metadata:
{{- end}}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "-1" # Ensure that this is always the first hook triggered
{{- end}}
2 changes: 2 additions & 0 deletions install/helm/gloo/templates/19-gloo-mtls-certgen-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ metadata:
name: gloo-mtls-certgen
namespace: {{ .Release.Namespace }}
annotations:
{{- /* With ArgoCD, there is no concept or installs or upgrades. Everything is a sync. */}}
{{- /* Due to this behavour of ArgoCD, the value of `gateway.certGenJob.runOnUpdate` can not be respected and will run on every sync. */}}
{{- if .Values.gateway.certGenJob.runOnUpdate }}
"helm.sh/hook": pre-install, pre-upgrade
{{- include "gloo.jobHelmDeletePolicySucceededAndBeforeCreation" .Values.gateway.certGenJob | nindent 4 }}
Expand Down
22 changes: 22 additions & 0 deletions test/kube2e/helm/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,17 @@ func installGloo(testHelper *helper.SoloTestHelper, chartUri string, fromRelease
args = append(args, chartUri)
}
args = append(args, "-n", testHelper.InstallNamespace,
// As most CD tools wait for resources to be ready before marking the release as successful,
// we're emulating that here by passing these two flags.
// This way we ensure that we indirectly add support for CD tools
"--wait",
"--wait-for-jobs",
// We run our e2e tests on a kind cluster, but kind hasn’t implemented LoadBalancer support.
// This leads to the service being in a pending state.
// Since the --wait flag is set, this can cause the upgrade to fail
// as helm waits until the service is ready and eventually times out.
// So instead we use the service type as ClusterIP to work around this limitation.
"--set", "gatewayProxies.gatewayProxy.service.type=ClusterIP",
"--create-namespace",
"--values", helmValuesFile)
if strictValidation {
Expand Down Expand Up @@ -566,6 +577,17 @@ func upgradeGloo(testHelper *helper.SoloTestHelper, chartUri string, crdDir stri
defer cleanupFunc()

var args = []string{"upgrade", testHelper.HelmChartName,
// As most CD tools wait for resources to be ready before marking the release as successful,
// we're emulating that here by passing these two flags.
// This way we ensure that we indirectly add support for CD tools
"--wait",
"--wait-for-jobs",
// We run our e2e tests on a kind cluster, but kind hasn’t implemented LoadBalancer support.
// This leads to the service being in a pending state.
// Since the --wait flag is set, this can cause the upgrade to fail
// as helm waits until the service is ready and eventually times out.
// So instead we use the service type as ClusterIP to work around this limitation.
"--set", "gatewayProxies.gatewayProxy.service.type=ClusterIP",
"-n", testHelper.InstallNamespace,
"--values", valueOverrideFile}
if targetRelease != "" {
Expand Down
22 changes: 22 additions & 0 deletions test/kube2e/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,17 @@ func installGloo(testHelper *helper.SoloTestHelper, fromRelease string, strictVa
"--version", fromRelease)

args = append(args, "-n", testHelper.InstallNamespace,
// As most CD tools wait for resources to be ready before marking the release as successful,
// we're emulating that here by passing these two flags.
// This way we ensure that we indirectly add support for CD tools
"--wait",
"--wait-for-jobs",
// We run our e2e tests on a kind cluster, but kind hasn’t implemented LoadBalancer support.
// This leads to the service being in a pending state.
// Since the --wait flag is set, this can cause the upgrade to fail
// as helm waits until the service is ready and eventually times out.
// So instead we use the service type as ClusterIP to work around this limitation.
"--set", "gatewayProxies.gatewayProxy.service.type=ClusterIP",
"--create-namespace",
"--values", helmValuesFile)
if strictValidation {
Expand Down Expand Up @@ -306,6 +317,17 @@ func upgradeGloo(testHelper *helper.SoloTestHelper, chartUri string, targetRelea
defer cleanupFunc()

var args = []string{"upgrade", testHelper.HelmChartName, chartUri,
// As most CD tools wait for resources to be ready before marking the release as successful,
// we're emulating that here by passing these two flags.
// This way we ensure that we indirectly add support for CD tools
"--wait",
"--wait-for-jobs",
// We run our e2e tests on a kind cluster, but kind hasn’t implemented LoadBalancer support.
// This leads to the service being in a pending state.
// Since the --wait flag is set, this can cause the upgrade to fail
// as helm waits until the service is ready and eventually times out.
// So instead we use the service type as ClusterIP to work around this limitation.
"--set", "gatewayProxies.gatewayProxy.service.type=ClusterIP",
"-n", testHelper.InstallNamespace,
"--values", valueOverrideFile}
if targetReleasedVersion != "" {
Expand Down

0 comments on commit 55ad3e9

Please sign in to comment.