fix(scheme): register Istio and Gateway API source types#301
Merged
Conversation
The SourceReconciler resolvers list external API types (Istio Gateway / VirtualService, Gateway API HTTP/GRPC/TCP/TLS/UDP routes), but the manager scheme only registered client-go, external-dns and sreportal types. When a DNS CR enabled e.g. the istio-gateway source, the per-DNS source cycle failed client-side: source.cycle list failed; preserving previous state err: no kind is registered for the type v1.GatewayList in scheme ... Register the Istio networking/v1 and Gateway API v1 / v1alpha2 schemes in init(). Crossplane records use unstructured and need no registration; if a source's CRD is absent from the cluster the cycle already treats the List as benign. Adds a cmd test asserting the scheme recognizes every external resolver's list type, guarding against future source additions missing registration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On dev the SourceReconciler looped on:
The source resolvers list external API types (Istio
Gateway/VirtualService, Gateway APIHTTP/GRPC/TCP/TLS/UDPRoute), but the manager scheme only registered client-go, external-dns and sreportal types. As soon as a DNS CR enabled one of those sources (hereistio-gateway, from the legacy config), the per-DNS source cycle failed client-side.Fix
Register the missing schemes in
cmd/main.goinit():istio.io/client-go/pkg/apis/networking/v1(Gateway, VirtualService) —AddToSchemesigs.k8s.io/gateway-api/apis/v1(HTTPRoute, GRPCRoute) —Installsigs.k8s.io/gateway-api/apis/v1alpha2(TCP/TLS/UDPRoute) —InstallCrossplane records use
unstructured(no registration needed);service/ingress/dnsendpointwere already covered by client-go / external-dns. If a source's CRD is absent from the cluster, the source cycle already treats the List as benign.Adds
cmd/scheme_test.goasserting the scheme recognizes every external resolver's list type, so a future source addition that forgets registration fails the test.Notes
+kubebuilder:rbacmarkers fornetworking.istio.ioandgateway.networking.k8s.ioalready exist on the resolvers and inconfig/rbac/role.yaml(make manifests→ no diff).Test plan
cmd/scheme_test.gopasses (scheme recognizes all 7 external list types)go vet ./cmd/...,golangci-lintclean (Install used; AddToScheme-deprecation avoided)🤖 Generated with Claude Code