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

Remove support for otel annotation #1624

Merged
merged 1 commit into from
Jan 14, 2025
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,6 @@ func (f *defaultFeature) Configure(dda *v2alpha1.DatadogAgent) feature.RequiredC

agentContainers := make([]apicommon.AgentContainerName, 0)

// If the OpenTelemetry Agent is enabled, add the OTel Agent to the list of required containers for the Agent
// feature.
//
// NOTE: This is a temporary solution until the OTel Agent is fully integrated into the Operator via a dedicated feature.
if dda.ObjectMeta.Annotations != nil && featureutils.HasOtelAgentAnnotation(dda) {
agentContainers = append(agentContainers, apicommon.OtelAgent)
}

// If Agent Data Plane is enabled, add the ADP container to the list of required containers for the Agent feature.
if f.adpEnabled {
agentContainers = append(agentContainers, apicommon.AgentDataPlaneContainerName)
Expand Down
73 changes: 3 additions & 70 deletions internal/controller/datadogagent/feature/test/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,57 +165,8 @@ func TestBuilder(t *testing.T) {
},
},
{
name: "Default DDA, default feature Option, otel-agent-enabled annotation true",
name: "Default DDA, otel collector feature enabled",
dda: testutils.NewDatadogAgentBuilder().
WithAnnotations(map[string]string{"agent.datadoghq.com/otel-agent-enabled": "true"}).
BuildWithDefaults(),
wantAgentContainer: map[common.AgentContainerName]bool{
common.UnprivilegedSingleAgentContainerName: false,
common.CoreAgentContainerName: true,
common.ProcessAgentContainerName: true,
common.TraceAgentContainerName: true,
common.SystemProbeContainerName: false,
common.SecurityAgentContainerName: false,
common.OtelAgent: true,
common.AgentDataPlaneContainerName: false,
},
},
{
name: "Default DDA, default feature Option, otel-agent-enabled annotation false",
dda: testutils.NewDatadogAgentBuilder().
WithAnnotations(map[string]string{"agent.datadoghq.com/otel-agent-enabled": "false"}).
BuildWithDefaults(),
wantAgentContainer: map[common.AgentContainerName]bool{
common.UnprivilegedSingleAgentContainerName: false,
common.CoreAgentContainerName: true,
common.ProcessAgentContainerName: true,
common.TraceAgentContainerName: true,
common.SystemProbeContainerName: false,
common.SecurityAgentContainerName: false,
common.OtelAgent: false,
common.AgentDataPlaneContainerName: false,
},
},
{
name: "Default DDA, no otel annotation, Operator option enabled",
dda: testutils.NewDatadogAgentBuilder().
WithAnnotations(map[string]string{"agent.datadoghq.com/otel-agent-enabled": "false"}).
BuildWithDefaults(),
wantAgentContainer: map[common.AgentContainerName]bool{
common.UnprivilegedSingleAgentContainerName: false,
common.CoreAgentContainerName: true,
common.ProcessAgentContainerName: true,
common.TraceAgentContainerName: true,
common.SystemProbeContainerName: false,
common.SecurityAgentContainerName: false,
common.OtelAgent: false,
common.AgentDataPlaneContainerName: false,
},
},
{
name: "Default DDA, otel annotation false, otel collector feature enabled",
dda: testutils.NewDatadogAgentBuilder().
WithAnnotations(map[string]string{"agent.datadoghq.com/otel-agent-enabled": "false"}).
WithOTelCollectorEnabled(true).
BuildWithDefaults(),
wantAgentContainer: map[common.AgentContainerName]bool{
Expand All @@ -230,9 +181,8 @@ func TestBuilder(t *testing.T) {
},
},
{
name: "Default DDA, otel annotation true, otel collector feature disabled",
name: "Default DDA, otel collector feature disabled",
dda: testutils.NewDatadogAgentBuilder().
WithAnnotations(map[string]string{"agent.datadoghq.com/otel-agent-enabled": "true"}).
WithOTelCollectorEnabled(false).
BuildWithDefaults(),
wantAgentContainer: map[common.AgentContainerName]bool{
Expand All @@ -242,24 +192,7 @@ func TestBuilder(t *testing.T) {
common.TraceAgentContainerName: true,
common.SystemProbeContainerName: false,
common.SecurityAgentContainerName: false,
common.OtelAgent: true,
common.AgentDataPlaneContainerName: false,
},
},
{
name: "Default DDA, otel annotation true, otel collector feature enabled",
dda: testutils.NewDatadogAgentBuilder().
WithAnnotations(map[string]string{"agent.datadoghq.com/otel-agent-enabled": "true"}).
WithOTelCollectorEnabled(true).
BuildWithDefaults(),
wantAgentContainer: map[common.AgentContainerName]bool{
common.UnprivilegedSingleAgentContainerName: false,
common.CoreAgentContainerName: true,
common.ProcessAgentContainerName: true,
common.TraceAgentContainerName: true,
common.SystemProbeContainerName: false,
common.SecurityAgentContainerName: false,
common.OtelAgent: true,
common.OtelAgent: false,
common.AgentDataPlaneContainerName: false,
},
},
Expand Down
7 changes: 0 additions & 7 deletions internal/controller/datadogagent/feature/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
)

const RunInCoreAgentMinVersion = "7.57.0-0"
const enableOtelAnnotation = "agent.datadoghq.com/otel-agent-enabled"
const enableAdpAnnotation = "agent.datadoghq.com/adp-enabled"

func agentSupportsRunInCoreAgent(dda *v2alpha1.DatadogAgent) bool {
Expand Down Expand Up @@ -57,12 +56,6 @@ func hasFeatureEnableAnnotation(dda *v2alpha1.DatadogAgent, annotation string) b
return false
}

// HasOtelAgentAnnotation returns true if the OpenTelemetry Agent is enabled via the dedicated
// `agent.datadoghq.com/otel-agent-enabled` annotation
func HasOtelAgentAnnotation(dda *v2alpha1.DatadogAgent) bool {
return hasFeatureEnableAnnotation(dda, enableOtelAnnotation)
}

// HasAgentDataPlaneAnnotation returns true if the Agent Data Plane is enabled via the dedicated `agent.datadoghq.com/adp-enabled` annotation
func HasAgentDataPlaneAnnotation(dda *v2alpha1.DatadogAgent) bool {
return hasFeatureEnableAnnotation(dda, enableAdpAnnotation)
Expand Down
Loading