diff --git a/changelog/v1.15.9/helm-wait.yaml b/changelog/v1.15.9/helm-wait.yaml new file mode 100644 index 00000000000..55460a6d286 --- /dev/null +++ b/changelog/v1.15.9/helm-wait.yaml @@ -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. + diff --git a/install/helm/gloo/templates/0-namespace.yaml b/install/helm/gloo/templates/0-namespace.yaml index 6ff9292eab5..35ad5a31385 100644 --- a/install/helm/gloo/templates/0-namespace.yaml +++ b/install/helm/gloo/templates/0-namespace.yaml @@ -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}} \ No newline at end of file diff --git a/install/helm/gloo/templates/19-gloo-mtls-certgen-job.yaml b/install/helm/gloo/templates/19-gloo-mtls-certgen-job.yaml index ed05b8298b3..91285390c6d 100644 --- a/install/helm/gloo/templates/19-gloo-mtls-certgen-job.yaml +++ b/install/helm/gloo/templates/19-gloo-mtls-certgen-job.yaml @@ -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 }} diff --git a/test/kube2e/helm/helm_test.go b/test/kube2e/helm/helm_test.go index f3ae060d03c..616745333d5 100644 --- a/test/kube2e/helm/helm_test.go +++ b/test/kube2e/helm/helm_test.go @@ -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 { @@ -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 != "" { diff --git a/test/kube2e/upgrade/upgrade_test.go b/test/kube2e/upgrade/upgrade_test.go index 0b7a5df02bd..183be697352 100644 --- a/test/kube2e/upgrade/upgrade_test.go +++ b/test/kube2e/upgrade/upgrade_test.go @@ -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 { @@ -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 != "" {