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

feat: option to disable writing k8s events(#18205) #18441

Conversation

Jack-R-lantern
Copy link
Contributor

@Jack-R-lantern Jack-R-lantern commented May 29, 2024

This PR is related to the argocd event logging optionization.
The implementation is on/off depending on the kind of event reason.

Below is a simple example
case all, none, specific

Result

argocd-server env all

option-all
option-all-result

argocd-server env none

option-none
option-none-result

argocd-server env specific

option-specific
option-specific-result

Close #18205

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).
  • The title of the PR conforms to the Toolchain Guide
  • 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.
  • 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).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Copy link

codecov bot commented May 29, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 8 lines in your changes missing coverage. Please review.

Project coverage is 55.84%. Comparing base (ae028c2) to head (1a57c8b).
Report is 467 commits behind head on master.

Files with missing lines Patch % Lines
util/argo/audit_logger.go 82.75% 4 Missing and 1 partial ⚠️
cmd/argocd-server/commands/argocd_server.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #18441      +/-   ##
==========================================
+ Coverage   55.81%   55.84%   +0.02%     
==========================================
  Files         320      320              
  Lines       44396    44430      +34     
==========================================
+ Hits        24781    24810      +29     
- Misses      17050    17051       +1     
- Partials     2565     2569       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Jack-R-lantern Jack-R-lantern changed the title feat: option to disable writing k8s events feat: option to disable writing k8s events(#18205) May 29, 2024
@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18205/option_to_disable_writing_k8s_events branch 4 times, most recently from bf515c8 to 1af1404 Compare June 2, 2024 14:28
@Jack-R-lantern Jack-R-lantern marked this pull request as ready for review June 2, 2024 15:16
@Jack-R-lantern Jack-R-lantern requested review from a team as code owners June 2, 2024 15:16
@Jack-R-lantern
Copy link
Contributor Author

@tooptoop4 Can you check on that PR?

jannfis
jannfis previously requested changes Jun 4, 2024
Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

Thanks for your PR.

However, I feel like this will pollute the command line arguments (and accompanying environment variables) unnecessarily.

Have you considered using a single flag taking a list of events to enable? (i.e. --enable-events=<comma separated list>), possibly with all and none aliases?

@Jack-R-lantern
Copy link
Contributor Author

Thanks for your PR.

However, I feel like this will pollute the command line arguments (and accompanying environment variables) unnecessarily.

Have you considered using a single flag taking a list of events to enable? (i.e. --enable-events=<comma separated list>), possibly with all and none aliases?

@jannfis
Oh, That‘s very good idea.
I'll change it

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18205/option_to_disable_writing_k8s_events branch from 1af1404 to 04e885c Compare June 5, 2024 00:21
@Jack-R-lantern Jack-R-lantern requested a review from jannfis June 5, 2024 00:38
@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18205/option_to_disable_writing_k8s_events branch 2 times, most recently from 39e230b to 3d52314 Compare June 5, 2024 05:35
Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

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

Thanks @Jack-R-lantern !! LGTM!!

@jannfis do you any concerns on the PR?

@dmatviichuk
Copy link

@jannfis do you any concerns on the PR? Could we please merge as soon as possible? Thanks!

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18205/option_to_disable_writing_k8s_events branch 5 times, most recently from 9f2d5f0 to bb41454 Compare July 4, 2024 13:35
@Jack-R-lantern
Copy link
Contributor Author

@jannfis
Resolved all conflicts.
Please review this PR

@janburian-ext43623
Copy link

janburian-ext43623 commented Jul 25, 2024

Hi @jannfis, could you please review this PR? We are waiting for this feature and we would like to be merged ASAP. Hope it will make it still to 2.12. Thanks a lot!

@jenting
Copy link
Contributor

jenting commented Aug 3, 2024

Would love to use this enhancement in the coming release version.

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18205/option_to_disable_writing_k8s_events branch 2 times, most recently from f12fbe9 to b95c9f1 Compare September 9, 2024 13:21
@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18205/option_to_disable_writing_k8s_events branch from b95c9f1 to b4f538c Compare September 15, 2024 05:10
Copy link
Member

@gdsoumya gdsoumya left a comment

Choose a reason for hiding this comment

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

Minor comment rest LGTM

optioned to write logs for k8s events.
Each is passed as an environment variable and defaults to true,
disabling it requires explicitly setting the option to false.

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
fix unit test
- application_test
- applicationset_test
- project_test
- appcontroller_tes
- audit_logger_test

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18205/option_to_disable_writing_k8s_events branch from b4f538c to 1a57c8b Compare September 18, 2024 13:39
@gdsoumya
Copy link
Member

@jannfis does the changes look good to you?

@gdsoumya gdsoumya merged commit eba559a into argoproj:master Sep 23, 2024
27 of 28 checks passed
@tooptoop4
Copy link

/cherry-pick release-2.13

ratulbasak pushed a commit to ratulbasak/argo-cd that referenced this pull request Sep 25, 2024
…18441)

