@@ -17,6 +17,7 @@ import (
1717 "github.com/DataDog/datadog-operator/internal/controller/datadogagent/component/agent"
1818 "github.com/DataDog/datadog-operator/internal/controller/datadogagent/feature"
1919 "github.com/DataDog/datadog-operator/internal/controller/datadogagent/object/volume"
20+ "github.com/DataDog/datadog-operator/pkg/utils"
2021)
2122
2223func init () {
@@ -44,7 +45,7 @@ func (f *npmFeature) ID() feature.IDType {
4445}
4546
4647// Configure is used to configure the feature from a v2alpha1.DatadogAgent instance.
47- func (f * npmFeature ) Configure (_ metav1.Object , ddaSpec * v2alpha1.DatadogAgentSpec , _ * v2alpha1.RemoteConfigConfiguration ) (reqComp feature.RequiredComponents ) {
48+ func (f * npmFeature ) Configure (dda metav1.Object , ddaSpec * v2alpha1.DatadogAgentSpec , _ * v2alpha1.RemoteConfigConfiguration ) (reqComp feature.RequiredComponents ) {
4849 if ddaSpec .Features == nil {
4950 return
5051 }
@@ -54,9 +55,17 @@ func (f *npmFeature) Configure(_ metav1.Object, ddaSpec *v2alpha1.DatadogAgentSp
5455 apicommon .CoreAgentContainerName ,
5556 apicommon .SystemProbeContainerName ,
5657 }
57- if ! apiutils .BoolValue (ddaSpec .Features .NPM .DirectSend ) {
58+
59+ directSendEnabled := apiutils .BoolValue (ddaSpec .Features .NPM .DirectSend )
60+ const directSendMinVersion = "7.77.0-0"
61+ defaultIfVersionUnknown := false
62+ if ! utils .IsAboveMinVersion (common .GetComponentVersion (dda , v2alpha1 .NodeAgentComponentName ), directSendMinVersion , & defaultIfVersionUnknown ) {
63+ directSendEnabled = false
64+ }
65+ if ! directSendEnabled {
5866 containers = append (containers , apicommon .ProcessAgentContainerName )
5967 }
68+ f .directSend = directSendEnabled
6069
6170 reqComp = feature.RequiredComponents {
6271 Agent : feature.RequiredComponent {
@@ -67,7 +76,6 @@ func (f *npmFeature) Configure(_ metav1.Object, ddaSpec *v2alpha1.DatadogAgentSp
6776 npm := ddaSpec .Features .NPM
6877 f .collectDNSStats = apiutils .BoolValue (npm .CollectDNSStats )
6978 f .enableConntrack = apiutils .BoolValue (npm .EnableConntrack )
70- f .directSend = apiutils .BoolValue (npm .DirectSend )
7179 }
7280
7381 return reqComp
0 commit comments