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 error raised in the DCA when using external metrics #443

Merged
merged 1 commit into from Feb 4, 2022

Conversation

davidor
Copy link
Member

@davidor davidor commented Feb 4, 2022

What does this PR do?

Fixes an error that happens when the external metrics option is enabled in the DCA:

  clusterAgent:
    config:
      externalMetrics:
        enabled: true

When creating a datadog metric, and an HPA object that references it, the DCA shows an error like this one:

...events is forbidden: User "system:serviceaccount:datadog:datadog-cluster-agent" cannot create resource "events" in API group ""...

This PR fixes the issue by adding create perms for events in the cluster agent cluster role. We're already setting these perms in the helm chart: https://github.com/DataDog/helm-charts/blob/0316b0ec18de7eda72279c3b683770efa502ffc7/charts/datadog/templates/cluster-agent-rbac.yaml#L22

Also note that I haven't tested the external metrics extensively, in this PR I just wanted to solve the RBAC issue.

Describe your test plan

Enable the external metrics option, create a datadog metric, then create an HPA object that references it, and make sure that the error above doesn't show in the cluster agent logs.
Docs about external metrics: https://docs.datadoghq.com/agent/cluster_agent/external_metrics/

@davidor davidor requested a review from a team as a code owner February 4, 2022 11:30
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 bug Something isn't working component/controller labels Feb 4, 2022
@davidor davidor added this to the v0.8.0 milestone Feb 4, 2022
@codecov-commenter
Copy link

codecov-commenter commented Feb 4, 2022

Codecov Report

Merging #443 (df2b0d0) into main (96fa79c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #443   +/-   ##
=======================================
  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 96fa79c...df2b0d0. Read the comment docs.

@davidor davidor force-pushed the davidor/add-event-create-cluster-agent-rbac branch from 9afca80 to df2b0d0 Compare February 4, 2022 13:27
@davidor davidor merged commit a65ce8a into main Feb 4, 2022
@davidor davidor deleted the davidor/add-event-create-cluster-agent-rbac branch February 4, 2022 13:58
@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