From 6b45a4e8cb09c8e7113c7be227a5518dac4bb938 Mon Sep 17 00:00:00 2001 From: Daneyon Hansen Date: Tue, 15 Jun 2021 11:39:30 -0700 Subject: [PATCH] Adds Update Verb to Gateway RBAC Signed-off-by: Daneyon Hansen --- examples/contour/02-role-contour.yaml | 10 +++++++++- examples/gateway/02-gateway.yaml | 4 ++-- examples/render/contour-gateway.yaml | 10 +++++++++- examples/render/contour.yaml | 10 +++++++++- internal/k8s/informers.go | 3 ++- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/examples/contour/02-role-contour.yaml b/examples/contour/02-role-contour.yaml index b12fca0533d..41c3a2bc3bc 100644 --- a/examples/contour/02-role-contour.yaml +++ b/examples/contour/02-role-contour.yaml @@ -84,7 +84,6 @@ rules: resources: - backendpolicies - gatewayclasses - - gateways - httproutes - tcproutes - tlsroutes @@ -105,6 +104,15 @@ rules: - udproutes/status verbs: - update +- apiGroups: + - networking.x-k8s.io + resources: + - gateways + verbs: + - get + - list + - update + - watch - apiGroups: - projectcontour.io resources: diff --git a/examples/gateway/02-gateway.yaml b/examples/gateway/02-gateway.yaml index 3338ba4248b..83bfe796576 100644 --- a/examples/gateway/02-gateway.yaml +++ b/examples/gateway/02-gateway.yaml @@ -4,7 +4,7 @@ metadata: name: contour namespace: projectcontour spec: - gatewayClassName: example + gatewayClassName: contour-class listeners: - protocol: HTTP port: 80 @@ -12,4 +12,4 @@ spec: kind: HTTPRoute selector: matchLabels: - app: kuard + app: filter diff --git a/examples/render/contour-gateway.yaml b/examples/render/contour-gateway.yaml index e3a186da52d..66fed3d86cf 100644 --- a/examples/render/contour-gateway.yaml +++ b/examples/render/contour-gateway.yaml @@ -2830,7 +2830,6 @@ rules: resources: - backendpolicies - gatewayclasses - - gateways - httproutes - tcproutes - tlsroutes @@ -2851,6 +2850,15 @@ rules: - udproutes/status verbs: - update +- apiGroups: + - networking.x-k8s.io + resources: + - gateways + verbs: + - get + - list + - update + - watch - apiGroups: - projectcontour.io resources: diff --git a/examples/render/contour.yaml b/examples/render/contour.yaml index 172616b94f9..b1e91a1d11b 100644 --- a/examples/render/contour.yaml +++ b/examples/render/contour.yaml @@ -2827,7 +2827,6 @@ rules: resources: - backendpolicies - gatewayclasses - - gateways - httproutes - tcproutes - tlsroutes @@ -2848,6 +2847,15 @@ rules: - udproutes/status verbs: - update +- apiGroups: + - networking.x-k8s.io + resources: + - gateways + verbs: + - get + - list + - update + - watch - apiGroups: - projectcontour.io resources: diff --git a/internal/k8s/informers.go b/internal/k8s/informers.go index 271ab482435..0e33b5d8b7e 100644 --- a/internal/k8s/informers.go +++ b/internal/k8s/informers.go @@ -48,7 +48,8 @@ func IngressV1Resources() []schema.GroupVersionResource { } } -// +kubebuilder:rbac:groups="networking.x-k8s.io",resources=gatewayclasses;gateways;httproutes;backendpolicies;tlsroutes;tcproutes;udproutes,verbs=get;list;watch +// +kubebuilder:rbac:groups="networking.x-k8s.io",resources=gateways,verbs=get;list;watch;update +// +kubebuilder:rbac:groups="networking.x-k8s.io",resources=gatewayclasses;httproutes;backendpolicies;tlsroutes;tcproutes;udproutes,verbs=get;list;watch // +kubebuilder:rbac:groups="networking.x-k8s.io",resources=gatewayclasses/status;gateways/status;httproutes/status;backendpolicies/status;tlsroutes/status;tcproutes/status;udproutes/status,verbs=update // GatewayAPIResources returns a list of Gateway API group/version resources.