Skip to content
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

Fix continuous create and delete of cluster roles and bindings #441

Merged
merged 2 commits into from Feb 4, 2022

Conversation

davidor
Copy link
Member

@davidor davidor commented Feb 3, 2022

What does this PR do?

When external metrics are enabled in the cluster agent, the datadog-cluster-agent-metrics-reader cluster role and the datadog-cluster-agent-metrics-reader and datadog-cluster-agent-auth-delegator cluster role bindings are being created and deleted continuously.

This PR fixes the bug. There were 2 issues, each solved in one commit:

  1. The functions that manage cluster roles and cluster role bindings were not handling correctly the "cleanup" case. In that case, they were creating the resource, and then deleting it.
  2. The controller was setting the cleanup attr incorrectly. The cluster roles and bindings mentioned above should be created when external metrics are enabled, but the controller was doing the opposite.

Describe your test plan

Enable external metrics in the cluster agent:

  clusterAgent:
    config:
      externalMetrics:
        enabled: true

Check that the cluster roles and cluster role bindings mentioned above are not created and deleted continuously.

@davidor davidor requested a review from a team as a code owner February 3, 2022 17:33
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not contain a valid label. Please add one of the following labels: bug, enhancement, refactoring, documentation

@davidor davidor added this to the v0.8.0 milestone Feb 3, 2022
@davidor davidor added bug Something isn't working component/controller labels Feb 3, 2022
@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2022

Codecov Report

Merging #441 (e903fac) into main (f267051) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #441   +/-   ##
=======================================
  Coverage   61.05%   61.05%           
=======================================
  Files           3        3           
  Lines          95       95           
=======================================
  Hits           58       58           
  Misses         25       25           
  Partials       12       12           
Flag Coverage Δ
unittests 61.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f267051...e903fac. Read the comment docs.

@davidor davidor merged commit 96fa79c into main Feb 4, 2022
@davidor davidor deleted the davidor/fix-continuous-recreate-cluster-roles branch February 4, 2022 07:56
@khewonc khewonc mentioned this pull request May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/controller
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants