Skip to content

Commit

Permalink
Revert "Revert "Sanitize the dependencies between K8s fake app pulumi…
Browse files Browse the repository at this point in the history
… components and the agent" (#1265)"

This reverts commit 047dd64.
  • Loading branch information
L3n41c committed Nov 28, 2024
1 parent 047dd64 commit 2022a18
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 38 deletions.
25 changes: 13 additions & 12 deletions scenarios/aws/eks/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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(
Expand All @@ -85,51 +86,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...)); err != nil {
if _, err := nginx.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "workload-nginx", "", true, dependsOnDDAgent /* for DDM */); 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, dependsOnDDAgent /* for DDM */); 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
}
}
Expand Down
18 changes: 9 additions & 9 deletions scenarios/aws/kindvm/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ func Run(ctx *pulumi.Context) error {
return err
}

var dependsOnCrd pulumi.ResourceOption

var fakeIntake *fakeintakeComp.Fakeintake
if awsEnv.AgentUseFakeintake() {
fakeIntakeOptions := []fakeintake.Option{
Expand All @@ -87,6 +85,8 @@ func Run(ctx *pulumi.Context) error {
}
}

var dependsOnDDAgent pulumi.ResourceOption

// Deploy the agent
if awsEnv.AgentDeploy() && !awsEnv.AgentDeployWithOperator() {
customValues := `
Expand Down Expand Up @@ -121,7 +121,7 @@ agents:
return err
}

dependsOnCrd = utils.PulumiDependsOn(k8sAgentComponent)
dependsOnDDAgent = utils.PulumiDependsOn(k8sAgentComponent)
}

// Deploy the operator
Expand Down Expand Up @@ -152,7 +152,7 @@ agents:
return err
}

dependsOnCrd = utils.PulumiDependsOn(operatorAgentComponent)
dependsOnDDAgent = utils.PulumiDependsOn(operatorAgentComponent)

if err := operatorAgentComponent.Export(awsEnv.Ctx(), nil); err != nil {
return err
Expand All @@ -169,11 +169,11 @@ agents:

// 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, dependsOnDDAgent /* for DDM */); 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, dependsOnDDAgent /* for DDM */); err != nil {
return err
}

Expand All @@ -182,13 +182,13 @@ agents:
}

// 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
}
}
Expand All @@ -202,7 +202,7 @@ agents:
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
}
}
Expand Down
16 changes: 8 additions & 8 deletions scenarios/azure/aks/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -87,7 +87,7 @@ providers:
return err
}

dependsOnCrd = utils.PulumiDependsOn(k8sAgentComponent)
dependsOnDDAgent = utils.PulumiDependsOn(k8sAgentComponent)
}

// Deploy standalone dogstatsd
Expand All @@ -99,15 +99,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
}

Expand All @@ -116,13 +116,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
}
}
Expand All @@ -131,7 +131,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
}
}
Expand Down
18 changes: 9 additions & 9 deletions scenarios/gcp/gke/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -75,25 +75,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
}

Expand All @@ -106,17 +106,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
}
}
Expand Down

0 comments on commit 2022a18

Please sign in to comment.