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: Add --emit-translation-events to toggle creating of events in translation and config applying #5296

Merged
merged 4 commits into from
Dec 6, 2023

Conversation

randmonkey
Copy link
Contributor

@randmonkey randmonkey commented Dec 6, 2023

What this PR does / why we need it:

Add --emit-translation-events to disable creation of events for successful config applies, translation failures and config apply failures in translation to prevent large amount of events to be a source of load to k8s API server.

Which issue this PR fixes:

fixes #5252.

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@randmonkey randmonkey requested a review from a team as a code owner December 6, 2023 03:34
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (e84786e) 75.8% compared to head (d478fde) 75.8%.
Report is 1 commits behind head on main.

Files Patch % Lines
internal/manager/run.go 50.0% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5296   +/-   ##
=====================================
  Coverage   75.8%   75.8%           
=====================================
  Files        170     170           
  Lines      19450   19457    +7     
=====================================
+ Hits       14753   14767   +14     
+ Misses      3864    3859    -5     
+ Partials     833     831    -2     

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

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>
internal/manager/run.go Outdated Show resolved Hide resolved
internal/manager/run.go Outdated Show resolved Hide resolved
Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>
@programmer04 programmer04 added this to the KIC v3.1.x milestone Dec 6, 2023
@randmonkey randmonkey merged commit 8b3d551 into main Dec 6, 2023
46 checks passed
@randmonkey randmonkey deleted the fix/add_emit_translation_events branch December 6, 2023 10:12
@team-k8s-bot
Copy link
Collaborator

The backport to release/2.12.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/2.12.x release/2.12.x
# Navigate to the new working tree
cd .worktrees/backport-release/2.12.x
# Create a new branch
git switch --create backport-5296-to-release/2.12.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8b3d551ea7c93048add583f517992e8a6883e7d7
# Push it to GitHub
git push --set-upstream origin backport-5296-to-release/2.12.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/2.12.x

Then, create a pull request where the base branch is release/2.12.x and the compare/head branch is backport-5296-to-release/2.12.x.

@team-k8s-bot
Copy link
Collaborator

The backport to release/3.0.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/3.0.x release/3.0.x
# Navigate to the new working tree
cd .worktrees/backport-release/3.0.x
# Create a new branch
git switch --create backport-5296-to-release/3.0.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8b3d551ea7c93048add583f517992e8a6883e7d7
# Push it to GitHub
git push --set-upstream origin backport-5296-to-release/3.0.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/3.0.x

Then, create a pull request where the base branch is release/3.0.x and the compare/head branch is backport-5296-to-release/3.0.x.

@@ -213,6 +214,7 @@ func (c *Config) FlagSet() *pflag.FlagSet {
flagSet.IntVar(&c.Concurrency, "kong-admin-concurrency", 10, "Max number of concurrent requests sent to Kong's Admin API.")
flagSet.StringSliceVar(&c.WatchNamespaces, "watch-namespace", nil,
`Namespace(s) in comma-separated format (or specify this flag multiple times) to watch for Kubernetes resources. Defaults to all namespaces.`)
flagSet.BoolVar(&c.EmitTranslationEvents, "emit-translation-events", true, `Emit Kubernetes events for successful configuration applies, translation failures and configuration apply failures on managed objects.`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
flagSet.BoolVar(&c.EmitTranslationEvents, "emit-translation-events", true, `Emit Kubernetes events for successful configuration applies, translation failures and configuration apply failures on managed objects.`)
flagSet.BoolVar(&c.EmitKubernetesEvents, "emit-kubernetes-events", true, `Emit Kubernetes events for successful configuration applies, translation failures and configuration apply failures on managed objects.`)

I think the flag shouldn't include translation as it decides about emitting not only translation events.

Copy link
Member

Choose a reason for hiding this comment

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

#5299 has been merged. Thanks

tao12345666333 pushed a commit that referenced this pull request Dec 7, 2023
…anslation and config applying (#5296)

* add --emit-translation-events to toggle creating of events in translation and config applying

* update changelog

* Update internal/manager/run.go

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>

* Capitalize logs

Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>

---------

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>
Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>
(cherry picked from commit 8b3d551)
tao12345666333 pushed a commit that referenced this pull request Dec 7, 2023
…anslation and config applying (#5296)

* add --emit-translation-events to toggle creating of events in translation and config applying

* update changelog

* Update internal/manager/run.go

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>

* Capitalize logs

Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>

---------

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>
Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>
(cherry picked from commit 8b3d551)
randmonkey added a commit that referenced this pull request Dec 8, 2023
* Fix: Add --emit-translation-events to toggle creating of events in translation and config applying (#5296)

* add --emit-translation-events to toggle creating of events in translation and config applying

* update changelog

* Update internal/manager/run.go

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>

* Capitalize logs

Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>

---------

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>
Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>
(cherry picked from commit 8b3d551)

* fix: change events emit toggle name to --emit-kubernetes-events (#5299)

---------

Co-authored-by: Tao Yi <tao.yi@konghq.com>
Co-authored-by: Grzegorz Burzyński <czeslavo@gmail.com>
tao12345666333 added a commit that referenced this pull request Dec 8, 2023
* Fix: Add --emit-translation-events to toggle creating of events in translation and config applying (#5296)

* add --emit-translation-events to toggle creating of events in translation and config applying

* update changelog

* Update internal/manager/run.go

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>

* Capitalize logs

Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>

---------

Co-authored-by: Jintao Zhang <zhangjintao9020@gmail.com>
Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>
(cherry picked from commit 8b3d551)

* fix: change events emit toggle name to --emit-kubernetes-events (#5299)

* docs: re-generate docs/cli-arguments.md

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>

* Update CHANGELOG

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>

---------

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
Co-authored-by: Tao Yi <tao.yi@konghq.com>
Co-authored-by: Grzegorz Burzyński <czeslavo@gmail.com>
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.

emit-translation-events CLI flag to suppress event creation
5 participants