Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.15] Add --wait to helm tests and other improvements to support CD tools #8742

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/v1.15.9/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
Loading