diff --git a/apptests/appscenarios/kubecost.go b/apptests/appscenarios/kubecost.go index bb7344939e..95cce0dbee 100644 --- a/apptests/appscenarios/kubecost.go +++ b/apptests/appscenarios/kubecost.go @@ -2,6 +2,7 @@ package appscenarios import ( "context" + "os" "path/filepath" "github.com/mesosphere/kommander-applications/apptests/constants" @@ -68,14 +69,30 @@ func (r kubeCost) install(ctx context.Context, env *environment.Env, appPath str return err } - // apply the kustomization for the helmrelease - releasePath := filepath.Join(appPath, "/") - err = env.ApplyKustomizations(ctx, releasePath, map[string]string{ - "releaseNamespace": kommanderNamespace, - }) - if err != nil { - return err + // Kubecost has been restructured in 2.14.x. For upgrades to work, we need to handle both versions gracefully. + helmReleasePath := filepath.Join(appPath, "/release") + if _, err = os.Stat(helmReleasePath); err == nil { + // apply the kustomization for the prereqs + prereqs := filepath.Join(appPath, "/pre-install") + err = env.ApplyKustomizations(ctx, prereqs, map[string]string{ + "releaseNamespace": kommanderNamespace, + }) + if err != nil { + return err + } + + // apply the kustomization for the helmrelease + err = env.ApplyKustomizations(ctx, helmReleasePath, map[string]string{ + "releaseNamespace": kommanderNamespace, + }) + if err != nil { + return err + } + return nil } - return err + // apply the helmrelease which is at the "/" path up to 2.13.x + return env.ApplyKustomizations(ctx, filepath.Join(appPath, "/"), map[string]string{ + "releaseNamespace": kommanderNamespace, + }) } diff --git a/apptests/appscenarios/kubecost_test.go b/apptests/appscenarios/kubecost_test.go index cdca182864..ec9fc1d65a 100644 --- a/apptests/appscenarios/kubecost_test.go +++ b/apptests/appscenarios/kubecost_test.go @@ -91,11 +91,16 @@ var _ = Describe("Kubecost Tests", Label("kubecost"), func() { deploymentList = &appsv1.DeploymentList{} err = k8sClient.List(ctx, deploymentList, listOptions) Expect(err).To(BeNil()) - Expect(deploymentList.Items).To(HaveLen(4)) + Expect(deploymentList.Items).To(HaveLen(4), "Expected 4 deployments to be created - cost-analyzer, grafana, prometheus server and prometheus alertmanager") Expect(err).To(BeNil()) for _, deployment := range deploymentList.Items { - Expect(deployment.Spec.Template.Spec.PriorityClassName).To(Equal(dkpHighPriority)) + Expect(deployment.Spec.Template.Spec.PriorityClassName).To( + Equal(dkpHighPriority), + "Deployment %q had an unexpected PriorityClass %q", + deployment.Name, + deployment.Spec.Template.Spec.PriorityClassName, + ) } }) diff --git a/hack/list-images.sh b/hack/list-images.sh index d90f06d624..0e61398847 100755 --- a/hack/list-images.sh +++ b/hack/list-images.sh @@ -78,6 +78,7 @@ declare -rx releaseNamespace=unused \ tfaName=unused \ notPopulatedAnywhereAsThisIsOnlyForAirgappedBundle=unused \ caIssuerName=unused \ + CLUSTER_ID=unused \ kommanderChartVersion="${kommanderChartVersion:-}" IMAGES_FILE="$(realpath "$(mktemp .helm-list-images-XXXXXX)")"