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

Backport --emit-kubernetes-events to release/2.12.x #5305

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Adding a new version? You'll need three changes:
* Add the diff link, like "[2.7.0]: https:/kong/kubernetes-ingress-controller/compare/v1.2.2...v1.2.3".
This is all the way at the bottom. It's the thing we always forget.
--->
- [2.12.3](#2123)
- [2.12.2](#2122)
- [2.12.1](#2121)
- [2.12.0](#2120)
- [2.11.1](#2111)
- [2.11.0](#2110)
Expand Down Expand Up @@ -75,7 +78,64 @@ Adding a new version? You'll need three changes:
- [0.0.5](#005)
- [0.0.4 and prior](#004-and-prior)

## 2.12.0
## [2.12.3]

> Release date: TBD

### Added

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

## [2.12.2]

> Release date: 2023-11-22

### Fixed

- Using an Ingress with annotation `konghq.com/rewrite` and another Ingress without it pointing to the same Service,
will no longer cause synchronization loop and random request failures due to incorrect routing.
[#5215](https:/Kong/kubernetes-ingress-controller/pull/5215)
- Using the same Service in one Ingress as a target for ingress rule and default backend works without issues.
[#5217](https:/Kong/kubernetes-ingress-controller/pull/5217)

### Known issues

- **Only when combined routes are not enabled**, generated Kong routes may have conflicting names, that leads to
incorrect routing. In such case the descriptive error message is now provided. Use feature gate `CombinedRoutes=true`
or update Kong Kubernetes Ingress Controller version to 3.0.0 or above (both remediation changes naming schema of Kong routes).
[#5198](https:/Kong/kubernetes-ingress-controller/issues/5198)

## [2.12.1]

> Release date: 2023-11-09

### Fixed

- Credentials Secrets that are not referenced by any KongConsumer but violate the KongConsumer
basic level validation (invalid credential type or missing required fields) are now rejected
by the admission webhook.
[#4887](https:/Kong/kubernetes-ingress-controller/pull/4887)
- Error logs emitted from Gateway Discovery readiness checker that should be
logged at `debug` level are now logged at that level.
[#5030](https:/Kong/kubernetes-ingress-controller/pull/5030)
- Fix `panic` when last known configuration fetcher gets a `nil` Status when requesting
`/status` from Kong Gateway.
This happens when Gateway is responding with a 50x HTTP status code.
[#5120](https:/Kong/kubernetes-ingress-controller/pull/5120)
- Use 46 bits in values of priorities of generated Kong routes when expression
rotuer is enabled to limit the priorities to be less than `1e14`. This
prevents them to be encoded into scientific notation when dumping
configurations from admin API that brings precision loss and type
inconsistency in decoding JSON/YAML data to `uint64`.
This change will limit number of `HTTPRoute`s that can be
deterministically sorted by their creation timestamps, names and internal
rule orders to `2^12=4096` and number of `GRPCRoutes` can be sorted to `2^8=256`.
[#5124](https:/Kong/kubernetes-ingress-controller/pull/5124)

## [2.12.0]
tao12345666333 marked this conversation as resolved.
Show resolved Hide resolved

> Release date: 2023-09-25

Expand Down
4 changes: 4 additions & 0 deletions docs/cli-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
| `--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-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` |
| `--enable-controller-ingress-class-networkingv1` | `bool` | Enable the networking.k8s.io/v1 IngressClass controller. | `true` |
| `--enable-controller-ingress-class-parameters` | `bool` | Enable the IngressClassParameters controller. | `true` |
| `--enable-controller-ingress-networkingv1` | `bool` | Enable the networking.k8s.io/v1 Ingress controller. | `true` |
Expand Down
4 changes: 3 additions & 1 deletion internal/manager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type Config struct {
WatchNamespaces []string
GatewayAPIControllerName string
Impersonate string
EmitKubernetesEvents bool

// Ingress status
PublishServiceUDP OptionalNamespacedName
Expand Down Expand Up @@ -199,7 +200,8 @@ func (c *Config) FlagSet() *pflag.FlagSet {
flagSet.StringSliceVar(&c.FilterTags, "kong-admin-filter-tag", []string{"managed-by-ingress-controller"}, "The tag used to manage and filter entities in Kong. This flag can be specified multiple times to specify multiple tags. This setting will be silently ignored if the Kong instance has no tags support.")
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) to watch for Kubernetes resources. Defaults to all namespaces. To watch multiple namespaces, use a comma-separated list of namespaces.`)
`Namespace(s) in comma-separated format (or specify this flag multiple times) to watch for Kubernetes resources. Defaults to all namespaces.`)
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
11 changes: 10 additions & 1 deletion internal/manager/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/go-logr/logr"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/manager"
Expand Down Expand Up @@ -138,7 +139,15 @@ func Run(ctx context.Context, c *Config, diagnostic util.ConfigDumpDiagnostic, d
}

setupLog.Info("Initializing Dataplane Client")
eventRecorder := mgr.GetEventRecorderFor(KongClientEventRecorderComponentName)
var eventRecorder record.EventRecorder
if c.EmitKubernetesEvents {
setupLog.Info("Emitting Kubernetes events enabled, creating an event recorder for " + KongClientEventRecorderComponentName)
eventRecorder = mgr.GetEventRecorderFor(KongClientEventRecorderComponentName)
} else {
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{}
}

readinessChecker := clients.NewDefaultReadinessChecker(adminAPIClientsFactory, setupLog.WithName("readiness-checker"))
clientsManager, err := clients.NewAdminAPIClientsManager(
Expand Down
Loading