Add opt-in auto-rollout on referenced ConfigMap content change - #3294
Draft
gabedos wants to merge 2 commits into
Draft
Add opt-in auto-rollout on referenced ConfigMap content change#3294gabedos wants to merge 2 commits into
gabedos wants to merge 2 commits into
Conversation
Referenced ConfigMaps (operator-owned or user-supplied) mounted into the Agent DaemonSet, Cluster Agent, Cluster Check Runner, and OTel Agent Gateway pod templates weren't detected when their content changed out-of-band, so no rollout was triggered. Add an operator-level flag (rolloutOnConfigMapChangeEnabled) that, when set, hashes all ConfigMap volumes referenced by a component's pod template and stamps the result as an annotation, which flows through the existing spec-hash rollout-decision mechanism with no risk of a duplicate rollout when a direct spec change happens in the same reconcile. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🛑 Gate Violations
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Re-deploy Agent whenever external configmaps are updated by maintaining a hash of all configmaps used into a checksum that is updated on the daemonset/deployment every reconcile loop.
Motivation
ConfigMaps mounted into Agent/DCA/CCR/OTel/etc sometimes don't trigger a rollout of the Agent. This is particularly true for configmaps not created by the Operator (eg. CustomConfig.ConfigMap.Name). These can be edited outside of the scope of the Operator and no re-deployment occurs. This PR tracks external configmaps to trigger a redeployment.
Additional Notes
Defaults to
false; fully backward compatible. Can look into bumping this totruelater or potentially even removing the option to configure it.Describe your test plan
Install the Operator with the config flag to active configmap monitoring:
helm repo update datadog helm install datadog-operator datadog/datadog-operator \ --devel \ --namespace datadog --create-namespace \ --set-json 'env=[{"name":"DD_ROLLOUT_ON_CONFIGMAP_CHANGE_ENABLED","value":"true"}]'Create an external config map:
And attach it to the DatadogAgent CR:
Observe the resourceVersion and
checksum.agent.datadoghq.com/referenced-configmapsannotation on the DS:Then edit the configmap to trigger a redeployment via
kubectl edit http-check-extra-confd -n datadog.After at least 15 seconds (1 reconciliation loop) check to see if the daemonset has been updated and redeployed the Agent nodes with the previous 2 commands.
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel