@@ -12,6 +12,7 @@ import (
1212 "errors"
1313 "fmt"
1414 "net/http"
15+ "runtime"
1516 "sync"
1617 "time"
1718
@@ -20,7 +21,7 @@ import (
2021
2122 "github.com/DataDog/datadog-agent/comp/core/config"
2223 "github.com/DataDog/datadog-agent/comp/core/hostname"
23- "github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface/def"
24+ hostnameinterface "github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface/def"
2425 ipc "github.com/DataDog/datadog-agent/comp/core/ipc/def"
2526 log "github.com/DataDog/datadog-agent/comp/core/log/def"
2627 tagger "github.com/DataDog/datadog-agent/comp/core/tagger/def"
@@ -32,6 +33,7 @@ import (
3233 traceroute "github.com/DataDog/datadog-agent/comp/networkpath/traceroute/def"
3334 privateactionrunner "github.com/DataDog/datadog-agent/comp/privateactionrunner/def"
3435 rcclient "github.com/DataDog/datadog-agent/comp/remote-config/rcclient/def"
36+ configenv "github.com/DataDog/datadog-agent/pkg/config/env"
3537 "github.com/DataDog/datadog-agent/pkg/config/model"
3638 configutils "github.com/DataDog/datadog-agent/pkg/config/utils"
3739 "github.com/DataDog/datadog-agent/pkg/fleet/installer/telemetry"
@@ -60,6 +62,19 @@ func isEnabled(cfg config.Component) bool {
6062 return cfg .GetBool (privateactionrunner .PAREnabled )
6163}
6264
65+ func splitDeploymentSupported (goos string , containerized bool ) bool {
66+ if containerized {
67+ return false
68+ }
69+
70+ switch goos {
71+ case "linux" , "windows" :
72+ return true
73+ default :
74+ return false
75+ }
76+ }
77+
6378// Requires defines the dependencies for the privateactionrunner component
6479type Requires struct {
6580 Config config.Component
@@ -121,6 +136,14 @@ func NewComponent(reqs Requires) (Provides, error) {
121136 reqs .Log .Flush ()
122137 return Provides {}, privateactionrunner .ErrNotEnabled
123138 }
139+ if reqs .Config .GetBool (privateactionrunner .PARSplitEnabled ) {
140+ if splitDeploymentSupported (runtime .GOOS , configenv .IsContainerized ()) {
141+ reqs .Log .Info ("Split deployment is enabled; the monolithic PAR is standing down" )
142+ reqs .Log .Flush ()
143+ return Provides {}, privateactionrunner .ErrSplitDeployment
144+ }
145+ reqs .Log .Warn ("Split deployment is not supported in this environment; continuing with the monolithic PAR" )
146+ }
124147
125148 // The standalone runner sends metrics over a DogStatsD socket/UDP, built from
126149 // the Agent's configured endpoint (it runs alongside a node Agent listener).
0 commit comments