diff --git a/pkg/constants/env.go b/pkg/constants/env.go index bbd67ef..d2d9b0e 100644 --- a/pkg/constants/env.go +++ b/pkg/constants/env.go @@ -30,4 +30,5 @@ const ( EnvNewRelicAppName = "NEW_RELIC_APP_NAME" EnvNewRelicLicenseKey = "NEW_RELIC_LICENSE_KEY" + EnvNewRelicLabels = "NEW_RELIC_LABELS" ) diff --git a/pkg/instrumentation/sdk.go b/pkg/instrumentation/sdk.go index fa82af7..6f14032 100644 --- a/pkg/instrumentation/sdk.go +++ b/pkg/instrumentation/sdk.go @@ -323,6 +323,13 @@ func (i *sdkInjector) injectNewrelicConfig(ctx context.Context, newrelic v1alpha }, }) } + idx = getIndexOfEnv(container.Env, constants.EnvNewRelicLabels) + if idx == -1 { + container.Env = append(container.Env, corev1.EnvVar{ + Name: "NEW_RELIC_LABELS", + Value: "operator:auto-injection", + }) + } return pod }