Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflicting resource names for dda w/operator #1307

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/datadog/agent/kubernetes_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ func NewDDAWithOperator(e config.Env, resourceName string, kubeProvider *kuberne
return err
}

pulumiResourceOptions := append(ddaParams.PulumiResourceOptions, pulumi.Parent(comp))
ddaParams.PulumiResourceOptions = append(ddaParams.PulumiResourceOptions, pulumi.Parent(comp))

_, err = dda.K8sAppDefinition(e, kubeProvider, ddaParams, pulumiResourceOptions...)
_, err = dda.K8sAppDefinition(e, kubeProvider, ddaParams, ddaParams.PulumiResourceOptions...)

if err != nil {
return err
}

baseName := "dda-linux"
baseName := "dda-with-operator-linux"

comp.LinuxNodeAgent, err = componentskube.NewKubernetesObjRef(e, baseName+"-nodeAgent", ddaParams.Namespace, "Pod", pulumi.String("").ToStringOutput(), pulumi.String("datadoghq/v2alpha1").ToStringOutput(), map[string]string{"app.kubernetes.io/instance": ddaParams.DDAConfig.Name + "-agent"})

Expand Down
14 changes: 7 additions & 7 deletions components/datadog/operator/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type HelmComponent struct {
func NewHelmInstallation(e config.Env, args HelmInstallationArgs, opts ...pulumi.ResourceOption) (*HelmComponent, error) {
apiKey := e.AgentAPIKey()
appKey := e.AgentAPPKey()
baseName := "dda"

opts = append(opts, pulumi.Providers(args.KubeProvider), e.WithProviders(config.ProviderRandom), pulumi.DeletedWith(args.KubeProvider))

helmComponent := &HelmComponent{}
Expand All @@ -64,7 +64,7 @@ func NewHelmInstallation(e config.Env, args HelmInstallationArgs, opts ...pulumi
secret, err := corev1.NewSecret(e.Ctx(), "datadog-credentials", &corev1.SecretArgs{
Metadata: metav1.ObjectMetaArgs{
Namespace: ns.Metadata.Name(),
Name: pulumi.Sprintf("%s-datadog-credentials", baseName),
Name: pulumi.String("dda-datadog-credentials"),
},
StringData: pulumi.StringMap{
"api-key": apiKey,
Expand Down Expand Up @@ -93,9 +93,9 @@ func NewHelmInstallation(e config.Env, args HelmInstallationArgs, opts ...pulumi
operatorImagePath = args.OperatorFullImagePath
}
operatorImagePath, operatorImageTag := utils.ParseImageReference(operatorImagePath)
linuxInstallName := baseName + "-operator-linux"
linuxInstallName := "datadog-operator-linux"

values := buildLinuxHelmValues(baseName, operatorImagePath, operatorImageTag)
values := buildLinuxHelmValues(operatorImagePath, operatorImageTag)
values.configureImagePullSecret(imgPullSecret)

defaultYAMLValues := values.toYAMLPulumiAssetOutput()
Expand Down Expand Up @@ -132,10 +132,10 @@ func NewHelmInstallation(e config.Env, args HelmInstallationArgs, opts ...pulumi

type HelmValues pulumi.Map

func buildLinuxHelmValues(baseName string, operatorImagePath string, operatorImageTag string) HelmValues {
func buildLinuxHelmValues(operatorImagePath string, operatorImageTag string) HelmValues {
return HelmValues{
"apiKeyExistingSecret": pulumi.String(baseName + "-datadog-credentials"),
"appKeyExistingSecret": pulumi.String(baseName + "-datadog-credentials"),
"apiKeyExistingSecret": pulumi.String("dda-datadog-credentials"),
"appKeyExistingSecret": pulumi.String("dda-datadog-credentials"),
"image": pulumi.Map{
"repository": pulumi.String(operatorImagePath),
"tag": pulumi.String(operatorImageTag),
Expand Down
6 changes: 3 additions & 3 deletions scenarios/aws/kindvm/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ spec:
)
}

operatorAgentComponent, err := agent.NewDDAWithOperator(&awsEnv, awsEnv.CommonNamer().ResourceName("dd-operator-agent"), kindKubeProvider, ddaOptions...)
k8sAgentWithOperatorComp, err := agent.NewDDAWithOperator(&awsEnv, awsEnv.CommonNamer().ResourceName("datadog-agent-with-operator"), kindKubeProvider, ddaOptions...)

if err != nil {
return err
}

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

if err := operatorAgentComponent.Export(awsEnv.Ctx(), nil); err != nil {
if err := k8sAgentWithOperatorComp.Export(awsEnv.Ctx(), nil); err != nil {
return err
}

Expand Down
Loading