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

[profiles] Improve DAP name length error #1254

Merged
merged 7 commits into from
Jul 10, 2024
Merged

Conversation

khewonc
Copy link
Contributor

@khewonc khewonc commented Jun 27, 2024

What does this PR do?

If a profile name is too long, older versions of the operator would run into an error attempting to label the node, leading to this error:

{"level":"ERROR","ts":"2024-05-15T21:05:59Z","msg":"Reconciler error","controller":"datadogagent","controllerGroup":"datadoghq.com","controllerKind":"DatadogAgent","datadogAgent":{"name":"datadog","namespace":"default"},"namespace":"default","name":"datadog","reconcileID":"aaeaa6dd-0e90-41fd-9094-e0b7931919a5","error":"Node \"kind-worker\" is invalid: metadata.labels: Invalid value: \"default-abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\": must be no more than 63 characters"}

It can be unexpected that the operator would complain about node labels when applying a profile. Instead, we now invalidate the profile and output an error message that clarifies that the profile name is the issue.

{"level":"ERROR","ts":"2024-06-27T17:20:12Z","logger":"controllers.DatadogAgent","msg":"datadogagentprofile","datadogagent":{"name":"datadog","namespace":"default"},"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz":"datadogagentprofile_namespace","error":"Profile name must be no more than 63 characters"}
{"level":"ERROR","ts":"2024-06-27T17:20:12Z","logger":"controllers.DatadogAgent","msg":"profile cannot be applied","datadogagent":{"name":"datadog","namespace":"default"},"datadogagentprofile":"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz","datadogagentprofile_namespace":"default","error":"Profile name must be no more than 63 characters"}

Motivation

https://datadoghq.atlassian.net/browse/CECO-1187

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?

  • Agent: n/a
  • Cluster Agent: n/a

Describe your test plan

Write there any instructions and details you may have to test your PR.

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label

@khewonc khewonc added the enhancement New feature or request label Jun 27, 2024
@khewonc khewonc added this to the v1.8.0 milestone Jun 27, 2024
@khewonc khewonc requested review from a team as code owners June 27, 2024 20:31
@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.01%. Comparing base (a3ce2ae) to head (89732b2).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1254      +/-   ##
==========================================
+ Coverage   54.98%   55.01%   +0.02%     
==========================================
  Files         243      243              
  Lines       27986    28002      +16     
==========================================
+ Hits        15388    15404      +16     
  Misses      11729    11729              
  Partials      869      869              
Flag Coverage Δ
unittests 55.01% <100.00%> (+0.02%) ⬆️

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

Files Coverage Δ
pkg/agentprofile/agent_profile.go 63.17% <100.00%> (+2.43%) ⬆️

Continue to review full report in Codecov by Sentry.

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

pkg/agentprofile/agent_profile.go Outdated Show resolved Hide resolved
@khewonc khewonc merged commit 979aa8e into main Jul 10, 2024
19 checks passed
@khewonc khewonc deleted the khewonc/dap-name-length branch July 10, 2024 18:24
mftoure pushed a commit that referenced this pull request Oct 3, 2024
* Rename profile label key

* Remove old profile label

* Review suggestions

* Check for profile name length

* Update pkg/agentprofile/agent_profile.go

Co-authored-by: levan-m <[email protected]>

---------

Co-authored-by: levan-m <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants