You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Gateway spec.service.type and spec.service.annotations are ignored #254
The README advertises Gateway Service configuration with ClusterIP, NodePort and LoadBalancer types (README.md L149), and the Gateway CRD exposes spec.service.type (enum ClusterIP, NodePort, LoadBalancer, ExternalName) and spec.service.annotations (api/v1alpha1/gateway_types.go L562-580). However, reconcileService in internal/controller/gateway_controller.go (L821-910) builds the Service from only selector and ports, never reads Spec.Service.Type or Spec.Service.Annotations, and its update path only compares ports and selector. Both fields have no effect. For example, the service.beta.kubernetes.io/aws-load-balancer-type: "nlb" annotation in config/samples/core_v1alpha1_gateway_hpa.yaml is never applied. Only spec.service.port is honored.
Steps to Reproduce
Create a namespace labeled inference-gateway.com/managed=true (required by the operator's default WATCH_NAMESPACE_SELECTOR).
Apply a Gateway in that namespace with spec.service.type: LoadBalancer and spec.service.annotations set to example.com/test: "true".
After reconciliation, run kubectl get service <gateway-name> -n <namespace> -o yaml.
Change spec.service.type to NodePort and inspect the Service again.
Expected Behavior
The Service has type: LoadBalancer (then NodePort after the change) and carries the example.com/test: "true" annotation, as described by the README Networking section and the CRD.
Actual Behavior
The operator creates the Service without a type or annotations, so the API server defaults it to ClusterIP and no annotations are set. Later changes to spec.service.type or spec.service.annotations never update the Service, because reconcileService only diffs ports and selector.
Desired Service now carries Spec.Type from spec.service.type (defaulting to ClusterIP) and metadata.annotations from spec.service.annotations.
The update path diffs type and annotations in addition to ports/selector, so later spec changes reach the live Service.
Two follow-on correctness bits that the naive fix would have broken: the API-server-assigned nodePorts are preserved while the type still exposes them (otherwise a NodePort/LoadBalancer Service would be rewritten on every reconcile), and the existing clusterIP is no longer copied when the type is ExternalName.
Annotations are authoritative on this operator-owned Service, matching the existing upstream Gateway/HTTPRoute reconciler at gateway_controller.go:1116 - removing a key from the spec removes it from the Service.
internal/controller/gateway_controller_test.go - new Gateway service configuration specs: type + annotations on create, the ClusterIP default when spec.service is nil, type/annotation updates (including removal of a stale key), and nodePort preservation.
Only internal/controller changed - no CRD/API edits, so no task generate/task manifests output to commit.
Verification caveat
task and the envtest/Ginkgo binaries are not available in this runner, so I could not run task test or task lint. I ran go vet ./internal/controller/ ./api/... (clean) and exercised the exact reconcileService paths through the fake client in a throwaway standalone test, which passed for all four behaviors above before I removed it in favour of the Ginkgo specs. CI should run the real suite.
Activity
edenreich commentedon Sep 25, 2026
@claude can you work on this?
inference-gateway-maintainer commentedon Sep 25, 2026
Claude finished @edenreich's task in 9m 17s —— View job •
fix/issue-254-20260925-2214• [Create PR ➔](https://github.com/inference-gateway/operator/compare/main...fix/issue-254-20260925-2214?quick_pull=1&title=Issue%20%23254%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23254%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)Done - PR opened
reconcileServiceandServiceSpecspec.service.type+spec.service.annotationsto the Servicego vet, logic exercised against the fake client)What changed
internal/controller/gateway_controller.go-reconcileService:Spec.Typefromspec.service.type(defaulting toClusterIP) andmetadata.annotationsfromspec.service.annotations.nodePorts are preserved while the type still exposes them (otherwise a NodePort/LoadBalancer Service would be rewritten on every reconcile), and the existingclusterIPis no longer copied when the type isExternalName.Annotations are authoritative on this operator-owned Service, matching the existing upstream Gateway/HTTPRoute reconciler at
gateway_controller.go:1116- removing a key from the spec removes it from the Service.internal/controller/gateway_controller_test.go- newGateway service configurationspecs: type + annotations on create, the ClusterIP default whenspec.serviceis nil, type/annotation updates (including removal of a stale key), and nodePort preservation.Only
internal/controllerchanged - no CRD/API edits, so notask generate/task manifestsoutput to commit.Verification caveat
taskand the envtest/Ginkgo binaries are not available in this runner, so I could not runtask testortask lint. I rango vet ./internal/controller/ ./api/...(clean) and exercised the exactreconcileServicepaths through the fake client in a throwaway standalone test, which passed for all four behaviors above before I removed it in favour of the Ginkgo specs. CI should run the real suite.Also filed inference-gateway/docs#791 so the docs note these fields actually work and from which operator version.
| Branch
inference-gateway-releaser commentedon Oct 3, 2026
🎉 This issue has been resolved in version 0.27.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