* feat: option to disable writing k8s events

optioned to write logs for k8s events.
Each is passed as an environment variable and defaults to true,
disabling it requires explicitly setting the option to false.

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

* feat: option to disable writing k8s events

fix unit test
- application_test
- applicationset_test
- project_test
- appcontroller_tes
- audit_logger_test

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

* rebase

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

---------

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
@shreyasurs27
Copy link

@Jack-R-lantern We are unable to find this commit in any release notes. Which version has this change?

@Jack-R-lantern
Copy link
Contributor Author

@shreyasurs27

Would you like to check the 2.13.0 version?

@shreyasurs27
Copy link

@Jack-R-lantern I checked the code , looks like it is only available in master but not on the tags.

image image

@shreyasurs27
Copy link

shreyasurs27 commented Nov 13, 2024

@Jack-R-lantern @tooptoop4 @gdsoumya Can this feature be included in next patch version? I could not find it in latest release. Looks like it was merged to master but not to individual tags. 2.13 does not have this feature. Please correct me if I am wrong.

I am using 2.12.4 version. This is a very useful feature for us. Whenever there is a shared resource warning, the applications will be in out-of-sync and sync loop forever which creates thousands of events for few mins. I even tried the "failonsharedresourcewarning" option , it works perfectly for app with manual sync but for auto-sync enabled apps the loop continues. It brought down the etcd . So disabling the events would really help in this case.

@gdsoumya
Copy link
Member

/cherry-pick release-2.13

@gdsoumya
Copy link
Member

Seems like the automated cherry pick isn't working, @Jack-R-lantern can you raise a cherry pick PR to the release branch release-2.13

Jack-R-lantern added a commit to Jack-R-lantern/argo-cd that referenced this pull request Nov 13, 2024
…18441)

* feat: option to disable writing k8s events

optioned to write logs for k8s events.
Each is passed as an environment variable and defaults to true,
disabling it requires explicitly setting the option to false.

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

* feat: option to disable writing k8s events

fix unit test
- application_test
- applicationset_test
- project_test
- appcontroller_tes
- audit_logger_test

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

* rebase

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

---------

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
@Jack-R-lantern
Copy link
Contributor Author

@gdsoumya
sure, I submitted the PR.

gdsoumya pushed a commit that referenced this pull request Nov 14, 2024
* feat: option to disable writing k8s events

optioned to write logs for k8s events.
Each is passed as an environment variable and defaults to true,
disabling it requires explicitly setting the option to false.

---------

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
adriananeci pushed a commit to adriananeci/argo-cd that referenced this pull request Dec 4, 2024
…18441)

* feat: option to disable writing k8s events

optioned to write logs for k8s events.
Each is passed as an environment variable and defaults to true,
disabling it requires explicitly setting the option to false.

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

* feat: option to disable writing k8s events

fix unit test
- application_test
- applicationset_test
- project_test
- appcontroller_tes
- audit_logger_test

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

* rebase

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>

---------

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
Signed-off-by: Adrian Aneci <aneci@adobe.com>
@andrey-parkhomets
Copy link

I wonder why that nice feature not available via configmap argocd-cmd-params-cm as

data:
   server.enable.k8s.event: none

@Jack-R-lantern
Copy link
Contributor Author

I wonder why that nice feature not available via configmap argocd-cmd-params-cm as

data:

   server.enable.k8s.event: none

Does it work when using environment variable?

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

Successfully merging this pull request may close these issues.

Option to disable writing k8s events
10 participants