Skip to content

Commit de626e0

Browse files
authored
Helm rollback action (#51415)
### What does this PR do? Adds initial Helm release rollback action using PAR as described in https://docs.google.com/document/d/1pS9xKu9onkIYaEyzFslJML7nGWLrDsYJjnp5IpnPwCg/edit?pli=1&tab=t.0#heading=h.ch36v99zz3g1 and https://datadoghq.atlassian.net/browse/CONTINT-5361 ### Motivation Give customers ability to use action tray to trigger helm rollback actions ### Describe how you validated your changes ### Additional Notes Co-authored-by: dmitry.ponomarev <dmitry.ponomarev@datadoghq.com>
1 parent 8657403 commit de626e0

36 files changed

Lines changed: 1675 additions & 48 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@
384384
/comp/forwarder @DataDog/agent-metric-pipelines
385385
/comp/healthplatform @DataDog/fleet-remediation
386386
/comp/host-profiler @DataDog/opentelemetry-agent @DataDog/profiling-full-host
387+
/comp/kubeactions @DataDog/container-integrations
387388
/comp/logs @DataDog/agent-log-pipelines
388389
/comp/logs-library @DataDog/agent-log-pipelines
389390
/comp/metadata @DataDog/fleet-automation

cmd/cluster-agent/subcommands/start/BUILD.bazel

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ go_library(
6767
"//comp/haagent/fx",
6868
"//comp/healthplatform",
6969
"//comp/healthplatform/store/def",
70+
"//comp/kubeactions",
71+
"//comp/kubeactions/helmactions/def",
7072
"//comp/logs/integrations/def",
7173
"//comp/metadata/clusteragent/def",
7274
"//comp/metadata/clusteragent/fx",
@@ -206,6 +208,8 @@ go_library(
206208
"//comp/haagent/fx",
207209
"//comp/healthplatform",
208210
"//comp/healthplatform/store/def",
211+
"//comp/kubeactions",
212+
"//comp/kubeactions/helmactions/def",
209213
"//comp/logs/integrations/def",
210214
"//comp/metadata/clusteragent/def",
211215
"//comp/metadata/clusteragent/fx",
@@ -345,6 +349,8 @@ go_library(
345349
"//comp/haagent/fx",
346350
"//comp/healthplatform",
347351
"//comp/healthplatform/store/def",
352+
"//comp/kubeactions",
353+
"//comp/kubeactions/helmactions/def",
348354
"//comp/logs/integrations/def",
349355
"//comp/metadata/clusteragent/def",
350356
"//comp/metadata/clusteragent/fx",
@@ -484,6 +490,8 @@ go_library(
484490
"//comp/haagent/fx",
485491
"//comp/healthplatform",
486492
"//comp/healthplatform/store/def",
493+
"//comp/kubeactions",
494+
"//comp/kubeactions/helmactions/def",
487495
"//comp/logs/integrations/def",
488496
"//comp/metadata/clusteragent/def",
489497
"//comp/metadata/clusteragent/fx",
@@ -623,6 +631,8 @@ go_library(
623631
"//comp/haagent/fx",
624632
"//comp/healthplatform",
625633
"//comp/healthplatform/store/def",
634+
"//comp/kubeactions",
635+
"//comp/kubeactions/helmactions/def",
626636
"//comp/logs/integrations/def",
627637
"//comp/metadata/clusteragent/def",
628638
"//comp/metadata/clusteragent/fx",
@@ -762,6 +772,8 @@ go_library(
762772
"//comp/haagent/fx",
763773
"//comp/healthplatform",
764774
"//comp/healthplatform/store/def",
775+
"//comp/kubeactions",
776+
"//comp/kubeactions/helmactions/def",
765777
"//comp/logs/integrations/def",
766778
"//comp/metadata/clusteragent/def",
767779
"//comp/metadata/clusteragent/fx",
@@ -901,6 +913,8 @@ go_library(
901913
"//comp/haagent/fx",
902914
"//comp/healthplatform",
903915
"//comp/healthplatform/store/def",
916+
"//comp/kubeactions",
917+
"//comp/kubeactions/helmactions/def",
904918
"//comp/logs/integrations/def",
905919
"//comp/metadata/clusteragent/def",
906920
"//comp/metadata/clusteragent/fx",
@@ -1040,6 +1054,8 @@ go_library(
10401054
"//comp/haagent/fx",
10411055
"//comp/healthplatform",
10421056
"//comp/healthplatform/store/def",
1057+
"//comp/kubeactions",
1058+
"//comp/kubeactions/helmactions/def",
10431059
"//comp/logs/integrations/def",
10441060
"//comp/metadata/clusteragent/def",
10451061
"//comp/metadata/clusteragent/fx",
@@ -1179,6 +1195,8 @@ go_library(
11791195
"//comp/haagent/fx",
11801196
"//comp/healthplatform",
11811197
"//comp/healthplatform/store/def",
1198+
"//comp/kubeactions",
1199+
"//comp/kubeactions/helmactions/def",
11821200
"//comp/logs/integrations/def",
11831201
"//comp/metadata/clusteragent/def",
11841202
"//comp/metadata/clusteragent/fx",
@@ -1318,6 +1336,8 @@ go_library(
13181336
"//comp/haagent/fx",
13191337
"//comp/healthplatform",
13201338
"//comp/healthplatform/store/def",
1339+
"//comp/kubeactions",
1340+
"//comp/kubeactions/helmactions/def",
13211341
"//comp/logs/integrations/def",
13221342
"//comp/metadata/clusteragent/def",
13231343
"//comp/metadata/clusteragent/fx",
@@ -1457,6 +1477,8 @@ go_library(
14571477
"//comp/haagent/fx",
14581478
"//comp/healthplatform",
14591479
"//comp/healthplatform/store/def",
1480+
"//comp/kubeactions",
1481+
"//comp/kubeactions/helmactions/def",
14601482
"//comp/logs/integrations/def",
14611483
"//comp/metadata/clusteragent/def",
14621484
"//comp/metadata/clusteragent/fx",
@@ -1596,6 +1618,8 @@ go_library(
15961618
"//comp/haagent/fx",
15971619
"//comp/healthplatform",
15981620
"//comp/healthplatform/store/def",
1621+
"//comp/kubeactions",
1622+
"//comp/kubeactions/helmactions/def",
15991623
"//comp/logs/integrations/def",
16001624
"//comp/metadata/clusteragent/def",
16011625
"//comp/metadata/clusteragent/fx",
@@ -1735,6 +1759,8 @@ go_library(
17351759
"//comp/haagent/fx",
17361760
"//comp/healthplatform",
17371761
"//comp/healthplatform/store/def",
1762+
"//comp/kubeactions",
1763+
"//comp/kubeactions/helmactions/def",
17381764
"//comp/logs/integrations/def",
17391765
"//comp/metadata/clusteragent/def",
17401766
"//comp/metadata/clusteragent/fx",
@@ -1874,6 +1900,8 @@ go_library(
18741900
"//comp/haagent/fx",
18751901
"//comp/healthplatform",
18761902
"//comp/healthplatform/store/def",
1903+
"//comp/kubeactions",
1904+
"//comp/kubeactions/helmactions/def",
18771905
"//comp/logs/integrations/def",
18781906
"//comp/metadata/clusteragent/def",
18791907
"//comp/metadata/clusteragent/fx",
@@ -2013,6 +2041,8 @@ go_library(
20132041
"//comp/haagent/fx",
20142042
"//comp/healthplatform",
20152043
"//comp/healthplatform/store/def",
2044+
"//comp/kubeactions",
2045+
"//comp/kubeactions/helmactions/def",
20162046
"//comp/logs/integrations/def",
20172047
"//comp/metadata/clusteragent/def",
20182048
"//comp/metadata/clusteragent/fx",

cmd/cluster-agent/subcommands/start/command.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ import (
7171
haagentfx "github.com/DataDog/datadog-agent/comp/haagent/fx"
7272
healthplatform "github.com/DataDog/datadog-agent/comp/healthplatform"
7373
healthplatformdef "github.com/DataDog/datadog-agent/comp/healthplatform/store/def"
74+
kubeactionsbundle "github.com/DataDog/datadog-agent/comp/kubeactions"
75+
helmactions "github.com/DataDog/datadog-agent/comp/kubeactions/helmactions/def"
7476
traceroute "github.com/DataDog/datadog-agent/comp/networkpath/traceroute/def"
7577
remotetraceroutefx "github.com/DataDog/datadog-agent/comp/networkpath/traceroute/fx-remote"
7678
"github.com/DataDog/datadog-agent/pkg/clusteragent/appsec"
@@ -264,6 +266,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
264266
clusterchecksmetadatafx.Module(),
265267
ipcfx.ModuleReadWrite(),
266268
remotetraceroutefx.Module(),
269+
kubeactionsbundle.Bundle(),
267270
)
268271
},
269272
}
@@ -294,7 +297,6 @@ func start(log log.Component,
294297
diagnoseComp diagnose.Component,
295298
dcametadataComp dcametadata.Component,
296299
hostnameGetter hostnameinterface.Component,
297-
298300
clusterChecksMetadataComp clusterchecksmetadata.Component,
299301
_ metadatarunner.Component,
300302
tracerouteComp traceroute.Component,
@@ -303,6 +305,7 @@ func start(log log.Component,
303305
autoscalingGate *autoscalinggate.Gate,
304306
serviceTemplateStore *instrumentationhandlers.ServiceCheckTemplateStore,
305307
refreshTaggerGlobalTags option.Option[func(context.Context)],
308+
helmactions helmactions.Component,
306309
) error {
307310
stopCh := make(chan struct{})
308311
validatingStopCh := make(chan struct{})
@@ -644,7 +647,7 @@ func start(log log.Component,
644647
}
645648

646649
if config.GetBool("private_action_runner.enabled") {
647-
drain, err := startPrivateActionRunner(mainCtx, config, hostnameGetter, rcClient, le, log, taggerComp, tracerouteComp, eventPlatform, ipc, demultiplexer)
650+
drain, err := startPrivateActionRunner(mainCtx, config, hostnameGetter, rcClient, le, log, taggerComp, tracerouteComp, eventPlatform, ipc, demultiplexer, helmactions)
648651
if err != nil {
649652
log.Errorf("Cannot start private action runner: %v", err)
650653
} else {
@@ -813,6 +816,7 @@ func startPrivateActionRunner(
813816
eventPlatform eventplatform.Component,
814817
ipc ipc.Component,
815818
demux demultiplexer.Component,
819+
ha helmactions.Component,
816820
) (func(), error) {
817821
if rcClient == nil {
818822
return nil, errors.New("Remote config is disabled or failed to initialize, remote config is a required dependency for private action runner")
@@ -830,7 +834,7 @@ func startPrivateActionRunner(
830834
metricsClient = &ddgostatsd.NoOpClient{}
831835
}
832836

833-
app, err := privateactionrunner.NewPrivateActionRunner(ctx, config, hostnameGetter, rcClient, log, tagger, tracerouteComp, eventPlatform, ipc, metricsClient)
837+
app, err := privateactionrunner.NewPrivateActionRunner(ctx, config, hostnameGetter, rcClient, log, tagger, tracerouteComp, eventPlatform, ipc, metricsClient, ha)
834838
if err != nil {
835839
return nil, err
836840
}

cmd/privateactionrunner/subcommands/run/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ go_library(
3232
"//comp/forwarder/eventplatform/def",
3333
"//comp/forwarder/eventplatform/fx",
3434
"//comp/forwarder/eventplatformreceiver/impl",
35+
"//comp/kubeactions/helmactions/fx",
3536
"//comp/networkpath/traceroute/fx-remote",
3637
"//comp/privateactionrunner/def",
3738
"//comp/privateactionrunner/fx",

cmd/privateactionrunner/subcommands/run/command.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
eventplatform "github.com/DataDog/datadog-agent/comp/forwarder/eventplatform/def"
3232
eventplatformfx "github.com/DataDog/datadog-agent/comp/forwarder/eventplatform/fx"
3333
eventplatformreceiverimpl "github.com/DataDog/datadog-agent/comp/forwarder/eventplatformreceiver/impl"
34+
helmactionsfx "github.com/DataDog/datadog-agent/comp/kubeactions/helmactions/fx"
3435
remotetraceroute "github.com/DataDog/datadog-agent/comp/networkpath/traceroute/fx-remote"
3536
privateactionrunner "github.com/DataDog/datadog-agent/comp/privateactionrunner/def"
3637
privateactionrunnerfx "github.com/DataDog/datadog-agent/comp/privateactionrunner/fx"
@@ -124,6 +125,7 @@ func runPrivateActionRunner(ctx context.Context, confPath string, extraConfFiles
124125
eventplatformfx.Module(eventplatform.NewDefaultParams()),
125126
statsdfx.Module(),
126127
fx.Invoke(startTelemetryServer),
128+
helmactionsfx.Module(),
127129
privateactionrunnerfx.Module(),
128130
}
129131

cmd/privateactionrunner/subcommands/runexecutor/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ go_library(
3030
"//comp/forwarder/eventplatform/def",
3131
"//comp/forwarder/eventplatform/fx",
3232
"//comp/forwarder/eventplatformreceiver/impl",
33+
"//comp/kubeactions/helmactions/fx",
3334
"//comp/networkpath/traceroute/fx-remote",
3435
"//comp/privateactionrunner/def",
3536
"//comp/privateactionrunner/fx",

cmd/privateactionrunner/subcommands/runexecutor/command.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
eventplatform "github.com/DataDog/datadog-agent/comp/forwarder/eventplatform/def"
2626
eventplatformfx "github.com/DataDog/datadog-agent/comp/forwarder/eventplatform/fx"
2727
eventplatformreceiverimpl "github.com/DataDog/datadog-agent/comp/forwarder/eventplatformreceiver/impl"
28+
helmactionsfx "github.com/DataDog/datadog-agent/comp/kubeactions/helmactions/fx"
2829
remotetraceroute "github.com/DataDog/datadog-agent/comp/networkpath/traceroute/fx-remote"
2930
privateactionrunner "github.com/DataDog/datadog-agent/comp/privateactionrunner/def"
3031
privateactionrunnerfx "github.com/DataDog/datadog-agent/comp/privateactionrunner/fx"
@@ -77,6 +78,7 @@ func runExecutor(ctx context.Context, confPath string, extraConfFiles []string)
7778
eventplatformreceiverimpl.Module(),
7879
eventplatformfx.Module(eventplatform.NewDefaultParams()),
7980
statsdfx.Module(),
81+
helmactionsfx.Module(),
8082
privateactionrunnerfx.ExecutorModule(),
8183
}
8284

comp/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,17 @@ Package hostprofiler implements the "host-profiler" bundle,
383383

384384
Package collector defines the host profiler collector component.
385385

386+
## [comp/kubeactions](https://pkg.go.dev/github.com/DataDog/datadog-agent/comp/kubeactions) (Component Bundle)
387+
388+
*Datadog Team*: container-integrations
389+
390+
Package kubeactions implements the "kubeactions" bundle, providing components
391+
for executing Kubernetes and Helm actions on behalf of the cluster agent.
392+
393+
### [comp/kubeactions/helmactions](https://pkg.go.dev/github.com/DataDog/datadog-agent/comp/kubeactions/helmactions)
394+
395+
Package helmactions provides a component for executing Helm actions.
396+
386397
## [comp/logs](https://pkg.go.dev/github.com/DataDog/datadog-agent/comp/logs) (Component Bundle)
387398

388399
*Datadog Team*: agent-log-pipelines

comp/kubeactions/BUILD.bazel

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "kubeactions",
5+
srcs = ["bundle.go"],
6+
importpath = "github.com/DataDog/datadog-agent/comp/kubeactions",
7+
visibility = ["//visibility:public"],
8+
deps = [
9+
"//comp/kubeactions/helmactions/fx",
10+
"//pkg/util/fxutil",
11+
],
12+
)

comp/kubeactions/bundle.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed
2+
// under the Apache License Version 2.0.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
// Copyright 2026-present Datadog, Inc.
5+
6+
//go:build kubeapiserver
7+
8+
// Package kubeactions implements the "kubeactions" bundle, providing components
9+
// for executing Kubernetes and Helm actions on behalf of the cluster agent.
10+
package kubeactions
11+
12+
import (
13+
helmactionsfx "github.com/DataDog/datadog-agent/comp/kubeactions/helmactions/fx"
14+
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
15+
)
16+
17+
// team: container-integrations
18+
19+
// Bundle defines the fx options for this bundle.
20+
func Bundle() fxutil.BundleOptions {
21+
return fxutil.Bundle(
22+
helmactionsfx.Module(),
23+
// TODO: add kubeactions as well when migrate to PAR
24+
)
25+
}

0 commit comments

Comments
 (0)