Skip to content
7 changes: 7 additions & 0 deletions internal/provider/kubernetes/controller_offline.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,23 @@ func newOfflineGatewayAPIClient(extensionPolicies []schema.GroupVersionKind) cli
WithScheme(scheme).
WithIndex(&gwapiv1.Gateway{}, classGatewayIndex, gatewayIndexFunc).
WithIndex(&gwapiv1.Gateway{}, secretGatewayIndex, secretGatewayIndexFunc).
WithIndex(&gwapiv1.ListenerSet{}, gatewayListenerSetIndex, gatewayListenerSetIndexFunc).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Store ListenerSets for the file provider

This registers the fake-client index, but in standalone/File mode the objects still never reach that client: user YAML is loaded via loadKubernetesYAMLToResources and persisted via resourcesStore.storeResources, and neither path handles resource.Resources.ListenerSets (I checked internal/provider/file for ListenerSets). With a file containing a ListenerSet, processListenerSets will therefore still list an empty ListenerSetList, so routes/policies attached through the ListenerSet remain non-functional even though the index exists.

Useful? React with 👍 / 👎.

WithIndex(&gwapiv1.HTTPRoute{}, gatewayHTTPRouteIndex, gatewayHTTPRouteIndexFunc).
WithIndex(&gwapiv1.HTTPRoute{}, backendHTTPRouteIndex, backendHTTPRouteIndexFunc).
WithIndex(&gwapiv1.HTTPRoute{}, listenerSetHTTPRouteIndex, listenerSetHTTPRouteIndexFunc).
WithIndex(&gwapiv1.HTTPRoute{}, httpRouteFilterHTTPRouteIndex, httpRouteFilterHTTPRouteIndexFunc).
WithIndex(&gwapiv1.GRPCRoute{}, gatewayGRPCRouteIndex, gatewayGRPCRouteIndexFunc).
WithIndex(&gwapiv1.GRPCRoute{}, backendGRPCRouteIndex, backendGRPCRouteIndexFunc).
WithIndex(&gwapiv1.GRPCRoute{}, listenerSetGRPCRouteIndex, listenerSetGRPCRouteIndexFunc).
WithIndex(&gwapiv1a2.TCPRoute{}, gatewayTCPRouteIndex, gatewayTCPRouteIndexFunc).
WithIndex(&gwapiv1a2.TCPRoute{}, backendTCPRouteIndex, backendTCPRouteIndexFunc).
WithIndex(&gwapiv1a2.TCPRoute{}, listenerSetTCPRouteIndex, listenerSetTCPRouteIndexFunc).
WithIndex(&gwapiv1a2.UDPRoute{}, gatewayUDPRouteIndex, gatewayUDPRouteIndexFunc).
WithIndex(&gwapiv1a2.UDPRoute{}, backendUDPRouteIndex, backendUDPRouteIndexFunc).
WithIndex(&gwapiv1a2.UDPRoute{}, listenerSetUDPRouteIndex, listenerSetUDPRouteIndexFunc).
WithIndex(&gwapiv1.TLSRoute{}, gatewayTLSRouteIndex, gatewayTLSRouteIndexFunc).
WithIndex(&gwapiv1.TLSRoute{}, backendTLSRouteIndex, backendTLSRouteIndexFunc).
WithIndex(&gwapiv1.TLSRoute{}, listenerSetTLSRouteIndex, listenerSetTLSRouteIndexFunc).
WithIndex(&egv1a1.EnvoyProxy{}, backendEnvoyProxyTelemetryIndex, backendEnvoyProxyTelemetryIndexFunc).
WithIndex(&egv1a1.EnvoyProxy{}, secretEnvoyProxyIndex, secretEnvoyProxyIndexFunc).
WithIndex(&egv1a1.BackendTrafficPolicy{}, configMapBtpIndex, configMapBtpIndexFunc).
Expand All @@ -182,6 +188,7 @@ func newOfflineGatewayAPIClient(extensionPolicies []schema.GroupVersionKind) cli
WithIndex(&egv1a1.EnvoyExtensionPolicy{}, backendEnvoyExtensionPolicyIndex, backendEnvoyExtensionPolicyIndexFunc).
WithIndex(&egv1a1.EnvoyExtensionPolicy{}, secretEnvoyExtensionPolicyIndex, secretEnvoyExtensionPolicyIndexFunc).
WithIndex(&egv1a1.EnvoyExtensionPolicy{}, configMapEepIndex, configMapEepIndexFunc).
WithIndex(&egv1a1.EnvoyExtensionPolicy{}, clusterTrustBundleEepIndex, clusterTrustBundleEepIndexFunc).
WithIndex(&gwapiv1.BackendTLSPolicy{}, configMapBtlsIndex, configMapBtlsIndexFunc).
WithIndex(&gwapiv1.BackendTLSPolicy{}, secretBtlsIndex, secretBtlsIndexFunc).
WithIndex(&gwapiv1.BackendTLSPolicy{}, clusterTrustBundleBtlsIndex, clusterTrustBundleBtlsIndexFunc).
Expand Down
17 changes: 17 additions & 0 deletions internal/provider/kubernetes/controller_offline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,18 @@ func TestNewOfflineGatewayAPIControllerIndexRegistration(t *testing.T) {
require.NoError(t, err)
})

