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: applicationset controller should respect logging flags (#10399) #10513

Merged

Conversation

toVersus
Copy link
Contributor

@toVersus toVersus commented Sep 3, 2022

Signed-off-by: Tsubasa Nagasawa toversus2357@gmail.com

Fixes: #10399

This PR fixes applicationset controller to respect the log level and format passed as flags by reusing logging utils adopted in other Argo CD components.

I confirmed that the log format flag (--logformat json) got to work as expected after this change:

{"built":"2022-09-03T04:32:09Z","commit":"75acdcc15db79fa02e19c254007723dda86a06d3","level":"info","msg":"ArgoCD ApplicationSet Controller is starting","namespace":"argocd","time":"2022-09-03T04:40:29Z","version":"v2.5.0+75acdcc.dirty"}
{"level":"info","msg":"Starting configmap/secret informers","time":"2022-09-03T04:40:30Z"}
{"level":"info","msg":"Configmap/secret informer synced","time":"2022-09-03T04:40:30Z"}
{"level":"info","msg":"Starting manager","time":"2022-09-03T04:40:30Z"}
{"level":"info","msg":"Starting webhook server","time":"2022-09-03T04:40:30Z"}
(...)
{"applicationset":{"Namespace":"argocd","Name":"kube-state-metrics"},"level":"info","msg":"end reconcile","requeueAfter":31536000000000000,"time":"2022-09-03T04:40:48Z"}

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@toVersus toVersus force-pushed the fix/applicationset-logging-flags branch from 846b481 to 75acdcc Compare September 3, 2022 04:25
@codecov
Copy link

codecov bot commented Sep 3, 2022

Codecov Report

Base: 45.75% // Head: 45.75% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (2d292cd) compared to base (158e92c).
Patch coverage: 50.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10513      +/-   ##
==========================================
- Coverage   45.75%   45.75%   -0.01%     
==========================================
  Files         236      236              
  Lines       28527    28526       -1     
==========================================
- Hits        13053    13052       -1     
  Misses      13669    13669              
  Partials     1805     1805              
Impacted Files Coverage Δ
...cationset/controllers/applicationset_controller.go 56.63% <50.00%> (-0.12%) ⬇️
util/settings/settings.go 51.36% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@toVersus toVersus force-pushed the fix/applicationset-logging-flags branch from 75acdcc to 38fab0f Compare September 3, 2022 04:43
@crenshaw-dev crenshaw-dev added the cherry-pick/2.4 Candidate for cherry picking into the 2.4 release branch label Sep 9, 2022
@crenshaw-dev
Copy link
Collaborator

@toVersus thanks for this! Can you resolve conflicts!

@toVersus toVersus force-pushed the fix/applicationset-logging-flags branch from 38fab0f to 84bcd13 Compare September 9, 2022 23:23
@toVersus
Copy link
Contributor Author

Thanks for letting me know, resolved! PTAL

* Align logging setup with other controllers

Signed-off-by: toVersus <toversus2357@gmail.com>
@toVersus toVersus force-pushed the fix/applicationset-logging-flags branch from 84bcd13 to 2d292cd Compare September 17, 2022 03:24
@vgrigoruk
Copy link

it is gonna be possible to specify applicationset-controller loglevel and log format via argocd-cmd-params-cm.yaml?

@toVersus
Copy link
Contributor Author

toVersus commented Oct 6, 2022

@crenshaw-dev
Hi, sorry to disturb you. Is there anything I can do before merging this?

@crenshaw-dev
Copy link
Collaborator

@vgrigoruk I think that would be a good follow-up PR!

Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Thanks @toVersus!

I'm going to only cherry-pick this to 2.5 to avoid changing behavior on a patch release. If folks really need this fix in 2.4 or prior, I'll check with #argo-contributors on Slack to see how folks feel about cherry-picking further back.

@crenshaw-dev crenshaw-dev added cherry-pick/2.5 and removed cherry-pick/2.4 Candidate for cherry picking into the 2.4 release branch labels Oct 7, 2022
@crenshaw-dev crenshaw-dev merged commit b00d9b7 into argoproj:master Oct 7, 2022
crenshaw-dev pushed a commit that referenced this pull request Oct 7, 2022
* Align logging setup with other controllers

Signed-off-by: toVersus <toversus2357@gmail.com>

Signed-off-by: toVersus <toversus2357@gmail.com>
@crenshaw-dev
Copy link
Collaborator

Cherry-picked onto release-2.5 for 2.5.0-rc2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

applicationset-controller logging not respecting logformat and loglevel flags
3 participants