Compare label hashes instead of recalculating spec hash for daemonsets #1193
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?
#1173 was merged to fix label overrides for pod templates in daemonsets. It caused unnecessary update requests each reconcile since it recalculated the pod template spec from the existing daemonset to compare to the operator-generated daemonset. Kubernetes would fill in values in the existing daemonset, which meant the hashes would always be different and the operator would attempt to update the daemonset even when there were no functional changes.
An example of one of the differences in the existing daemonset where kubernetes added a default value and the operator-generated daemonset:
Existing daemonset:
Operator-generated daemonset:
This PR takes the pod template labels for the existing and new daemonsets and creates hashes to compare them instead of recalculating the agentspechash.
Motivation
What inspired you to submit this pull request?
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
agent.datadoghq.com/name=datadog
instead ofagent.datadoghq.com/name=bar
) and that this log is in the operator logs:agent.datadoghq.com/agentspechash
annotation on the daemonset to use for comparison in later stepsagent.datadoghq.com/agentspechash
annotation value should change, the daemonset label should change tofoo:bar123
, but the pod template spec should still have the oldfoo:bar
label and the node agent pod shouldn't have restartedagent.datadoghq.com/agentspechash
annotation value should be the same and both the daemonset label and pod template spec label should sayfoo:bar123
Updating Daemonset
andCreating Daemonset
logs don't constantly appearChecklist
bug
,enhancement
,refactoring
,documentation
,tooling
, and/ordependencies
qa/skip-qa
label