[Proposal] Kubernetes Gateway API (Gateway + HTTPRoute) support in Gateway Operator #1665
CrowleyRajapakse
started this conversation in
Ideas
Replies: 1 comment
-
|
Are you saying operator will watch both K8s Gateway API specs as well as API Platform CRs? Downside of it is that when we hit kubectl get gateways, what is the output? Is it Gateway API spec related CRs or API Platform related CRs? I think we can introduce a mode to define this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
The gateway-operator need to reconcile standard Kubernetes Gateway API resources (
gateway.networking.k8s.ioGateway and HTTPRoute) alongside the existingAPIGatewayandRestApiCRDs.APIGateway— deploy the platform gateway via Helm, discover the gateway-controller Service, register it in the in-memory GatewayRegistry (no dependency on anAPIGatewayCR for this path).RestApi— build anapi.yaml-compatible payload (APIConfigData) and call gateway-controller REST (POST/PUT/rest-apis,DELETE/rest-apis/{handle}).Problem statement
Teams adopting Gateway API as the cluster-native way to declare gateways and HTTP routes needed a first-class path to drive the API Platform gateway without requiring
APIGateway/RestApiCRDs for the same flow. The operator previously only reconciled WSO2 custom resources; there was no bridge fromGateway+HTTPRouteto the existing gateway-controller deployment and API lifecycle.Who is this for?
Servicereferences expressed asHTTPRoutewhile reusing the same gateway runtime and controller APIs.APIGatewaywho want parity for Gateway API–native manifests.Why does this matter?
GatewayClass,Gateway,HTTPRoute) without giving up platform features (policies, xDS, gateway-controller REST).Use cases
GatewaywhosegatewayClassNameis on the operator allowlist; optional per-Gateway Helm values via ConfigMap annotation.HTTPRoutewithparentRefs→ yourGateway;backendRefs→Service; operator builds and deploysRestApi–equivalent YAML to gateway-controller.Service; relevantHTTPRoutes re-queue when backend Services change.HTTPRoute; finalizer removes the REST API handle from gateway-controller.Goals (technical)
APIGateway— deploy the platform gateway via Helm, discover the gateway-controller Service, register it in GatewayRegistry.RestApi— buildAPIConfigDataand sync over gateway-controller REST.HTTPRoutecontrollers re-queue routes when referenced backend Services change.Prerequisites (cluster and install)
Gateway API CRDs
The operator Helm chart ships Gateway API standard channel v1.3.0 YAML under
files/gateway-api-standard/and only applies them whengatewayApi.installStandardCRDsistrue(templates/gateway-api-crds.yaml). The default isfalsebecause many clusters already have Gateway API (or a prior Helm release managed the same CRDs); installing again causes server-side apply conflicts on fields such asmetadata.annotations.gateway.networking.k8s.io/bundle-versionandspec.versions. The WSO2 CRDs (APIGateway,RestApi) remain incrds/and are always installed with the chart.gatewayApi.installStandardCRDs=true(exact flag depends on yourhelm install/ values).*crd*release inkube-system): keepinstallStandardCRDs=false. Turning it on can fail with cannot be imported into the current release / invalid ownership metadata because Helm will not adopt CRDs from another release.falseand use the cluster’s existing Gateway API version (ensure it is compatible with the operator’ssigs.k8s.io/gateway-apidependency ingo.mod).gatewayclasses,gateways,httproutes,referencegrants,grpcroutes(GRPCRoute is not reconciled by the operator today).files/gateway-api-standard/from a newer upstreamstandard-install.yamland bump the operatorgo.moddependency to match.Create a GatewayClass whose
metadata.namematches operator configuration (default managed class:wso2-api-platform).Configuration
gateway_api.gateway_class_namesin operatorconfig.yamlspec.gatewayClassNamevalues the operator owns. The operator Helm chart writes this fromgatewayApi.managedGatewayClassNamesinvalues.yaml.wso2-api-platformwhen the key is absent after config merge (internal/config/config.go).GATEWAY_API_GATEWAY_CLASS_NAMESResolution:
OperatorConfig.ManagedGatewayClass(name string)returns whether a class is managed.Only Gateway objects whose
spec.gatewayClassNameis in this list are managed. HTTPRoute objects are processed when their parent Gateway uses one of these classes.Example
config.yamlfragment:Environment variable example:
GATEWAY_API_GATEWAY_CLASS_NAMES=wso2-api-platform,my-classHelm / registry for Kubernetes
Gatewayuses the samegateway.*Helm settings asAPIGateway(internal/config→GatewayConfig: chart name, version, values file, registry credentials, etc.).Annotations
Gateway(gateway.networking.k8s.io)gateway.api-platform.wso2.com/helm-values-configmapvalues.yaml(Helm values), analogous toAPIGateway.spec.configRef.gateway.api-platform.wso2.com/api-selectorAPISelector(same shape as onAPIGateway) — whichRestApiCRs logically associate with this deployment.gateway.api-platform.wso2.com/control-plane-hostGatewayInfo.ControlPlaneHostin the registry.If the Helm values ConfigMap annotation is omitted, the operator uses the default Helm values file from config (same pattern as
APIGatewaywithoutconfigRef).HTTPRoutegateway.api-platform.wso2.com/api-versionAPIConfigData.Version(defaultv1).gateway.api-platform.wso2.com/contextgateway.api-platform.wso2.com/display-namemetadata.name).gateway.api-platform.wso2.com/api-handle/rest-apis/{handle}(default:{namespace}-{name}with/stripped).Reconciler behaviour
Kubernetes
Gatewayspec.gatewayClassNameis not in the managed list.gateway.api-platform.wso2.com/k8s-gateway-finalizer.helmgateway.InstallOrUpgrade(release name{metadata.name}-gateway, same pattern asAPIGateway).registerGatewayInRegistry(discovery by labelsapp.kubernetes.io/instance+component=controller).evaluateGatewayDeploymentsReady); requeue on failure.Gateway.status.conditions:AcceptedandProgrammed(Gateway API condition types).registry.Unregister,helmgateway.Uninstall, remove finalizer.HTTPRouteGatewayfromspec.parentRefs(KindGateway,Groupgateway.networking.k8s.ioor unset / default handling as implemented).gateway.api-platform.wso2.com/httproute-finalizer.namespace/name(not label-basedRestApimatching).APIConfigData→ YAML viagatewayclient.BuildRestAPIYAML(apiVersiongateway.api-platform.wso2.com/v1alpha1,KindRestApi).GetAuthSettingsForRegistryGateway(Helm values ConfigMap onGatewayInfoif set, elseAPIGatewayCR with same name if present).RestAPIExists+DeployRestAPI; updatestatus.parentswithControllerNamegateway.api-platform.wso2.com/gateway-operator.HTTPRoute deployed to gateway(includes handle and endpoint, as implemented).DeleteRestAPIfor the handle, then remove finalizer.Service watch
The
HTTPRoutecontroller watches Services. On create/update/delete, it lists allHTTPRoutes and enqueues those whose backendRefs reference that Service (namespace + name).RBAC
ClusterRole rules include
gateway.networking.k8s.iogateways and httproutes (including status and finalizers). Core services are required for backend resolution and the Service watch (config/rbac/role.yaml).Coexistence and naming
namespace/nameof the logical gateway CR (APIGatewayname or KubernetesGatewayname — not the Helm release name).APIGatewayand a KubernetesGatewaywith the samemetadata.nameandmetadata.namespaceshare the same registry slot — avoid duplicate names if both models are used in one namespace.MVP limitations
backendRefdrivesupstream.main.url).APIConfigDataare out of scope unless extended.Main code layout
cmd/main.go(gatewayv1.AddToScheme)Gatewayreconcilerinternal/controller/k8s_gateway_controller.goHTTPRoutereconcilerinternal/controller/httproute_controller.gointernal/controller/httproute_enqueue.goAPIConfigDatamappinginternal/controller/httproute_mapper.gointernal/controller/gateway_api_annotations.gointernal/helmgateway/deploy.gointernal/controller/gateway_infra.gointernal/gatewayclient/HelmValuesConfigMapName,FromGatewayAPI)internal/registry/gateway_registry.goAPIGatewayinternal/auth/auth_helper.go(GetAuthSettingsForRegistryGateway,GetDeploymentAuthFromConfigMap)RestApipath (shared client)internal/controller/restapi_controller.goBeta Was this translation helpful? Give feedback.
All reactions