Skip to content

Commit

Permalink
fix: change events emit toggle name to --emit-kubernetes-events
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Dec 6, 2023
1 parent 8b3d551 commit ce694f4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
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 flag. | `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 @@ -85,7 +85,7 @@ type Config struct {
WatchNamespaces []string
GatewayAPIControllerName string
Impersonate string
EmitTranslationEvents bool
EmitKubernetesEvents bool

// Ingress status
PublishServiceUDP OptionalNamespacedName
Expand Down Expand Up @@ -214,7 +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.`)
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 @@ -142,11 +142,12 @@ func Run(

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 fake recorder with no Events channel to discard all events.
eventRecorder = &record.FakeRecorder{}
}

Expand Down

0 comments on commit ce694f4

Please sign in to comment.