Skip to content

Conversation

@vorbidan
Copy link

@vorbidan vorbidan commented Nov 14, 2025

Changes proposed in this PR

Add early return check in gateway controller Reconcile method to skip
gateways that don't belong to the consul controller. This prevents the
controller from processing and potentially deleting resources for
gateways managed by other gateway controllers in multi-controller
environments.

The fix checks the GatewayClass.Spec.ControllerName against the consul
controller name (consul.hashicorp.com/gateway-controller) and returns
early if there's no match or if the GatewayClass is missing.

This follows the same pattern already used in the GatewayClass controller
and prevents unauthorized resource deletion that could occur when multiple
gateway controllers are deployed in the same cluster.

Fixes: Gateway controller reconciliation of non-consul gateways

Addresses Issue #4894

How I've tested this PR

Added comprehensive unit tests (TestGatewayControllerReconcile) to validate:

  • Gateways with non-consul GatewayClasses return early without processing
  • Gateways with missing GatewayClasses return early without processing
  • Gateways with consul GatewayClasses continue past the early return check

Locally built a docker image, deployed consul to k8s cluster via Helm chart to validate functionality

How I expect reviewers to test this PR

Run unit tests, build image locally, deploy to k8s with helm chart.

Checklist

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@vorbidan vorbidan requested a review from a team as a code owner November 14, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant