From 4b4112f5f64d18c33cc15eb1bc8eccb603b71a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Tue, 17 Dec 2024 12:05:07 +0100 Subject: [PATCH] Fix a missing dependency between VPA CRD and CR (#1301) --- scenarios/aws/eks/run.go | 8 +++++--- scenarios/aws/kindvm/run.go | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scenarios/aws/eks/run.go b/scenarios/aws/eks/run.go index 0b2aeb287..b707feb27 100644 --- a/scenarios/aws/eks/run.go +++ b/scenarios/aws/eks/run.go @@ -38,9 +38,11 @@ func Run(ctx *pulumi.Context) error { return err } - if _, err := vpa.DeployCRD(&awsEnv, cluster.KubeProvider); err != nil { + vpaCrd, err := vpa.DeployCRD(&awsEnv, cluster.KubeProvider) + if err != nil { return err } + dependsOnVPA := utils.PulumiDependsOn(vpaCrd) if awsEnv.InitOnly() { return nil @@ -110,11 +112,11 @@ func Run(ctx *pulumi.Context) error { // Deploy testing workload if awsEnv.TestingWorkloadDeploy() { - if _, err := nginx.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-nginx", "", true, utils.PulumiDependsOn(workloadWithCRDDeps...)); err != nil { + if _, err := nginx.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-nginx", "", true, utils.PulumiDependsOn(workloadWithCRDDeps...), dependsOnVPA); err != nil { return err } - if _, err := redis.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-redis", true, utils.PulumiDependsOn(workloadWithCRDDeps...)); err != nil { + if _, err := redis.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-redis", true, utils.PulumiDependsOn(workloadWithCRDDeps...), dependsOnVPA); err != nil { return err } diff --git a/scenarios/aws/kindvm/run.go b/scenarios/aws/kindvm/run.go index f58e2cb39..6a919d559 100644 --- a/scenarios/aws/kindvm/run.go +++ b/scenarios/aws/kindvm/run.go @@ -69,9 +69,11 @@ func Run(ctx *pulumi.Context) error { return err } - if _, err := vpa.DeployCRD(&awsEnv, kindKubeProvider); err != nil { + vpaCrd, err := vpa.DeployCRD(&awsEnv, kindKubeProvider) + if err != nil { return err } + dependsOnVPA := utils.PulumiDependsOn(vpaCrd) var dependsOnCrd pulumi.ResourceOption @@ -203,11 +205,11 @@ spec: // Deploy testing workload if awsEnv.TestingWorkloadDeploy() { - if _, err := nginx.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-nginx", "", true, dependsOnCrd); err != nil { + if _, err := nginx.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-nginx", "", true, dependsOnCrd, dependsOnVPA); err != nil { return err } - if _, err := redis.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-redis", true, dependsOnCrd); err != nil { + if _, err := redis.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-redis", true, dependsOnCrd, dependsOnVPA); err != nil { return err }