Skip to content

Commit

Permalink
Fix a missing dependency between VPA CRD and CR
Browse files Browse the repository at this point in the history
  • Loading branch information
L3n41c committed Dec 16, 2024
1 parent c2ff600 commit fadf6ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions scenarios/aws/eks/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
8 changes: 5 additions & 3 deletions scenarios/aws/kindvm/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit fadf6ef

Please sign in to comment.