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(controllers) disable more IngressClass lookups #2724

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@

- Added `mtls-auth` to the admission webhook supported credential types list.
[#2739](https:/Kong/kubernetes-ingress-controller/pull/2739)
- Disabled additional IngressClass lookups in other reconcilers when the
IngressClass reconciler is disabled.
[#2724](https:/Kong/kubernetes-ingress-controller/pull/2724)

## [2.5.0]

Expand Down
14 changes: 8 additions & 6 deletions hack/generators/controllers/networking/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,14 @@ func (r *{{.PackageAlias}}{{.Kind}}Reconciler) Reconcile(ctx context.Context, re
}
{{if .AcceptsIngressClassNameAnnotation}}
class := new(netv1.IngressClass)
if err := r.Get(ctx, types.NamespacedName{Name: r.IngressClassName}, class); err != nil {
// we log this without taking action to support legacy configurations that only set ingressClassName or
// used the class annotation and did not create a corresponding IngressClass. We only need this to determine
// if the IngressClass is default or to configure default settings, and can assume no/no additional defaults
// if none exists.
log.V(util.DebugLevel).Info("could not retrieve IngressClass", "ingressclass", r.IngressClassName)
if !r.DisableIngressClassLookups {
if err := r.Get(ctx, types.NamespacedName{Name: r.IngressClassName}, class); err != nil {
// we log this without taking action to support legacy configurations that only set ingressClassName or
// used the class annotation and did not create a corresponding IngressClass. We only need this to determine
// if the IngressClass is default or to configure default settings, and can assume no/no additional defaults
// if none exists.
log.V(util.DebugLevel).Info("could not retrieve IngressClass", "ingressclass", r.IngressClassName)
}
}
// if the object is not configured with our ingress.class, then we need to ensure it's removed from the cache
if !ctrlutils.MatchesIngressClass(obj, r.IngressClassName, ctrlutils.IsDefaultIngressClass(class)) {
Expand Down
126 changes: 72 additions & 54 deletions internal/controllers/configuration/zz_generated_controllers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.