Skip to content

Commit

Permalink
fix: change events emit toggle name to --emit-kubernetes-events (#5299)
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo authored and tao12345666333 committed Dec 7, 2023
1 parent b8bf7c8 commit ae49c0e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ Adding a new version? You'll need three changes:
### Added

- Added `--emit-translation-events` CLI flag to disable the creation of events
- Added `--emit-kubernetes-events` CLI flag to disable the creation of events
in translating and applying configurations to Kong.
[#5296](https://github.com/Kong/kubernetes-ingress-controller/pull/5296)
[#5299](https://github.com/Kong/kubernetes-ingress-controller/pull/5299)

## [2.12.2]

Expand Down
2 changes: 1 addition & 1 deletion docs/cli-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
| `--dump-sensitive-config` | `bool` | Include credentials and TLS secrets in configs exposed with --dump-config. | `false` |
| `--election-id` | `string` | Election id to use for status update. | `5b374a9e.konghq.com` |
| `--election-namespace` | `string` | Leader election namespace to use when running outside a cluster. | |
| `--emit-translation-events` | `bool` | Emit Kubernetes events for successful configuration applies, translation failures and configuration apply failures on managed objects. | `true` |
| `--emit-kubernetes-events` | `bool` | Emit Kubernetes events for successful configuration applies, translation failures and configuration apply failures on managed objects. | `true` |
| `--enable-controller-gwapi-gateway` | `bool` | Enable the Gateway API Gateway controller. | `true` |
| `--enable-controller-gwapi-httproute` | `bool` | Enable the Gateway API HTTPRoute controller. | `true` |
| `--enable-controller-gwapi-reference-grant` | `bool` | Enable the Gateway API ReferenceGrant controller. | `true` |
Expand Down
4 changes: 2 additions & 2 deletions internal/manager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type Config struct {
WatchNamespaces []string
GatewayAPIControllerName string
Impersonate string
EmitTranslationEvents bool
EmitKubernetesEvents bool

// Ingress status
PublishServiceUDP OptionalNamespacedName
Expand Down Expand Up @@ -201,7 +201,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.`)
flagSet.BoolVar(&c.EmitKubernetesEvents, "emit-kubernetes-events", true, `Emit Kubernetes events for successful configuration applies, translation failures and configuration apply failures on managed objects.`)

// Ingress status
flagSet.Var(flags.NewValidatedValue(&c.PublishService, namespacedNameFromFlagValue, nnTypeNameOverride), "publish-service",
Expand Down
7 changes: 4 additions & 3 deletions internal/manager/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ func Run(ctx context.Context, c *Config, diagnostic util.ConfigDumpDiagnostic, d

setupLog.Info("Initializing Dataplane Client")
var eventRecorder record.EventRecorder
if c.EmitTranslationEvents {
setupLog.Info("Emit translation event enabled, create event recorder for " + KongClientEventRecorderComponentName)
if c.EmitKubernetesEvents {
setupLog.Info("Emitting Kubernetes events enabled, creating an event recorder for " + KongClientEventRecorderComponentName)
eventRecorder = mgr.GetEventRecorderFor(KongClientEventRecorderComponentName)
} else {
setupLog.Info("Emit translation event disabled, discard all events")
setupLog.Info("Emitting Kubernetes events disabled, discarding all events")
// Create an empty record.FakeRecorder with no Events channel to discard all events.
eventRecorder = &record.FakeRecorder{}
}

Expand Down

1 comment on commit ae49c0e

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Go Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: ae49c0e Previous: 6a92fa8 Ratio
BenchmarkDefaultContentToDBLessConfigConverter_Convert - ns/op 127.6 ns/op 70.99 ns/op 1.80

This comment was automatically generated by workflow using github-action-benchmark.

CC: @Kong/k8s-maintainers

Please sign in to comment.