Skip to content

Commit 6880900

Browse files
authored
fix: Handle other gatewayclasses gracefully (#156)
In v0.6.0 the controller panics when reconciling a gatewayclass that isn't one of ours. This adds a check similar to the one for the gateway reconciler to ensure we only reconcile if the controllerName matches the one we expect.
1 parent ef474e2 commit 6880900

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/controller/gatewayclass_controller.go

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ func (r *GatewayClassReconciler) Reconcile(ctx context.Context, req ctrl.Request
4949
return ctrl.Result{}, err
5050
}
5151

52+
// check if GatewayClass controllerName is ours
53+
if gatewayClass.Spec.ControllerName != controllerName {
54+
log.Info("Ignoring gatewayclass with non-matching controllerName")
55+
return ctrl.Result{}, nil
56+
}
57+
5258
// validate parameters
5359
var ok bool
5460
_, api, err := InitCloudflareApi(ctx, r.Client, gatewayClass.Name)

0 commit comments

Comments
 (0)