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

Remove Ingress API selection code #4643

Merged
merged 2 commits into from
Sep 12, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ Adding a new version? You'll need three changes:
`/status` from Kong Gateway.
This happens when Gateway is responding with a 50x HTTP status code.
[#4627](https://github.com/Kong/kubernetes-ingress-controller/issues/4627)
- Ensure the API server is available at startup and do not disable CRD
controllers if Kong CRDs are unavailable. Do not disable the Ingress
controller if the Ingress API is unavailable. This avoids incorrectly
deleting existing configuration during an API server restart.
[#4641](https://github.com/Kong/kubernetes-ingress-controller/issues/4641)
[#4643](https://github.com/Kong/kubernetes-ingress-controller/issues/4643)

## [2.11.1]

Expand Down
66 changes: 0 additions & 66 deletions internal/manager/conditions.go

This file was deleted.

81 changes: 0 additions & 81 deletions internal/manager/conditions_test.go

This file was deleted.

17 changes: 4 additions & 13 deletions internal/manager/controllerdef.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package manager

import (
"context"
"fmt"
"reflect"

"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -67,15 +66,7 @@ func setupControllers(
featureGates map[string]bool,
kongAdminAPIEndpointsNotifier configuration.EndpointsNotifier,
adminAPIsDiscoverer configuration.AdminAPIsDiscoverer,
) ([]ControllerDef, error) {
restMapper := mgr.GetClient().RESTMapper()

// Choose the best API version of Ingress to inform which ingress controller to enable.
ingressConditions, err := NewIngressControllersConditions(c, restMapper)
if err != nil {
return nil, fmt.Errorf("ingress version picker failed: %w", err)
}

) []ControllerDef {
referenceIndexers := ctrlref.NewCacheIndexers()

controllers := []ControllerDef{
Expand All @@ -97,7 +88,7 @@ func setupControllers(
// Core API Controllers
// ---------------------------------------------------------------------------
{
Enabled: ingressConditions.IngressClassNetV1Enabled(),
Enabled: c.IngressClassNetV1Enabled,
Controller: &configuration.NetV1IngressClassReconciler{
Client: mgr.GetClient(),
Log: ctrl.LoggerFrom(ctx).WithName("controllers").WithName("IngressClass").WithName("netv1"),
Expand All @@ -107,7 +98,7 @@ func setupControllers(
},
},
{
Enabled: ingressConditions.IngressNetV1Enabled(),
Enabled: c.IngressNetV1Enabled,
Controller: &configuration.NetV1IngressReconciler{
Client: mgr.GetClient(),
Log: ctrl.LoggerFrom(ctx).WithName("controllers").WithName("Ingress").WithName("netv1"),
Expand Down Expand Up @@ -445,7 +436,7 @@ func setupControllers(
},
}

return controllers, nil
return controllers
}

// baseGatewayCRDs returns a slice of base CRDs required for running all the Gateway API controllers.
Expand Down
5 changes: 1 addition & 4 deletions internal/manager/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func Run(ctx context.Context, c *Config, diagnostic util.ConfigDumpDiagnostic, d
}

setupLog.Info("Starting Enabled Controllers")
controllers, err := setupControllers(
controllers := setupControllers(
ctx,
mgr,
dataplaneClient,
Expand All @@ -235,9 +235,6 @@ func Run(ctx context.Context, c *Config, diagnostic util.ConfigDumpDiagnostic, d
clientsManager,
adminAPIsDiscoverer,
)
if err != nil {
return fmt.Errorf("unable to setup controller as expected %w", err)
}
for _, c := range controllers {
if err := c.MaybeSetupWithManager(mgr); err != nil {
return fmt.Errorf("unable to create controller %q: %w", c.Name(), err)
Expand Down