diff --git a/Makefile b/Makefile index b61d28d..45db5c7 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ check: FORCE static-check build/cover.html build-all generate: install-controller-gen @printf "\e[1;36m>> controller-gen\e[0m\n" - @controller-gen rbac:roleName=maintenance-controller paths="./..." output:crd:artifacts:config=crd + @controller-gen crd rbac:roleName=maintenance-controller webhook paths="./..." output:crd:artifacts:config=crd @controller-gen object paths="./..." run-golangci-lint: FORCE prepare-static-check diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 021c727..28bd16f 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -4,18 +4,6 @@ kind: ClusterRole metadata: name: maintenance-controller rules: -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - apiGroups: - "" resources: @@ -28,6 +16,7 @@ rules: - "" resources: - nodes + - pods verbs: - create - delete @@ -45,9 +34,9 @@ rules: - patch - update - apiGroups: - - "" + - coordination.k8s.io resources: - - pods + - leases verbs: - create - delete diff --git a/controllers/node_controller.go b/controllers/node_controller.go index 6bbdb7c..1b6f0da 100644 --- a/controllers/node_controller.go +++ b/controllers/node_controller.go @@ -76,13 +76,13 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl. conf, err := ucfgwrap.FromYAMLFile(constants.MaintenanceConfigFilePath, ucfg.VarExp, ucfg.ResolveEnv) if err != nil { r.Log.Error(err, "Failed to parse configuration file (syntax error)") - // the controller is missconfigured, no need to requeue before the configuration is fixed + // the controller is misconfigured, no need to requeue before the configuration is fixed return ctrl.Result{}, nil } config, err := LoadConfig(&conf) if err != nil { r.Log.Error(err, "Failed to parse configuration file (semantic error)") - // the controller is missconfigured, no need to requeue before the configuration is fixed + // the controller is misconfigured, no need to requeue before the configuration is fixed return ctrl.Result{}, nil }