diff --git a/controller/dataplane/bluegreen_controller.go b/controller/dataplane/bluegreen_controller.go index 8c654c995..6091dabc5 100644 --- a/controller/dataplane/bluegreen_controller.go +++ b/controller/dataplane/bluegreen_controller.go @@ -63,6 +63,8 @@ type BlueGreenReconciler struct { ContextInjector ctxinjector.CtxInjector DefaultImage string + + KonnectEnabled bool } // SetupWithManager sets up the controller with the Manager. @@ -135,6 +137,20 @@ func (r *BlueGreenReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( // DataPlane is ready and we can proceed with deploying preview resources. + // customize the dataplane with the extensions field + log.Trace(logger, "applying extensions") + patched, requeue, err := applyExtensions(ctx, r.Client, logger, &dataplane, r.KonnectEnabled) + if err != nil { + if !requeue { + log.Debug(logger, "failed to apply extensions", "err", err) + return ctrl.Result{}, nil + } + return ctrl.Result{}, err + } + if patched { + return ctrl.Result{}, nil + } + // Ensure "preview" Admin API service. res, dataplaneAdminService, err := r.ensurePreviewAdminAPIService(ctx, logger, &dataplane) if err != nil { diff --git a/modules/manager/controller_setup.go b/modules/manager/controller_setup.go index ad381309e..10b33ed2c 100644 --- a/modules/manager/controller_setup.go +++ b/modules/manager/controller_setup.go @@ -450,7 +450,8 @@ func SetupControllers(mgr manager.Manager, c *Config) (map[string]ControllerDef, BeforeDeployment: dataplane.CreateCallbackManager(), AfterDeployment: dataplane.CreateCallbackManager(), }, - DefaultImage: consts.DefaultDataPlaneImage, + DefaultImage: consts.DefaultDataPlaneImage, + KonnectEnabled: c.KonnectControllersEnabled, }, }, DataPlaneOwnedServiceFinalizerControllerName: {