mirror of
https://github.com/tinyauthapp/tinyauth.git
synced 2026-09-25 04:03:32 +08:00
feat(k8s): Support for GRPCRoute
This commit is contained in:
@@ -58,6 +58,11 @@ var watchedGVRs = []schema.GroupVersionResource{
|
|||||||
Version: "v1",
|
Version: "v1",
|
||||||
Resource: "httproutes",
|
Resource: "httproutes",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Group: "gateway.networking.k8s.io",
|
||||||
|
Version: "v1",
|
||||||
|
Resource: "grpcroutes",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewKubernetesService(
|
func NewKubernetesService(
|
||||||
|
|||||||
@@ -194,6 +194,25 @@ func TestKubernetesService(t *testing.T) {
|
|||||||
assert.Nil(t, got)
|
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",
|
description: "Ingress and HTTPRoute apps coexist in cache",
|
||||||
run: func(t *testing.T, svc *KubernetesService) {
|
run: func(t *testing.T, svc *KubernetesService) {
|
||||||
|
|||||||
Reference in New Issue
Block a user