diff --git a/scenarios/aws/eks/run.go b/scenarios/aws/eks/run.go index b707feb27..dccb999bd 100644 --- a/scenarios/aws/eks/run.go +++ b/scenarios/aws/eks/run.go @@ -69,7 +69,8 @@ func Run(ctx *pulumi.Context) error { return err } } - workloadWithCRDDeps := make([]pulumi.Resource, 0) + + var dependsOnDDAgent pulumi.ResourceOption if awsEnv.AgentDeploy() { k8sAgentOptions := make([]kubernetesagentparams.Option, 0) k8sAgentOptions = append( @@ -100,51 +101,51 @@ func Run(ctx *pulumi.Context) error { return err } - workloadWithCRDDeps = append(workloadWithCRDDeps, k8sAgentComponent) - + dependsOnDDAgent = utils.PulumiDependsOn(k8sAgentComponent) } + // Deploy standalone dogstatsd if awsEnv.DogstatsdDeploy() { - if _, err := dogstatsdstandalone.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "dogstatsd-standalone", fakeIntake, true, "", utils.PulumiDependsOn(cluster)); err != nil { + if _, err := dogstatsdstandalone.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "dogstatsd-standalone", fakeIntake, true, ""); err != nil { return err } } // Deploy testing workload if awsEnv.TestingWorkloadDeploy() { - if _, err := nginx.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-nginx", "", true, utils.PulumiDependsOn(workloadWithCRDDeps...), dependsOnVPA); err != nil { + if _, err := nginx.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-nginx", "", true, dependsOnDDAgent /* for DDM */, dependsOnVPA); err != nil { return err } - if _, err := redis.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-redis", true, utils.PulumiDependsOn(workloadWithCRDDeps...), dependsOnVPA); err != nil { + if _, err := redis.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-redis", true, dependsOnDDAgent /* for DDM */, dependsOnVPA); err != nil { return err } - if _, err := cpustress.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-cpustress", utils.PulumiDependsOn(cluster)); err != nil { + if _, err := cpustress.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-cpustress"); err != nil { return err } // dogstatsd clients that report to the Agent - if _, err := dogstatsd.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-dogstatsd", 8125, "/var/run/datadog/dsd.socket", utils.PulumiDependsOn(workloadWithCRDDeps...)); err != nil { + if _, err := dogstatsd.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-dogstatsd", 8125, "/var/run/datadog/dsd.socket", dependsOnDDAgent /* for admission */); err != nil { return err } if awsEnv.DogstatsdDeploy() { // dogstatsd clients that report to the dogstatsd standalone deployment - if _, err := dogstatsd.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-dogstatsd-standalone", dogstatsdstandalone.HostPort, dogstatsdstandalone.Socket, utils.PulumiDependsOn(cluster)); err != nil { + if _, err := dogstatsd.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-dogstatsd-standalone", dogstatsdstandalone.HostPort, dogstatsdstandalone.Socket, dependsOnDDAgent /* for admission */); err != nil { return err } } - if _, err := tracegen.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-tracegen", utils.PulumiDependsOn(cluster)); err != nil { + if _, err := tracegen.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-tracegen"); err != nil { return err } - if _, err := prometheus.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-prometheus", utils.PulumiDependsOn(cluster)); err != nil { + if _, err := prometheus.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-prometheus"); err != nil { return err } - if _, err := mutatedbyadmissioncontroller.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-mutated", "workload-mutated-lib-injection", utils.PulumiDependsOn(workloadWithCRDDeps...)); err != nil { + if _, err := mutatedbyadmissioncontroller.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-mutated", "workload-mutated-lib-injection", dependsOnDDAgent /* for admission */); err != nil { return err } } diff --git a/scenarios/aws/kindvm/run.go b/scenarios/aws/kindvm/run.go index e34f02e7f..321cdcbf9 100644 --- a/scenarios/aws/kindvm/run.go +++ b/scenarios/aws/kindvm/run.go @@ -75,8 +75,6 @@ func Run(ctx *pulumi.Context) error { } dependsOnVPA := utils.PulumiDependsOn(vpaCrd) - var dependsOnCrd pulumi.ResourceOption - var fakeIntake *fakeintakeComp.Fakeintake if awsEnv.AgentUseFakeintake() { fakeIntakeOptions := []fakeintake.Option{ @@ -99,6 +97,8 @@ func Run(ctx *pulumi.Context) error { } } + var dependsOnDDAgent pulumi.ResourceOption + // Deploy the agent if awsEnv.AgentDeploy() && !awsEnv.AgentDeployWithOperator() { customValues := ` @@ -137,7 +137,7 @@ agents: return err } - dependsOnCrd = utils.PulumiDependsOn(k8sAgentComponent) + dependsOnDDAgent = utils.PulumiDependsOn(k8sAgentComponent) } // Deploy the operator @@ -188,7 +188,7 @@ spec: return err } - dependsOnCrd = utils.PulumiDependsOn(k8sAgentWithOperatorComp) + dependsOnDDAgent = utils.PulumiDependsOn(k8sAgentWithOperatorComp) if err := k8sAgentWithOperatorComp.Export(awsEnv.Ctx(), nil); err != nil { return err @@ -205,11 +205,11 @@ spec: // Deploy testing workload if awsEnv.TestingWorkloadDeploy() { - if _, err := nginx.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-nginx", "", true, dependsOnCrd, dependsOnVPA); err != nil { + if _, err := nginx.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-nginx", "", true, dependsOnDDAgent /* for DDM */, dependsOnVPA); err != nil { return err } - if _, err := redis.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-redis", true, dependsOnCrd, dependsOnVPA); err != nil { + if _, err := redis.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-redis", true, dependsOnDDAgent /* for DDM */, dependsOnVPA); err != nil { return err } @@ -218,13 +218,13 @@ spec: } // dogstatsd clients that report to the Agent - if _, err := dogstatsd.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-dogstatsd", 8125, "/var/run/datadog/dsd.socket"); err != nil { + if _, err := dogstatsd.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-dogstatsd", 8125, "/var/run/datadog/dsd.socket", dependsOnDDAgent /* for admission */); err != nil { return err } // dogstatsd clients that report to the dogstatsd standalone deployment if awsEnv.DogstatsdDeploy() { - if _, err := dogstatsd.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-dogstatsd-standalone", dogstatsdstandalone.HostPort, dogstatsdstandalone.Socket); err != nil { + if _, err := dogstatsd.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-dogstatsd-standalone", dogstatsdstandalone.HostPort, dogstatsdstandalone.Socket, dependsOnDDAgent /* for admission */); err != nil { return err } } @@ -238,7 +238,7 @@ spec: return err } - if _, err := mutatedbyadmissioncontroller.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-mutated", "workload-mutated-lib-injection"); err != nil { + if _, err := mutatedbyadmissioncontroller.K8sAppDefinition(&awsEnv, kindKubeProvider, "workload-mutated", "workload-mutated-lib-injection", dependsOnDDAgent /* for admission */); err != nil { return err } } diff --git a/scenarios/azure/aks/run.go b/scenarios/azure/aks/run.go index 537b82dba..ed4b7d997 100644 --- a/scenarios/azure/aks/run.go +++ b/scenarios/azure/aks/run.go @@ -38,7 +38,7 @@ func Run(ctx *pulumi.Context) error { return err } - var dependsOnCrd pulumi.ResourceOption + var dependsOnDDAgent pulumi.ResourceOption // Deploy the agent if env.AgentDeploy() { @@ -97,7 +97,7 @@ providers: return err } - dependsOnCrd = utils.PulumiDependsOn(k8sAgentComponent) + dependsOnDDAgent = utils.PulumiDependsOn(k8sAgentComponent) } // Deploy standalone dogstatsd @@ -109,15 +109,15 @@ providers: // Deploy testing workload if env.TestingWorkloadDeploy() { - if _, err := nginx.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-nginx", "", true, dependsOnCrd); err != nil { + if _, err := nginx.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-nginx", "", true, dependsOnDDAgent /* for DDM */); err != nil { return err } - if _, err := nginx.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-nginx-kata", kataRuntimeClass, true, dependsOnCrd); err != nil { + if _, err := nginx.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-nginx-kata", kataRuntimeClass, true, dependsOnDDAgent /* for DDM */); err != nil { return err } - if _, err := redis.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-redis", true, dependsOnCrd); err != nil { + if _, err := redis.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-redis", true, dependsOnDDAgent /* for DDM */); err != nil { return err } @@ -126,13 +126,13 @@ providers: } // dogstatsd clients that report to the Agent - if _, err := dogstatsd.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-dogstatsd", 8125, "/var/run/datadog/dsd.socket"); err != nil { + if _, err := dogstatsd.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-dogstatsd", 8125, "/var/run/datadog/dsd.socket", dependsOnDDAgent /* for admission */); err != nil { return err } if env.DogstatsdDeploy() { // dogstatsd clients that report to the dogstatsd standalone deployment - if _, err := dogstatsd.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-dogstatsd-standalone", dogstatsdstandalone.HostPort, dogstatsdstandalone.Socket); err != nil { + if _, err := dogstatsd.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-dogstatsd-standalone", dogstatsdstandalone.HostPort, dogstatsdstandalone.Socket, dependsOnDDAgent /* for admission */); err != nil { return err } } @@ -141,7 +141,7 @@ providers: return err } - if _, err := mutatedbyadmissioncontroller.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-mutated", "workload-mutated-lib-injection"); err != nil { + if _, err := mutatedbyadmissioncontroller.K8sAppDefinition(&env, aksCluster.KubeProvider, "workload-mutated", "workload-mutated-lib-injection", dependsOnDDAgent /* for admission */); err != nil { return err } } diff --git a/scenarios/gcp/gke/run.go b/scenarios/gcp/gke/run.go index 16f42a601..d57eb816e 100644 --- a/scenarios/gcp/gke/run.go +++ b/scenarios/gcp/gke/run.go @@ -37,7 +37,7 @@ func Run(ctx *pulumi.Context) error { return err } - var dependsOnCrd pulumi.ResourceOption + var dependsOnDDAgent pulumi.ResourceOption // Deploy the agent if env.AgentDeploy() { @@ -84,25 +84,25 @@ func Run(ctx *pulumi.Context) error { return err } - dependsOnCrd = utils.PulumiDependsOn(k8sAgentComponent) + dependsOnDDAgent = utils.PulumiDependsOn(k8sAgentComponent) } // Deploy testing workload if env.TestingWorkloadDeploy() { - if _, err := nginx.K8sAppDefinition(&env, cluster.KubeProvider, "workload-nginx", "", true, dependsOnCrd); err != nil { + if _, err := nginx.K8sAppDefinition(&env, cluster.KubeProvider, "workload-nginx", "", true, dependsOnDDAgent /* for DDM */); err != nil { return err } - if _, err := cpustress.K8sAppDefinition(&env, cluster.KubeProvider, "workload-cpustress", dependsOnCrd); err != nil { + if _, err := cpustress.K8sAppDefinition(&env, cluster.KubeProvider, "workload-cpustress"); err != nil { return err } - if _, err := prometheus.K8sAppDefinition(&env, cluster.KubeProvider, "workload-prometheus", dependsOnCrd); err != nil { + if _, err := prometheus.K8sAppDefinition(&env, cluster.KubeProvider, "workload-prometheus"); err != nil { return err } - if _, err := mutatedbyadmissioncontroller.K8sAppDefinition(&env, cluster.KubeProvider, "workload-mutated", "workload-mutated-lib-injection", dependsOnCrd); err != nil { + if _, err := mutatedbyadmissioncontroller.K8sAppDefinition(&env, cluster.KubeProvider, "workload-mutated", "workload-mutated-lib-injection", dependsOnDDAgent /* for admission */); err != nil { return err } @@ -115,17 +115,17 @@ func Run(ctx *pulumi.Context) error { } // dogstatsd clients that report to the dogstatsd standalone deployment - if _, err := dogstatsd.K8sAppDefinition(&env, cluster.KubeProvider, "workload-dogstatsd-standalone", dogstatsdstandalone.HostPort, dogstatsdstandalone.Socket, dependsOnCrd); err != nil { + if _, err := dogstatsd.K8sAppDefinition(&env, cluster.KubeProvider, "workload-dogstatsd-standalone", dogstatsdstandalone.HostPort, dogstatsdstandalone.Socket, dependsOnDDAgent /* for admission */); err != nil { return err } } // dogstatsd clients that report to the Agent - if _, err := dogstatsd.K8sAppDefinition(&env, cluster.KubeProvider, "workload-dogstatsd", 8125, "/var/run/datadog/dsd.socket", dependsOnCrd); err != nil { + if _, err := dogstatsd.K8sAppDefinition(&env, cluster.KubeProvider, "workload-dogstatsd", 8125, "/var/run/datadog/dsd.socket", dependsOnDDAgent /* for admission */); err != nil { return err } - if _, err := tracegen.K8sAppDefinition(&env, cluster.KubeProvider, "workload-tracegen", dependsOnCrd); err != nil { + if _, err := tracegen.K8sAppDefinition(&env, cluster.KubeProvider, "workload-tracegen"); err != nil { return err } }