-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CONTP-679] Fix bug in dca rbac generation for annotations and labels as tags: use deepcopy before merging #1719
[CONTP-679] Fix bug in dca rbac generation for annotations and labels as tags: use deepcopy before merging #1719
Conversation
988dc17
to
b7cbbaa
Compare
b7cbbaa
to
765d358
Compare
…e deepcopy of dicts when merging
765d358
to
90171c3
Compare
b69baa7
to
c79cafa
Compare
c79cafa
to
aaa0dc4
Compare
imagePullSecrets: [] | ||
initContainers: | ||
- name: init-volume | ||
image: "gcr.io/datadoghq/agent:7.63.0" | ||
imagePullPolicy: IfNotPresent | ||
command: ["bash", "-c"] | ||
args: | ||
- cp -r /etc/datadog-agent /opt | ||
volumeMounts: | ||
- name: config | ||
mountPath: /opt/datadog-agent | ||
readOnly: false # Need RW for writing agent config files | ||
resources: | ||
{} | ||
- name: init-config | ||
image: "gcr.io/datadoghq/agent:7.63.0" | ||
imagePullPolicy: IfNotPresent | ||
command: ["bash", "-c"] | ||
args: | ||
- for script in $(find /etc/cont-init.d/ -type f -name '*.sh' | sort) ; do bash $script ; done | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/datadog-agent | ||
readOnly: false # Need RW for writing datadog.yaml config file | ||
resources: | ||
{} | ||
- name: init-volume | ||
image: "gcr.io/datadoghq/agent:7.63.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for all this linter change. It would be good to sync with agent-onboarding team to know if we can commit in the repo the linter config so we can all use the same config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good. However it can be interesting to sync with agent-onboarding team to avoid having change in the baseline
files if not necessary.
What this PR does / why we need it:
Fixes bug that causes
DD_KUBERNETES_ANNOTATIONS_AS_TAGS
env var to be incorrectly set to the merged value of.Values.datadog.kubernetesResourcesLabelsAsTags
and.Values.datadog.kubernetesResourcesAnnotationsAsTags
.Which issue this PR fixes
(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged)Special notes for your reviewer:
The helm chart creates rbacs for the DCA based on user configuration of kubernetes resources labels and annotations as tags. This is needed so that workloadmeta can list and watch related resources to feed the tagger collector with labels and annotations so that it can generate tags.
The rbac generation is done here.
We are using mergeOverwrite directly over the values set by the user. (see here).
As a result,
.Values.datadog.kubernetesResourcesAnnotationsAsTags
is being modified in place (it includes a merged version with labels as tags).Consequently, if the user does this:
The user gets the following env vars:
As you can see, the second env var got a merged version of the two.
The documentation of helm says the following:
This is a deep merge operation but not a deep copy operation. Nested objects that are merged are the same instance on both dicts. If you want a deep copy along with the merge then use the deepCopy function along with merging.
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
.github/helm-docs.sh
)CHANGELOG.md
has been updatedREADME.md
make update-test-baselines
)