From 135ae7ab146d7520b7c8c8bb7b27e0c2413281c6 Mon Sep 17 00:00:00 2001 From: Fanny Jiang Date: Mon, 18 Nov 2024 19:11:36 -0500 Subject: [PATCH 1/3] fix namespaces in DDA w/operator components --- .../datadog/agent/kubernetes_operator.go | 44 ++++++++----------- .../datadog/agentwithoperatorparams/params.go | 4 +- components/datadog/apps/dda/datadogagent.go | 9 +++- components/datadog/operatorparams/params.go | 5 +-- 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/components/datadog/agent/kubernetes_operator.go b/components/datadog/agent/kubernetes_operator.go index 8b666ab0b..b0f731fd3 100644 --- a/components/datadog/agent/kubernetes_operator.go +++ b/components/datadog/agent/kubernetes_operator.go @@ -15,14 +15,7 @@ import ( func NewDDAWithOperator(e config.Env, resourceName string, kubeProvider *kubernetes.Provider, operatorOpts []operatorparams.Option, ddaOptions ...agentwithoperatorparams.Option) (*KubernetesAgent, error) { return components.NewComponent(e, resourceName, func(comp *KubernetesAgent) error { - - operatorParams, err := operatorparams.NewParams(e, operatorOpts...) - if err != nil { - return err - } - ddaParams, err := agentwithoperatorparams.NewParams(ddaOptions...) - if err != nil { return err } @@ -33,36 +26,37 @@ func NewDDAWithOperator(e config.Env, resourceName string, kubeProvider *kuberne return err } - _, err = dda.K8sAppDefinition(e, kubeProvider, "datadog", ddaParams.FakeIntake, ddaParams.KubeletTLSVerify, e.Ctx().Stack(), ddaParams.DDAConfig, utils.PulumiDependsOn(operatorComp)) + dda, err := dda.K8sAppDefinition(e, kubeProvider, ddaParams.Namespace, ddaParams.FakeIntake, ddaParams.KubeletTLSVerify, e.Ctx().Stack(), ddaParams.DDAConfig, utils.PulumiDependsOn(operatorComp)) if err != nil { return err } - baseName := "dda-linux" + if dda != nil { + baseName := "dda-linux" - comp.LinuxNodeAgent, err = NewKubernetesObjRef(e, baseName+"-nodeAgent", operatorParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("Version").ToStringOutput(), map[string]string{"app": baseName + "-datadog"}) + comp.LinuxNodeAgent, err = NewKubernetesObjRef(e, baseName+"-nodeAgent", ddaParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("Version").ToStringOutput(), map[string]string{"app": baseName + "-datadog"}) - if err != nil { - return err - } + if err != nil { + return err + } - comp.LinuxClusterAgent, err = NewKubernetesObjRef(e, baseName+"-clusterAgent", operatorParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("Version").ToStringOutput(), map[string]string{ - "app": baseName + "-datadog-cluster-agent", - }) + comp.LinuxClusterAgent, err = NewKubernetesObjRef(e, baseName+"-clusterAgent", ddaParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("Version").ToStringOutput(), map[string]string{ + "app": baseName + "-datadog-cluster-agent", + }) - if err != nil { - return err - } + if err != nil { + return err + } - comp.LinuxClusterChecks, err = NewKubernetesObjRef(e, baseName+"-clusterChecks", operatorParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("version").ToStringOutput(), map[string]string{ - "app": baseName + "-datadog-clusterchecks", - }) + comp.LinuxClusterChecks, err = NewKubernetesObjRef(e, baseName+"-clusterChecks", ddaParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("version").ToStringOutput(), map[string]string{ + "app": baseName + "-datadog-clusterchecks", + }) - if err != nil { - return err + if err != nil { + return err + } } - return nil }) } diff --git a/components/datadog/agentwithoperatorparams/params.go b/components/datadog/agentwithoperatorparams/params.go index df0a39ce0..cc0342880 100644 --- a/components/datadog/agentwithoperatorparams/params.go +++ b/components/datadog/agentwithoperatorparams/params.go @@ -20,9 +20,7 @@ type Params struct { type Option = func(*Params) error func NewParams(options ...Option) (*Params, error) { - version := &Params{ - Namespace: "datadog", - } + version := &Params{} return common.ApplyOption(version, options) } diff --git a/components/datadog/apps/dda/datadogagent.go b/components/datadog/apps/dda/datadogagent.go index c83a943e4..27dea9182 100644 --- a/components/datadog/apps/dda/datadogagent.go +++ b/components/datadog/apps/dda/datadogagent.go @@ -84,12 +84,17 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace configureImagePullSecret(ddaConfig, imagePullSecret) } + ddaName := "datadog-agent" + if e.PipelineID() != "" { + ddaName = fmt.Sprintf("datadog-agent-%s", e.PipelineID()) + } + _, err = apiextensions.NewCustomResource(e.Ctx(), "datadog-agent", &apiextensions.CustomResourceArgs{ ApiVersion: pulumi.String("datadoghq.com/v2alpha1"), Kind: pulumi.String("DatadogAgent"), Metadata: &metav1.ObjectMetaArgs{ - Name: pulumi.String("datadog"), - Namespace: pulumi.String("datadog"), + Name: pulumi.String(ddaName), + Namespace: pulumi.String(namespace), }, OtherFields: ddaConfig, }, opts...) diff --git a/components/datadog/operatorparams/params.go b/components/datadog/operatorparams/params.go index 188fb01b3..8a03d31a4 100644 --- a/components/datadog/operatorparams/params.go +++ b/components/datadog/operatorparams/params.go @@ -24,10 +24,7 @@ type Params struct { type Option = func(*Params) error func NewParams(e config.Env, options ...Option) (*Params, error) { - version := &Params{ - Namespace: "datadog", - OperatorFullImagePath: "gcr.io/datadoghq/operator:latest", - } + version := &Params{} if e.PipelineID() != "" && e.CommitSHA() != "" { options = append(options, WithOperatorFullImagePath(utils.BuildDockerImagePath(fmt.Sprintf("%s/operator", e.InternalRegistry()), fmt.Sprintf("%s-%s", e.PipelineID(), e.CommitSHA())))) From 75195b0216afb40ff1b8b1ede17ca1d9b9a22924 Mon Sep 17 00:00:00 2001 From: Fanny Jiang Date: Thu, 21 Nov 2024 19:48:21 -0500 Subject: [PATCH 2/3] apply review suggestions, refactor --- .../datadog/agent/helm/kubernetes_agent.go | 13 +++--- components/datadog/agent/kubernetes.go | 25 ++++++----- .../datadog/agent/kubernetes_operator.go | 44 +++++++++---------- components/datadog/apps/dda/datadogagent.go | 21 +++++---- components/datadog/operator/operator.go | 15 +++++-- .../kubernetes_object_ref.go | 2 +- 6 files changed, 67 insertions(+), 53 deletions(-) rename components/{datadog/agent => kubernetes}/kubernetes_object_ref.go (98%) diff --git a/components/datadog/agent/helm/kubernetes_agent.go b/components/datadog/agent/helm/kubernetes_agent.go index a0140cf15..4943aa411 100644 --- a/components/datadog/agent/helm/kubernetes_agent.go +++ b/components/datadog/agent/helm/kubernetes_agent.go @@ -1,6 +1,7 @@ package helm import ( + componentskube "github.com/DataDog/test-infra-definitions/components/kubernetes" "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" @@ -43,7 +44,7 @@ func NewKubernetesAgent(e config.Env, resourceName string, kubeProvider *kuberne baseName := "dda-" + platform - comp.LinuxNodeAgent, err = agent.NewKubernetesObjRef(e, baseName+"-nodeAgent", params.Namespace, "Pod", appVersion, version, map[string]string{ + comp.LinuxNodeAgent, err = componentskube.NewKubernetesObjRef(e, baseName+"-nodeAgent", params.Namespace, "Pod", appVersion, version, map[string]string{ "app": baseName + "-datadog", }) @@ -51,7 +52,7 @@ func NewKubernetesAgent(e config.Env, resourceName string, kubeProvider *kuberne return err } - comp.LinuxClusterAgent, err = agent.NewKubernetesObjRef(e, baseName+"-clusterAgent", params.Namespace, "Pod", appVersion, version, map[string]string{ + comp.LinuxClusterAgent, err = componentskube.NewKubernetesObjRef(e, baseName+"-clusterAgent", params.Namespace, "Pod", appVersion, version, map[string]string{ "app": baseName + "-datadog-cluster-agent", }) @@ -59,7 +60,7 @@ func NewKubernetesAgent(e config.Env, resourceName string, kubeProvider *kuberne return err } - comp.LinuxClusterChecks, err = agent.NewKubernetesObjRef(e, baseName+"-clusterChecks", params.Namespace, "Pod", appVersion, version, map[string]string{ + comp.LinuxClusterChecks, err = componentskube.NewKubernetesObjRef(e, baseName+"-clusterChecks", params.Namespace, "Pod", appVersion, version, map[string]string{ "app": baseName + "-datadog-clusterchecks", }) @@ -70,21 +71,21 @@ func NewKubernetesAgent(e config.Env, resourceName string, kubeProvider *kuberne baseName = "dda-" + platform - comp.WindowsNodeAgent, err = agent.NewKubernetesObjRef(e, baseName+"-nodeAgent", params.Namespace, "Pod", appVersion, version, map[string]string{ + comp.WindowsNodeAgent, err = componentskube.NewKubernetesObjRef(e, baseName+"-nodeAgent", params.Namespace, "Pod", appVersion, version, map[string]string{ "app": baseName + "-datadog", }) if err != nil { return err } - comp.WindowsClusterAgent, err = agent.NewKubernetesObjRef(e, baseName+"-clusterAgent", params.Namespace, "Pod", appVersion, version, map[string]string{ + comp.WindowsClusterAgent, err = componentskube.NewKubernetesObjRef(e, baseName+"-clusterAgent", params.Namespace, "Pod", appVersion, version, map[string]string{ "app": baseName + "-datadog-cluster-agent", }) if err != nil { return err } - comp.WindowsClusterChecks, err = agent.NewKubernetesObjRef(e, baseName+"-clusterChecks", params.Namespace, "Pod", appVersion, version, map[string]string{ + comp.WindowsClusterChecks, err = componentskube.NewKubernetesObjRef(e, baseName+"-clusterChecks", params.Namespace, "Pod", appVersion, version, map[string]string{ "app": baseName + "-datadog-clusterchecks", }) if err != nil { diff --git a/components/datadog/agent/kubernetes.go b/components/datadog/agent/kubernetes.go index 3da247593..64b529db2 100644 --- a/components/datadog/agent/kubernetes.go +++ b/components/datadog/agent/kubernetes.go @@ -1,6 +1,7 @@ package agent import ( + "github.com/DataDog/test-infra-definitions/components/kubernetes" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/DataDog/test-infra-definitions/components" @@ -9,13 +10,13 @@ import ( type KubernetesAgentOutput struct { components.JSONImporter - LinuxNodeAgent KubernetesObjRefOutput `json:"linuxNodeAgent"` - LinuxClusterAgent KubernetesObjRefOutput `json:"linuxClusterAgent"` - LinuxClusterChecks KubernetesObjRefOutput `json:"linuxClusterChecks"` + LinuxNodeAgent kubernetes.KubernetesObjRefOutput `json:"linuxNodeAgent"` + LinuxClusterAgent kubernetes.KubernetesObjRefOutput `json:"linuxClusterAgent"` + LinuxClusterChecks kubernetes.KubernetesObjRefOutput `json:"linuxClusterChecks"` - WindowsNodeAgent KubernetesObjRefOutput `json:"windowsNodeAgent"` - WindowsClusterAgent KubernetesObjRefOutput `json:"windowsClusterAgent"` - WindowsClusterChecks KubernetesObjRefOutput `json:"windowsClusterChecks"` + WindowsNodeAgent kubernetes.KubernetesObjRefOutput `json:"windowsNodeAgent"` + WindowsClusterAgent kubernetes.KubernetesObjRefOutput `json:"windowsClusterAgent"` + WindowsClusterChecks kubernetes.KubernetesObjRefOutput `json:"windowsClusterChecks"` } // KubernetesAgent is an installer to install the Datadog Agent on a Kubernetes cluster. @@ -23,13 +24,13 @@ type KubernetesAgent struct { pulumi.ResourceState components.Component - LinuxNodeAgent *KubernetesObjectRef `pulumi:"linuxNodeAgent"` - LinuxClusterAgent *KubernetesObjectRef `pulumi:"linuxClusterAgent"` - LinuxClusterChecks *KubernetesObjectRef `pulumi:"linuxClusterChecks"` + LinuxNodeAgent *kubernetes.KubernetesObjectRef `pulumi:"linuxNodeAgent"` + LinuxClusterAgent *kubernetes.KubernetesObjectRef `pulumi:"linuxClusterAgent"` + LinuxClusterChecks *kubernetes.KubernetesObjectRef `pulumi:"linuxClusterChecks"` - WindowsNodeAgent *KubernetesObjectRef `pulumi:"windowsNodeAgent"` - WindowsClusterAgent *KubernetesObjectRef `pulumi:"windowsClusterAgent"` - WindowsClusterChecks *KubernetesObjectRef `pulumi:"windowsClusterChecks"` + WindowsNodeAgent *kubernetes.KubernetesObjectRef `pulumi:"windowsNodeAgent"` + WindowsClusterAgent *kubernetes.KubernetesObjectRef `pulumi:"windowsClusterAgent"` + WindowsClusterChecks *kubernetes.KubernetesObjectRef `pulumi:"windowsClusterChecks"` } func (h *KubernetesAgent) Export(ctx *pulumi.Context, out *KubernetesAgentOutput) error { diff --git a/components/datadog/agent/kubernetes_operator.go b/components/datadog/agent/kubernetes_operator.go index b0f731fd3..a36f6f5a4 100644 --- a/components/datadog/agent/kubernetes_operator.go +++ b/components/datadog/agent/kubernetes_operator.go @@ -1,9 +1,6 @@ package agent import ( - "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes" - "github.com/pulumi/pulumi/sdk/v3/go/pulumi" - "github.com/DataDog/test-infra-definitions/common/config" "github.com/DataDog/test-infra-definitions/common/utils" "github.com/DataDog/test-infra-definitions/components" @@ -11,6 +8,8 @@ import ( "github.com/DataDog/test-infra-definitions/components/datadog/apps/dda" "github.com/DataDog/test-infra-definitions/components/datadog/operator" "github.com/DataDog/test-infra-definitions/components/datadog/operatorparams" + componentskube "github.com/DataDog/test-infra-definitions/components/kubernetes" + "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes" ) func NewDDAWithOperator(e config.Env, resourceName string, kubeProvider *kubernetes.Provider, operatorOpts []operatorparams.Option, ddaOptions ...agentwithoperatorparams.Option) (*KubernetesAgent, error) { @@ -26,37 +25,38 @@ func NewDDAWithOperator(e config.Env, resourceName string, kubeProvider *kuberne return err } - dda, err := dda.K8sAppDefinition(e, kubeProvider, ddaParams.Namespace, ddaParams.FakeIntake, ddaParams.KubeletTLSVerify, e.Ctx().Stack(), ddaParams.DDAConfig, utils.PulumiDependsOn(operatorComp)) + _, ddaRef, err := dda.K8sAppDefinition(e, kubeProvider, ddaParams.Namespace, ddaParams.FakeIntake, ddaParams.KubeletTLSVerify, e.Ctx().Stack(), ddaParams.DDAConfig, utils.PulumiDependsOn(operatorComp)) if err != nil { return err } - if dda != nil { - baseName := "dda-linux" + baseName := "dda-linux" + appVersion := ddaRef.AppVersion + apiVersion := ddaRef.Version - comp.LinuxNodeAgent, err = NewKubernetesObjRef(e, baseName+"-nodeAgent", ddaParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("Version").ToStringOutput(), map[string]string{"app": baseName + "-datadog"}) + comp.LinuxNodeAgent, err = componentskube.NewKubernetesObjRef(e, baseName+"-nodeAgent", ddaParams.Namespace, "Pod", appVersion, apiVersion.ToStringOutput(), map[string]string{"app": baseName + "-datadog"}) - if err != nil { - return err - } + if err != nil { + return err + } - comp.LinuxClusterAgent, err = NewKubernetesObjRef(e, baseName+"-clusterAgent", ddaParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("Version").ToStringOutput(), map[string]string{ - "app": baseName + "-datadog-cluster-agent", - }) + comp.LinuxClusterAgent, err = componentskube.NewKubernetesObjRef(e, baseName+"-clusterAgent", ddaParams.Namespace, "Pod", appVersion, apiVersion, map[string]string{ + "app": baseName + "-datadog-cluster-agent", + }) - if err != nil { - return err - } + if err != nil { + return err + } - comp.LinuxClusterChecks, err = NewKubernetesObjRef(e, baseName+"-clusterChecks", ddaParams.Namespace, "Pod", pulumi.String("appVersion").ToStringOutput(), pulumi.String("version").ToStringOutput(), map[string]string{ - "app": baseName + "-datadog-clusterchecks", - }) + comp.LinuxClusterChecks, err = componentskube.NewKubernetesObjRef(e, baseName+"-clusterChecks", ddaParams.Namespace, "Pod", appVersion, apiVersion, map[string]string{ + "app": baseName + "-datadog-clusterchecks", + }) - if err != nil { - return err - } + if err != nil { + return err } + return nil }) } diff --git a/components/datadog/apps/dda/datadogagent.go b/components/datadog/apps/dda/datadogagent.go index 27dea9182..6048fc4b9 100644 --- a/components/datadog/apps/dda/datadogagent.go +++ b/components/datadog/apps/dda/datadogagent.go @@ -3,6 +3,7 @@ package dda import ( "encoding/json" "fmt" + "strings" "dario.cat/mergo" "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes" @@ -18,7 +19,7 @@ import ( componentskube "github.com/DataDog/test-infra-definitions/components/kubernetes" ) -func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace string, fakeIntake *fakeintake.Fakeintake, kubeletTLSVerify bool, clusterName string, customDda string, opts ...pulumi.ResourceOption) (*componentskube.Workload, error) { +func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace string, fakeIntake *fakeintake.Fakeintake, kubeletTLSVerify bool, clusterName string, customDda string, opts ...pulumi.ResourceOption) (*componentskube.Workload, *componentskube.KubernetesObjectRef, error) { apiKey := e.AgentAPIKey() appKey := e.AgentAPPKey() baseName := "dda-with-operator" @@ -26,7 +27,7 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace k8sComponent := &componentskube.Workload{} if err := e.Ctx().RegisterComponentResource("dd:agent-with-operator", "dda", k8sComponent, opts...); err != nil { - return nil, err + return nil, nil, err } opts = append(opts, pulumi.Parent(k8sComponent)) @@ -42,7 +43,7 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace opts..., ) if err != nil { - return nil, err + return nil, nil, err } opts = append(opts, utils.PulumiDependsOn(ns)) @@ -59,7 +60,7 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace }, }, opts...) if err != nil { - return nil, err + return nil, nil, err } opts = append(opts, utils.PulumiDependsOn(secret)) @@ -70,7 +71,7 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace ddaConfig, err = mergeYamlToConfig(ddaConfig, customDda) if err != nil { - return nil, err + return nil, nil, err } // Image pull secrets need to be configured after custom DDA config merge because pulumi.StringOutput cannot be marshalled to JSON @@ -78,7 +79,7 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace if e.ImagePullRegistry() != "" { imagePullSecret, err = utils.NewImagePullSecret(e, namespace, opts...) if err != nil { - return nil, err + return nil, nil, err } opts = append(opts, utils.PulumiDependsOn(imagePullSecret)) configureImagePullSecret(ddaConfig, imagePullSecret) @@ -86,7 +87,7 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace ddaName := "datadog-agent" if e.PipelineID() != "" { - ddaName = fmt.Sprintf("datadog-agent-%s", e.PipelineID()) + ddaName = strings.Join([]string{ddaName, e.PipelineID()}, "-") } _, err = apiextensions.NewCustomResource(e.Ctx(), "datadog-agent", &apiextensions.CustomResourceArgs{ @@ -99,10 +100,12 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace OtherFields: ddaConfig, }, opts...) if err != nil { - return nil, err + return nil, nil, err } - return k8sComponent, nil + ddaRef, err := componentskube.NewKubernetesObjRef(e, baseName, namespace, "DatadogAgent", pulumi.String("").ToStringOutput(), pulumi.String("datadoghq.com/v2alpha1").ToStringOutput(), map[string]string{"app": baseName}) + + return k8sComponent, ddaRef, nil } func buildDDAConfig(baseName string, clusterName string, kubeletTLSVerify bool) kubernetes.UntypedArgs { diff --git a/components/datadog/operator/operator.go b/components/datadog/operator/operator.go index 69c90043d..76a309ff7 100644 --- a/components/datadog/operator/operator.go +++ b/components/datadog/operator/operator.go @@ -1,6 +1,7 @@ package operator import ( + compkubernetes "github.com/DataDog/test-infra-definitions/components/kubernetes" "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" @@ -10,17 +11,19 @@ import ( ) // OperatorOutput is used to import the Operator component -type Output struct { +type OperatorOutput struct { components.JSONImporter + Operator compkubernetes.KubernetesObjectRef `json:"operator"` } // Operator represents an Operator installation type Operator struct { pulumi.ResourceState components.Component + Operator *compkubernetes.KubernetesObjectRef `json:"operator"` } -func (h *Operator) Export(ctx *pulumi.Context, out *Output) error { +func (h *Operator) Export(ctx *pulumi.Context, out *OperatorOutput) error { return components.Export(ctx, h, out) } @@ -32,7 +35,7 @@ func NewOperator(e config.Env, resourceName string, kubeProvider *kubernetes.Pro } pulumiResourceOptions := append(params.PulumiResourceOptions, pulumi.Parent(comp)) - _, err = NewHelmInstallation(e, HelmInstallationArgs{ + release, err := NewHelmInstallation(e, HelmInstallationArgs{ KubeProvider: kubeProvider, Namespace: params.Namespace, ValuesYAML: params.HelmValues, @@ -42,6 +45,12 @@ func NewOperator(e config.Env, resourceName string, kubeProvider *kubernetes.Pro return err } + comp.Operator, err = compkubernetes.NewKubernetesObjRef(e, "datadog-operator", params.Namespace, "Pod", release.LinuxHelmReleaseStatus.AppVersion().Elem(), release.LinuxHelmReleaseStatus.Version().Elem(), map[string]string{"app": "datadog-operator"}) + + if err != nil { + return err + } + return nil }) } diff --git a/components/datadog/agent/kubernetes_object_ref.go b/components/kubernetes/kubernetes_object_ref.go similarity index 98% rename from components/datadog/agent/kubernetes_object_ref.go rename to components/kubernetes/kubernetes_object_ref.go index 7bdcf8b2e..184ce25c9 100644 --- a/components/datadog/agent/kubernetes_object_ref.go +++ b/components/kubernetes/kubernetes_object_ref.go @@ -1,4 +1,4 @@ -package agent +package kubernetes import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" From 8355c2d964502974f8334ddf8a13e36226697abc Mon Sep 17 00:00:00 2001 From: Fanny Jiang Date: Thu, 21 Nov 2024 20:15:51 -0500 Subject: [PATCH 3/3] nolint --- components/datadog/apps/dda/datadogagent.go | 3 +++ components/datadog/operator/operator.go | 2 +- components/kubernetes/kubernetes_object_ref.go | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/datadog/apps/dda/datadogagent.go b/components/datadog/apps/dda/datadogagent.go index 6048fc4b9..f0a2b4581 100644 --- a/components/datadog/apps/dda/datadogagent.go +++ b/components/datadog/apps/dda/datadogagent.go @@ -104,6 +104,9 @@ func K8sAppDefinition(e config.Env, kubeProvider *kubernetes.Provider, namespace } ddaRef, err := componentskube.NewKubernetesObjRef(e, baseName, namespace, "DatadogAgent", pulumi.String("").ToStringOutput(), pulumi.String("datadoghq.com/v2alpha1").ToStringOutput(), map[string]string{"app": baseName}) + if err != nil { + return nil, nil, err + } return k8sComponent, ddaRef, nil } diff --git a/components/datadog/operator/operator.go b/components/datadog/operator/operator.go index 76a309ff7..f08bdf195 100644 --- a/components/datadog/operator/operator.go +++ b/components/datadog/operator/operator.go @@ -11,7 +11,7 @@ import ( ) // OperatorOutput is used to import the Operator component -type OperatorOutput struct { +type OperatorOutput struct { // nolint:revive, We want to keep the name as Output components.JSONImporter Operator compkubernetes.KubernetesObjectRef `json:"operator"` } diff --git a/components/kubernetes/kubernetes_object_ref.go b/components/kubernetes/kubernetes_object_ref.go index 184ce25c9..29d79a1e5 100644 --- a/components/kubernetes/kubernetes_object_ref.go +++ b/components/kubernetes/kubernetes_object_ref.go @@ -7,7 +7,7 @@ import ( "github.com/DataDog/test-infra-definitions/components" ) -type KubernetesObjRefOutput struct { +type KubernetesObjRefOutput struct { // nolint:revive, We want to keep the name as Output components.JSONImporter Namespace string `json:"namespace"` @@ -18,7 +18,7 @@ type KubernetesObjRefOutput struct { LabelSelectors map[string]string `json:"labelSelectors"` } -type KubernetesObjectRef struct { +type KubernetesObjectRef struct { // nolint:revive, We want to keep the name as Output pulumi.ResourceState components.Component