t.Run("ListenerSet index", func(t *testing.T) {
err := cli.List(context.Background(), &gwapiv1.ListenerSetList{}, client.MatchingFields{gatewayListenerSetIndex: "any"})
require.NoError(t, err)
})

t.Run("HTTPRoute indices", func(t *testing.T) {
err := cli.List(context.Background(), &gwapiv1.HTTPRouteList{}, client.MatchingFields{gatewayHTTPRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1.HTTPRouteList{}, client.MatchingFields{backendHTTPRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1.HTTPRouteList{}, client.MatchingFields{listenerSetHTTPRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1.HTTPRouteList{}, client.MatchingFields{httpRouteFilterHTTPRouteIndex: "any"})
require.NoError(t, err)
})
Expand All @@ -155,27 +162,35 @@ func TestNewOfflineGatewayAPIControllerIndexRegistration(t *testing.T) {
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1.GRPCRouteList{}, client.MatchingFields{backendGRPCRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1.GRPCRouteList{}, client.MatchingFields{listenerSetGRPCRouteIndex: "any"})
require.NoError(t, err)
})

t.Run("TCPRoute indices", func(t *testing.T) {
err := cli.List(context.Background(), &gwapiv1a2.TCPRouteList{}, client.MatchingFields{gatewayTCPRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1a2.TCPRouteList{}, client.MatchingFields{backendTCPRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1a2.TCPRouteList{}, client.MatchingFields{listenerSetTCPRouteIndex: "any"})
require.NoError(t, err)
})

t.Run("UDPRoute indices", func(t *testing.T) {
err := cli.List(context.Background(), &gwapiv1a2.UDPRouteList{}, client.MatchingFields{gatewayUDPRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1a2.UDPRouteList{}, client.MatchingFields{backendUDPRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1a2.UDPRouteList{}, client.MatchingFields{listenerSetUDPRouteIndex: "any"})
require.NoError(t, err)
})

t.Run("TLSRoute indices", func(t *testing.T) {
err := cli.List(context.Background(), &gwapiv1.TLSRouteList{}, client.MatchingFields{gatewayTLSRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1.TLSRouteList{}, client.MatchingFields{backendTLSRouteIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &gwapiv1.TLSRouteList{}, client.MatchingFields{listenerSetTLSRouteIndex: "any"})
require.NoError(t, err)
})

t.Run("EnvoyProxy indices", func(t *testing.T) {
Expand Down Expand Up @@ -215,6 +230,8 @@ func TestNewOfflineGatewayAPIControllerIndexRegistration(t *testing.T) {
require.NoError(t, err)
err = cli.List(context.Background(), &egv1a1.EnvoyExtensionPolicyList{}, client.MatchingFields{configMapEepIndex: "any"})
require.NoError(t, err)
err = cli.List(context.Background(), &egv1a1.EnvoyExtensionPolicyList{}, client.MatchingFields{clusterTrustBundleEepIndex: "any"})
require.NoError(t, err)
})

t.Run("BackendTLSPolicy indices", func(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the standalone offline controller used by the File provider to register the missing ListenerSet, ListenerSet-owned route, and ClusterTrustBundle EnvoyExtensionPolicy indexes so reconciliation no longer fails with unregistered index errors.