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

add generation changed predicate to dda controller #1486

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

celenechang
Copy link
Contributor

What does this PR do?

Add GenerationChanged predicate to DatadogAgent controller to prevent Status updates from triggering reconciles on the resource.

Motivation

Before change (two reconcilers per period):

{"level":"INFO","ts":"2024-10-25T11:41:39.377Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}
{"level":"INFO","ts":"2024-10-25T11:41:39.743Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}
{"level":"INFO","ts":"2024-10-25T11:41:54.377Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}
{"level":"INFO","ts":"2024-10-25T11:41:54.743Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}
{"level":"INFO","ts":"2024-10-25T11:42:09.743Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}
{"level":"INFO","ts":"2024-10-25T11:42:09.864Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}

After (1 reconcile per period):

{"level":"INFO","ts":"2024-10-25T11:51:46.344Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}
{"level":"INFO","ts":"2024-10-25T11:52:01.465Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}
{"level":"INFO","ts":"2024-10-25T11:52:16.553Z","logger":"controllers.DatadogAgent","msg":"Reconciling DatadogAgent","datadogagent":{"name":"datadog","namespace":"system"}}

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: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

  • Deploy the latest Datadog Operator and apply a DatadogAgent manifest

  • View the logs to see reconcile frequency (Reconciling DatadogAgent). It is expected to be at least twice per second, every 15s.

  • Deploy the test image

  • Check the reconcile frequency. The number of reconciles should be reduced (in my test environment, it went down to once every 15s).

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

@celenechang celenechang added the enhancement New feature or request label Oct 25, 2024
@celenechang celenechang added this to the v1.11.0 milestone Oct 25, 2024
@celenechang celenechang requested a review from a team as a code owner October 25, 2024 12:08
@codecov-commenter
Copy link

codecov-commenter commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 48.70%. Comparing base (734366f) to head (9472213).

Files with missing lines Patch % Lines
internal/controller/datadogagent_controller.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1486      +/-   ##
==========================================
- Coverage   48.72%   48.70%   -0.02%     
==========================================
  Files         224      224              
  Lines       19845    19845              
==========================================
- Hits         9669     9666       -3     
- Misses       9668     9670       +2     
- Partials      508      509       +1     
Flag Coverage Δ
unittests 48.70% <0.00%> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
internal/controller/datadogagent_controller.go 66.97% <0.00%> (-2.76%) ⬇️

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 734366f...9472213. Read the comment docs.

@celenechang celenechang merged commit 7b66b25 into main Oct 25, 2024
22 checks passed
@celenechang celenechang deleted the celene/genchangepred branch October 25, 2024 13:49
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