Skip to content

PMREQ-821: Add Gateway API support to Manager controller - #5032

Open
vara2504 wants to merge 1 commit into
tigera:masterfrom
vara2504:vara-PMREQ-821-cig-manager
Open

PMREQ-821: Add Gateway API support to Manager controller#5032
vara2504 wants to merge 1 commit into
tigera:masterfrom
vara2504:vara-PMREQ-821-cig-manager

Conversation

@vara2504

@vara2504 vara2504 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

New feature (PMREQ-821): adds spec.gateway to the Manager CR, exposing the Manager UI through Calico Ingress Gateway (CIG).

Design: https://github.com/tigera/designs/pull/73

  • New shared GatewaySpec type (api/v1/gateway_types.go) with hostname, gatewayNamespace, and gatewayClassName — reusable by Whisker later.
  • Shared render package pkg/render/gateway producing Gateway, HTTPRoute, Backend (Envoy Gateway), ReferenceGrant, and TLS Secret. Proxy SA/RoleBinding/NetworkPolicy are rendered only when the Gateway runs in the backend namespace; custom namespaces are left to the GatewayAPI controller, matching user-brought Gateways.
  • Manager controller: resolves the GatewayClass from the GatewayAPI CR, validates the hostname against Authentication.spec.managerDomain (scheme/port ignored), provisions a TLS keypair (persisted in the truth namespace), and provisions custom gateway namespaces.
  • Health: Gateway/HTTPRoute status conditions are read back; unhealthy conditions set Degraded and requeue until Envoy converges. Status transitions are watched directly.
  • Cleanup is label-driven (operator.tigera.io/gateway): removing spec.gateway or moving namespaces tears down exactly the leftover resources, with no stored state.
  • Multi-tenant clusters reject spec.gateway with InvalidConfigurationError.

Components affected: Manager controller, new pkg/render/gateway package, Manager CRD.

Companion PRs:

  • tigera/calico-private#12689 — operator ClusterRole RBAC (gateways, httproutes, referencegrants, backends).
  • Managers CRD with spec.gateway must reach calico-private manifests (pending; API servers prune the field until then).

Testing:

  • Render unit tests (pkg/render/gateway/component_test.go)
  • Controller unit tests (multi-tenant guard, gateway health, managerDomainHost)
  • E2E: Manager accessible via CIG with HTTPS
  • E2E: Degraded when GatewayAPI CR is missing / OIDC hostname mismatch

Manual OIDC testing:

Screenshot from 2026-07-28 17-18-13

Release Note

Add spec.gateway field to Manager CR enabling Calico Ingress Gateway access to the Manager UI.

For PR author

  • Tests for change.
  • If changing pkg/apis/, run make gen-files
  • If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

@marvin-tigera marvin-tigera added this to the v1.44.0 milestone Jul 13, 2026
@vara2504
vara2504 force-pushed the vara-PMREQ-821-cig-manager branch 4 times, most recently from a64f333 to 4391647 Compare July 28, 2026 20:50
@vara2504
vara2504 force-pushed the vara-PMREQ-821-cig-manager branch 2 times, most recently from 5e30953 to d7953bf Compare July 30, 2026 17:35
Add spec.gateway to the Manager CR. When set (and a GatewayAPI CR
exists), the manager controller renders Gateway API resources to expose
the Manager UI through CIG: an HTTPS Gateway with TLS termination and
an operator-provisioned certificate, an HTTPRoute, an Envoy Gateway
Backend that re-originates TLS to calico-manager:9443 trusting
tigera-ca-bundle, and — for a custom gateway namespace — a
ReferenceGrant. A shared pkg/render/gateway package carries the
rendering so Whisker can reuse it.

Namespace handling: the gateway namespace is user-configurable and
created on demand (never deleted — it may hold user workloads). In
calico-system the component also renders the proxy ServiceAccount,
RoleBinding, and a NetworkPolicy covering the default-deny (ingress on
the remapped port 10443, egress to the Gateway controller and Manager).
In a custom namespace those are left to the GatewayAPI controller's
per-namespace machinery, matching user-brought Gateways; the TLS secret
is rendered after the Gateway because the operator only gains secret
access there once the GatewayAPI controller sees the Gateway.

Cleanup is label-driven: the Gateway carries an
operator.tigera.io/gateway label, and each reconcile tears down any
labeled Gateway's namespace that no longer matches the spec — covering
namespace changes and spec.gateway removal without stored state. On a
namespace move the Backend is kept (the new render still routes through
it) and the ReferenceGrant is deleted only when moving into the backend
namespace.

Status follows the design: gateway validation failures (GatewayAPI CR
missing, unresolvable class, hostname/managerDomain mismatch) and
unhealthy Gateway/HTTPRoute conditions set Degraded and requeue every
30s until Envoy converges; deployed resources are never torn down. The
Gateway/HTTPRoute watch uses a name-matching predicate that accepts
status-only events, and the gateway TLS secret is watched across
namespaces with its truth copy persisted via the CertificateManagement
component so the certificate is minted once, not per reconcile.

spec.gateway on a multi-tenant tenant Manager sets
Degraded(InvalidConfigurationError): resource names and the cleanup
label carry no tenant identity, so multi-tenant support needs its own
design.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vara2504
vara2504 force-pushed the vara-PMREQ-821-cig-manager branch from d7953bf to 8794908 Compare July 30, 2026 18:39
@vara2504
vara2504 marked this pull request as ready for review July 30, 2026 18:48
@vara2504
vara2504 requested review from a team and marvin-tigera as code owners July 30, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants