Add DCA service clusterIP checksum annotation to migrated daemonsets #2467
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds DCA service clusterIP checksum hash to the helm-migrated daemonset so that if the DCA service clusterIP changes (i.e. during a datadog helm release uninstallation), the hash will update and trigger a rolling update on the daemonset so that agent pods will be able to communicate with DCA at the new DCA service's clusterIP.
Motivation
During a Helm -> Operator agent workload migration, one of the steps is to uninstall the datadog helm chart (after installing the operator chart).
Before migration: Helm manages all agent resources, including the DCA service, which is assigned a ClusterIP by K8s. At pod creation-time, agent pods are injected static environment variables that instruct them to connect to this clusterIP in order to communicate with the DCA:
After migration & uninstall Datadog chart: Helm-managed DCA service is deleted, but agent daemonset is preserved and agent pods still reference old clusterIP defined in the helm-managed service
After migration & new operator pod assumes leader role: Operator creates a new DCA service and K8s assigns a new ClusterIP, but agent pods are still trying to connect to the clusterIP from the OLD deleted DCA service.
By setting a checksum hash of the DCA service's clusterIP, a change in the clusterIP will trigger a DS/EDS rollout to use the new service's cluster IP.
Additional Notes
This change does result in an additional rollingUpdate during the migration process:
Minimum Agent Versions
Are there minimum versions of the Datadog Agent and/or Cluster Agent required?
Describe your test plan
kubectl get service datadog-cluster-agentagent.datadoghq.com/dca-service-clusterip-hashmetadata.annotations:agent.datadoghq.com/helm-migration: "true"and deploy the DDA (this simulates a migration-enabled DDA)agent.datadoghq.com/dca-service-clusterip-hash. There should now be a rollingUpdate triggered on the agent pods.kubectl delete service datadog-cluster-agent)Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel