feat(k8s): Support for GRPCRoute

This commit is contained in:
Contre
2026-05-18 14:48:01 +02:00
parent 419da20681
commit 2769725775
2 changed files with 24 additions and 0 deletions
+5
View File
@@ -58,6 +58,11 @@ var watchedGVRs = []schema.GroupVersionResource{
Version: "v1",
Resource: "httproutes",
},
{
Group: "gateway.networking.k8s.io",
Version: "v1",
Resource: "grpcroutes",
},
}
func NewKubernetesService(
@@ -194,6 +194,25 @@ func TestKubernetesService(t *testing.T) {
assert.Nil(t, got)
},
},
{
description: "UpdateFromItem parses annotations and populates cache from grpcroute",
run: func(t *testing.T, svc *KubernetesService) {
item := unstructured.Unstructured{}
item.SetNamespace("default")
item.SetName("test-grpcroute")
item.SetAnnotations(map[string]string{
"tinyauth.apps.grpcapp.config.domain": "grpcapp.example.com",
"tinyauth.apps.grpcapp.users.allow": "carol",
})
svc.updateFromItem(&item)
got := svc.getByDomain("grpcapp.example.com")
require.NotNil(t, got)
assert.Equal(t, "grpcapp.example.com", got.Config.Domain)
assert.Equal(t, "carol", got.Users.Allow)
},
},
{
description: "Ingress and HTTPRoute apps coexist in cache",
run: func(t *testing.T, svc *KubernetesService) {