Fix error raised in the DCA when using external metrics #443
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?
Fixes an error that happens when the external metrics option is enabled in the DCA:
When creating a datadog metric, and an HPA object that references it, the DCA shows an error like this one:
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/