[ACTP] Use Config maps for par deploy in dca#2659
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2659 +/- ##
==========================================
+ Coverage 38.59% 38.69% +0.10%
==========================================
Files 307 307
Lines 26471 26525 +54
==========================================
+ Hits 10216 10265 +49
Misses 15494 15494
- Partials 761 766 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
| podTemplate := managers.PodTemplateSpec() | ||
| for i, container := range podTemplate.Spec.Containers { | ||
| if container.Name == string(apicommon.ClusterAgentContainerName) { | ||
| // Set command if not already set (default is from Dockerfile) | ||
| // See https://github.com/DataDog/datadog-agent/blob/06ea6848b891e08d34753e452be7f3c9bacbf407/Dockerfiles/cluster-agent/Dockerfile#L123 | ||
| if len(container.Command) == 0 { | ||
| podTemplate.Spec.Containers[i].Command = []string{"datadog-cluster-agent", "start"} | ||
| } | ||
| // Add -E flag to command | ||
| podTemplate.Spec.Containers[i].Command = append(podTemplate.Spec.Containers[i].Command, fmt.Sprintf("-E=%s", PrivateActionRunnerConfigPath)) | ||
| break | ||
| } |
There was a problem hiding this comment.
feels like they should be a higher level API rather than us patching it like this
There was a problem hiding this comment.
Hum the only thing I could find in the manager that would fit was this one
Let me ask container-platform
There was a problem hiding this comment.
It seems there are also examples of such usage
internal/controller/datadogagent/feature/privateactionrunner/feature_test.go
Outdated
Show resolved
Hide resolved
internal/controller/datadogagent/feature/privateactionrunner/feature_test.go
Outdated
Show resolved
Hide resolved
tbavelier
left a comment
There was a problem hiding this comment.
nit but "breaking change" compared to previous version: with this version, the annotation does not take "priority" over the configdata, meaning a user with:
cluster-agent.datadoghq.com/private-action-runner-enabled: "true"
cluster-agent.datadoghq.com/private-action-runner-configdata: |
private_action_runner:
enabled: false
self_enroll: true
identity_secret_name: datadog-par-identity
actions_allowlist:
- com.datadoghq.http.request
- com.datadoghq.kubernetes.core.listPod
- com.datadoghq.traceroutewill not have PAR enabled since the enabled stays the same in the CM.
Also not in scope of this PR, but instead of having the conditional for the RBAC in rbac.go (if config == nil || !config.Enabled || !config.SelfEnroll), could we please move it to feature.go before calling managers.RBACManager().AddPolicyRules( ? That way, we avoid creating an empty role when self-enroll is false and it's clearer when we do add rbacs. Moreover, that simplifies the conditional to simply config.SelfEnroll considering in ManageDependencies, we are already in a block f.clusterConfig != nil && f.clusterConfig.Enabled:
// Add RBAC for secret access during self-enrollment
if f.clusterConfig.SelfEnroll {
rbacResourcesName := getPrivateActionRunnerRbacResourcesName(f.owner)
if err := managers.RBACManager().AddPolicyRules(
f.owner.GetNamespace(),
rbacResourcesName,
f.clusterServiceAccountName,
getClusterAgentRBACPolicyRules(f.clusterConfig),
); err != nil {
return err
}
}11973c7 to
b8a5ea0
Compare

What does this PR do?
When deploying PAR in DCA, use configmap and volume mounts instead of adding envvar
Motivation
We want to do this because:
Additional Notes
Anything else we should know when reviewing?
Minimum Agent Versions
Are there minimum versions of the Datadog Agent and/or Cluster Agent required?
Describe your test plan
Build and deploy the operator locally
Commands
Apply the
DatadogAgentobject in a local k8s clusterdatadog-agent.yaml
kustomization.yaml
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel