Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into yuri_USMON-1124_ebpf_…
Browse files Browse the repository at this point in the history
…postgres_msg_counts
  • Loading branch information
yuri-lipnesh committed Dec 9, 2024
2 parents 1366e89 + c5069b5 commit 3e8d162
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ func (w *Webhook) inject(pod *corev1.Pod, ns string, _ dynamic.Interface) (bool,
if pod.Namespace == "" {
pod.Namespace = ns
}
injectApmTelemetryConfig(pod)

if !w.isPodEligible(pod) {
return false, nil
Expand Down Expand Up @@ -371,6 +370,9 @@ func (s libInfoSource) mutatePod(pod *corev1.Pod) error {
Name: instrumentationInstallTypeEnvVarName,
Value: s.injectionType(),
})

injectApmTelemetryConfig(pod)

return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2307,16 +2307,7 @@ func TestInjectAutoInstrumentation(t *testing.T) {
"admission.datadoghq.com/enabled": "false",
},
}.Create(),
expectedEnvs: []corev1.EnvVar{
{
Name: "DD_INSTRUMENTATION_INSTALL_TIME",
Value: installTime,
},
{
Name: "DD_INSTRUMENTATION_INSTALL_ID",
Value: uuid,
},
},
expectedEnvs: nil,
expectedInjectedLibraries: map[string]string{},
expectedSecurityContext: &corev1.SecurityContext{},
wantErr: false,
Expand Down Expand Up @@ -2415,16 +2406,7 @@ func TestInjectAutoInstrumentation(t *testing.T) {
ParentKind: "replicaset",
ParentName: "test-deployment-123",
}.Create(),
expectedEnvs: []corev1.EnvVar{
{
Name: "DD_INSTRUMENTATION_INSTALL_TIME",
Value: installTime,
},
{
Name: "DD_INSTRUMENTATION_INSTALL_ID",
Value: uuid,
},
},
expectedEnvs: nil,
expectedInjectedLibraries: map[string]string{},
expectedSecurityContext: &corev1.SecurityContext{},
wantErr: false,
Expand Down Expand Up @@ -2495,16 +2477,7 @@ func TestInjectAutoInstrumentation(t *testing.T) {
ParentKind: "replicaset",
ParentName: "test-deployment-123",
}.Create(),
expectedEnvs: []corev1.EnvVar{
{
Name: "DD_INSTRUMENTATION_INSTALL_TIME",
Value: installTime,
},
{
Name: "DD_INSTRUMENTATION_INSTALL_ID",
Value: uuid,
},
},
expectedEnvs: nil,
expectedInjectedLibraries: map[string]string{},
expectedSecurityContext: &corev1.SecurityContext{},
wantErr: false,
Expand All @@ -2517,16 +2490,7 @@ func TestInjectAutoInstrumentation(t *testing.T) {
ParentKind: "replicaset",
ParentName: "test-deployment-123",
}.Create(),
expectedEnvs: []corev1.EnvVar{
{
Name: "DD_INSTRUMENTATION_INSTALL_TIME",
Value: installTime,
},
{
Name: "DD_INSTRUMENTATION_INSTALL_ID",
Value: uuid,
},
},
expectedEnvs: nil,
expectedInjectedLibraries: map[string]string{},
expectedSecurityContext: &corev1.SecurityContext{},
wantErr: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
The auto-instrumentation webhook no longer injects the default environment
variables when disabled.

0 comments on commit 3e8d162

Please sign in to comment.