From ae49c0ea9a769e6e455cbc73726a9dc33f46ff51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Burzy=C5=84ski?= Date: Wed, 6 Dec 2023 14:36:55 +0100 Subject: [PATCH] fix: change events emit toggle name to --emit-kubernetes-events (#5299) --- CHANGELOG.md | 3 ++- docs/cli-arguments.md | 2 +- internal/manager/config.go | 4 ++-- internal/manager/run.go | 7 ++++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4d7e60f77..259421b488 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/docs/cli-arguments.md b/docs/cli-arguments.md index 72ad54dd6b..5e2b0c4862 100644 --- a/docs/cli-arguments.md +++ b/docs/cli-arguments.md @@ -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` | diff --git a/internal/manager/config.go b/internal/manager/config.go index 916b1a78c1..e4e5eea19e 100644 --- a/internal/manager/config.go +++ b/internal/manager/config.go @@ -82,7 +82,7 @@ type Config struct { WatchNamespaces []string GatewayAPIControllerName string Impersonate string - EmitTranslationEvents bool + EmitKubernetesEvents bool // Ingress status PublishServiceUDP OptionalNamespacedName @@ -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", diff --git a/internal/manager/run.go b/internal/manager/run.go index 4344bcaa7e..730ba9d627 100644 --- a/internal/manager/run.go +++ b/internal/manager/run.go @@ -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{} }