Skip to content

Commit

Permalink
fix: konnectExtension with bg enabled (#910)
Browse files Browse the repository at this point in the history
* fix: konnectExtension with bg enabled

This commit fixes a bug related to KonnectExtensions for DataPlane
configured with BlueGreen. In such configurations, the preview
deployment was not customized with the Konnect-related field.
Both the live and preview deployments are now properly customized with
konnect fields.

Signed-off-by: Mattia Lavacca <[email protected]>

* chore: add CHANGELOG entry

Signed-off-by: Mattia Lavacca <[email protected]>

---------

Signed-off-by: Mattia Lavacca <[email protected]>
  • Loading branch information
mlavacca authored Dec 20, 2024
1 parent f786d6b commit eaa360c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
anymore - default is set to `konghq.com`.
[#947](https://github.com/Kong/gateway-operator/pull/947)

### Fixes

- Fix `DataPlane`s with `KonnectExtension` and `BlueGreen` settings. Both the Live
and preview deployments are now customized with Konnect-related settings.
[#910](https://github.com/Kong/gateway-operator/pull/910)

## [v1.4.1]

> Release date: 2024-11-28
Expand Down
16 changes: 16 additions & 0 deletions controller/dataplane/bluegreen_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ type BlueGreenReconciler struct {
ContextInjector ctxinjector.CtxInjector

DefaultImage string

KonnectEnabled bool
}

// SetupWithManager sets up the controller with the Manager.
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion modules/manager/controller_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit eaa360c

Please sign in to comment.