From bb350c3629fdf8751622f82ed247025aa86827a0 Mon Sep 17 00:00:00 2001 From: sholdee <102821812+sholdee@users.noreply.github.com> Date: Fri, 9 Aug 2024 01:05:18 -0500 Subject: [PATCH] Add watch verb for storageclasses rbac (#258) Fixes these errors: `E0804 17:31:18.410670 1 reflector.go:150] pkg/mod/k8s.io/client-go@v0.30.2/tools/cache/reflector.go:232: Failed to watch *v1.StorageClass: unknown (get storageclasses.storage.k8s.io)` --- .../etcd-operator/templates/rbac/clusterrole-manager-role.yml | 1 + config/rbac/role.yaml | 1 + internal/controller/etcdcluster_controller.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/etcd-operator/templates/rbac/clusterrole-manager-role.yml b/charts/etcd-operator/templates/rbac/clusterrole-manager-role.yml index 534e00ad..825c726c 100644 --- a/charts/etcd-operator/templates/rbac/clusterrole-manager-role.yml +++ b/charts/etcd-operator/templates/rbac/clusterrole-manager-role.yml @@ -73,6 +73,7 @@ rules: verbs: - get - list + - watch - apiGroups: - etcd.aenix.io resources: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 00d63f4c..3ae03b0d 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -110,3 +110,4 @@ rules: verbs: - get - list + - watch diff --git a/internal/controller/etcdcluster_controller.go b/internal/controller/etcdcluster_controller.go index b1df270f..f4ec6eca 100644 --- a/internal/controller/etcdcluster_controller.go +++ b/internal/controller/etcdcluster_controller.go @@ -70,7 +70,7 @@ type EtcdClusterReconciler struct { // +kubebuilder:rbac:groups="apps",resources=statefulsets,verbs=get;create;delete;update;patch;list;watch // +kubebuilder:rbac:groups="policy",resources=poddisruptionbudgets,verbs=get;create;delete;update;patch;list;watch // +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=get;list;patch;watch -// +kubebuilder:rbac:groups=storage.k8s.io,resources=storageclasses,verbs=get;list +// +kubebuilder:rbac:groups=storage.k8s.io,resources=storageclasses,verbs=get;list;watch // Reconcile checks CR and current cluster state and performs actions to transform current state to desired. func (r *EtcdClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {