Skip to content

Commit

Permalink
Merge branch 'main' into fanny/operator-namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
fanny-jiang authored Dec 11, 2024
2 parents 156e590 + 3d83b7e commit 0c80207
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ RUN pip3 install -r https://raw.githubusercontent.com/DataDog/datadog-agent-buil
pip3 install -r /tmp/test-infra/requirements.txt & \
go install gotest.tools/gotestsum@latest

# Install Orchestrion for native Go Test Visibility support
RUN go install github.com/DataDog/[email protected]

RUN rm -rf /tmp/test-infra

# Configure aws retries
Expand Down
5 changes: 5 additions & 0 deletions common/config/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const (
DDAgentAPIKeyParamName = "apiKey"
DDAgentAPPKeyParamName = "appKey"
DDAgentFakeintake = "fakeintake"
DDAgentDualShipping = "dualshipping"
DDAgentSite = "site"
DDAgentMajorVersion = "majorVersion"
DDAgentExtraEnvVars = "extraEnvVars" // extraEnvVars is expected in the format: <key1>=<value1>,<key2>=<value2>,...
Expand Down Expand Up @@ -311,6 +312,10 @@ func (e *CommonEnvironment) AgentUseFakeintake() bool {
return e.GetBoolWithDefault(e.AgentConfig, DDAgentFakeintake, true)
}

func (e *CommonEnvironment) AgentUseDualShipping() bool {
return e.GetBoolWithDefault(e.AgentConfig, DDAgentDualShipping, false)
}

func (e *CommonEnvironment) Site() string {
return e.AgentConfig.Get(DDAgentSite)
}
Expand Down
2 changes: 1 addition & 1 deletion components/datadog/agent/helm/kubernetes_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewKubernetesAgent(e config.Env, resourceName string, kubeProvider *kuberne
Fakeintake: params.FakeIntake,
AgentFullImagePath: params.AgentFullImagePath,
ClusterAgentFullImagePath: params.ClusterAgentFullImagePath,
DisableDualShipping: params.DisableDualShipping,
DualShipping: params.DualShipping,
DisableLogsContainerCollectAll: params.DisableLogsContainerCollectAll,
OTelAgent: params.OTelAgent,
OTelConfig: params.OTelConfig,
Expand Down
8 changes: 4 additions & 4 deletions components/datadog/agent/kubernetes_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ type HelmInstallationArgs struct {
ClusterAgentFullImagePath string
// DisableLogsContainerCollectAll is used to disable the collection of logs from all containers by default
DisableLogsContainerCollectAll bool
// DisableDualShipping is used to disable dual-shipping
DisableDualShipping bool
// DualShipping is used to disable dual-shipping
DualShipping bool
// OTelAgent is used to deploy the OTel agent instead of the classic agent
OTelAgent bool
// OTelConfig is used to provide a custom OTel configuration
Expand Down Expand Up @@ -144,7 +144,7 @@ func NewHelmInstallation(e config.Env, args HelmInstallationArgs, opts ...pulumi
values = buildLinuxHelmValues(baseName, agentImagePath, agentImageTag, clusterAgentImagePath, clusterAgentImageTag, randomClusterAgentToken.Result, !args.DisableLogsContainerCollectAll)
}
values.configureImagePullSecret(imgPullSecret)
values.configureFakeintake(e, args.Fakeintake, !args.DisableDualShipping)
values.configureFakeintake(e, args.Fakeintake, args.DualShipping)

defaultYAMLValues := values.toYAMLPulumiAssetOutput()

Expand Down Expand Up @@ -177,7 +177,7 @@ func NewHelmInstallation(e config.Env, args HelmInstallationArgs, opts ...pulumi
if args.DeployWindows {
values := buildWindowsHelmValues(baseName, agentImagePath, agentImageTag, clusterAgentImagePath, clusterAgentImageTag)
values.configureImagePullSecret(imgPullSecret)
values.configureFakeintake(e, args.Fakeintake, !args.DisableDualShipping)
values.configureFakeintake(e, args.Fakeintake, args.DualShipping)
defaultYAMLValues := values.toYAMLPulumiAssetOutput()

var windowsValuesYAML pulumi.AssetOrArchiveArray
Expand Down
10 changes: 5 additions & 5 deletions components/datadog/kubernetesagentparams/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Params struct {
// DisableLogsContainerCollectAll is a flag to disable collection of logs from all containers by default.
DisableLogsContainerCollectAll bool
// DualShipping is a flag to enable dual shipping.
DisableDualShipping bool
DualShipping bool
// OTelAgent is a flag to deploy the OTel agent.
OTelAgent bool
// OTelConfig is the OTel configuration to use for the agent installation.
Expand Down Expand Up @@ -150,11 +150,11 @@ func WithoutLogsContainerCollectAll() func(*Params) error {
}
}

// WithoutDualShipping disables dual shipping. By default the agent is configured to send data to ddev and to the fakeintake.
// With that flag data will be sent only to the fakeintake.
func WithoutDualShipping() func(*Params) error {
// DualShipping enables dual shipping. By default the agent is configured to send data only to the fakeintake and not dddev (the fakeintake will forward payloads to dddev).
// With that flag data will be sent to the fakeintake and also to dddev.
func WithDualShipping() func(*Params) error {
return func(p *Params) error {
p.DisableDualShipping = true
p.DualShipping = true
return nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ invoke==2.2.0
termcolor==2.5.0
pyyaml==6.0.2
pyperclip==1.9.0
pydantic==2.10.2
pydantic==2.10.3
colorama>=0.4.6
lxml==5.3.0
python-gitlab==5.1.0
Expand Down
8 changes: 8 additions & 0 deletions scenarios/aws/eks/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func Run(ctx *pulumi.Context) error {
fakeIntakeOptions = append(fakeIntakeOptions, fakeintake.WithLoadBalancer())
}

if awsEnv.AgentUseDualShipping() {
fakeIntakeOptions = append(fakeIntakeOptions, fakeintake.WithoutDDDevForwarding())
}

if fakeIntake, err = fakeintake.NewECSFargateInstance(awsEnv, "ecs", fakeIntakeOptions...); err != nil {
return err
}
Expand All @@ -71,6 +75,10 @@ func Run(ctx *pulumi.Context) error {
k8sAgentOptions = append(k8sAgentOptions, kubernetesagentparams.WithFakeintake(fakeIntake))
}

if awsEnv.AgentUseDualShipping() {
k8sAgentOptions = append(k8sAgentOptions, kubernetesagentparams.WithDualShipping())
}

if awsEnv.EKSWindowsNodeGroup() {
k8sAgentOptions = append(k8sAgentOptions, kubernetesagentparams.WithDeployWindows())
}
Expand Down
8 changes: 8 additions & 0 deletions scenarios/aws/kindvm/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func Run(ctx *pulumi.Context) error {
fakeIntakeOptions = append(fakeIntakeOptions, fakeintake.WithLoadBalancer())
}

if awsEnv.AgentUseDualShipping() {
fakeIntakeOptions = append(fakeIntakeOptions, fakeintake.WithoutDDDevForwarding())
}

if fakeIntake, err = fakeintake.NewECSFargateInstance(awsEnv, kindCluster.Name(), fakeIntakeOptions...); err != nil {
return err
}
Expand Down Expand Up @@ -112,6 +116,10 @@ agents:
)
}

if awsEnv.AgentUseDualShipping() {
k8sAgentOptions = append(k8sAgentOptions, kubernetesagentparams.WithDualShipping())
}

k8sAgentComponent, err := helm.NewKubernetesAgent(&awsEnv, awsEnv.Namer.ResourceName("datadog-agent"), kindKubeProvider, k8sAgentOptions...)

if err != nil {
Expand Down
12 changes: 11 additions & 1 deletion scenarios/azure/aks/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,26 @@ providers:
)

if env.AgentUseFakeintake() {
fakeintake, err := fakeintake.NewVMInstance(env)
fakeIntakeOptions := []fakeintake.Option{}
if env.AgentUseDualShipping() {
fakeIntakeOptions = append(fakeIntakeOptions, fakeintake.WithoutDDDevForwarding())
}

fakeintake, err := fakeintake.NewVMInstance(env, fakeIntakeOptions...)
if err != nil {
return err
}
if err := fakeintake.Export(env.Ctx(), nil); err != nil {
return err
}

k8sAgentOptions = append(k8sAgentOptions, kubernetesagentparams.WithFakeintake(fakeintake))
}

if env.AgentUseDualShipping() {
k8sAgentOptions = append(k8sAgentOptions, kubernetesagentparams.WithDualShipping())
}

k8sAgentComponent, err := helm.NewKubernetesAgent(&env, env.Namer.ResourceName("datadog-agent"), aksCluster.KubeProvider, k8sAgentOptions...)

if err != nil {
Expand Down
11 changes: 10 additions & 1 deletion scenarios/gcp/gke/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,17 @@ func Run(ctx *pulumi.Context) error {
)
}

if env.AgentUseDualShipping() {
k8sAgentOptions = append(k8sAgentOptions, kubernetesagentparams.WithDualShipping())
}

if env.AgentUseFakeintake() {
fakeintake, err := fakeintake.NewVMInstance(env)
fakeIntakeOptions := []fakeintake.Option{}
if env.AgentUseDualShipping() {
fakeIntakeOptions = append(fakeIntakeOptions, fakeintake.WithoutDDDevForwarding())
}

fakeintake, err := fakeintake.NewVMInstance(env, fakeIntakeOptions...)
if err != nil {
return err
}
Expand Down

0 comments on commit 0c80207

Please sign in to comment.