From 6a146404f2d898e6c8a9c8bf9f6ed4303b038dc0 Mon Sep 17 00:00:00 2001 From: Ruben Vargas Date: Mon, 10 Jan 2022 09:01:16 -0600 Subject: [PATCH 1/2] Fix leasing permisions Signed-off-by: Ruben Vargas --- .../manifests/jaeger-operator.clusterserviceversion.yaml | 9 +++++++++ config/rbac/role.yaml | 9 +++++++++ controllers/appsv1/deployment_controller.go | 1 + controllers/appsv1/namespace_controller.go | 1 + controllers/jaegertracing/jaeger_controller.go | 2 ++ 5 files changed, 22 insertions(+) diff --git a/bundle/manifests/jaeger-operator.clusterserviceversion.yaml b/bundle/manifests/jaeger-operator.clusterserviceversion.yaml index f0d8da052..bc4dd37c2 100644 --- a/bundle/manifests/jaeger-operator.clusterserviceversion.yaml +++ b/bundle/manifests/jaeger-operator.clusterserviceversion.yaml @@ -191,6 +191,15 @@ spec: - patch - update - watch + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - list + - update - apiGroups: - "" resources: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 3b36e31e0..7d72adc6d 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -78,6 +78,15 @@ rules: - patch - update - watch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - list + - update - apiGroups: - "" resources: diff --git a/controllers/appsv1/deployment_controller.go b/controllers/appsv1/deployment_controller.go index 559adec5e..e9af9e5b1 100644 --- a/controllers/appsv1/deployment_controller.go +++ b/controllers/appsv1/deployment_controller.go @@ -30,6 +30,7 @@ func NewDeploymentReconciler(client client.Client, clientReader client.Reader, s // Reconcile deployment resource // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get;update;patch + func (r *DeploymentReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) { return r.reconcilier.Reconcile(ctx, request) } diff --git a/controllers/appsv1/namespace_controller.go b/controllers/appsv1/namespace_controller.go index c44c6e46d..a68ac0871 100644 --- a/controllers/appsv1/namespace_controller.go +++ b/controllers/appsv1/namespace_controller.go @@ -29,6 +29,7 @@ func NewNamespaceReconciler(client client.Client, clientReader client.Reader, sc // +kubebuilder:rbac:groups=core,resources=namespaces/status,verbs=get;update;patch // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get;update;patch + func (r *NamespaceReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) { return r.reconcilier.Reconcile(request) } diff --git a/controllers/jaegertracing/jaeger_controller.go b/controllers/jaegertracing/jaeger_controller.go index 4b2691482..75689fcb5 100644 --- a/controllers/jaegertracing/jaeger_controller.go +++ b/controllers/jaegertracing/jaeger_controller.go @@ -55,6 +55,8 @@ func NewReconciler(client client.Client, clientReader client.Reader, scheme *run // +kubebuilder:rbac:groups=logging.openshift.io,resources=elasticsearches,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=kafka.strimzi.io,resources=kafkas;kafkausers,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterrolebindings,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;create;update + func (r *JaegerReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) { return r.reconcilier.Reconcile(request) } From 9038c1d6e7a3a29283cbf0fd71c19381bf35b35d Mon Sep 17 00:00:00 2001 From: Ruben Vargas Date: Mon, 10 Jan 2022 09:45:08 -0600 Subject: [PATCH 2/2] Fix linting Signed-off-by: Ruben Vargas --- controllers/appsv1/deployment_controller.go | 2 +- controllers/appsv1/namespace_controller.go | 2 +- controllers/jaegertracing/jaeger_controller.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/appsv1/deployment_controller.go b/controllers/appsv1/deployment_controller.go index e9af9e5b1..ed9226324 100644 --- a/controllers/appsv1/deployment_controller.go +++ b/controllers/appsv1/deployment_controller.go @@ -27,10 +27,10 @@ func NewDeploymentReconciler(client client.Client, clientReader client.Reader, s } } -// Reconcile deployment resource // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get;update;patch +// Reconcile deployment resource func (r *DeploymentReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) { return r.reconcilier.Reconcile(ctx, request) } diff --git a/controllers/appsv1/namespace_controller.go b/controllers/appsv1/namespace_controller.go index a68ac0871..737f220c2 100644 --- a/controllers/appsv1/namespace_controller.go +++ b/controllers/appsv1/namespace_controller.go @@ -24,12 +24,12 @@ func NewNamespaceReconciler(client client.Client, clientReader client.Reader, sc } } -// Reconcile namespace resource // +kubebuilder:rbac:groups=core,resources=namespaces,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=core,resources=namespaces/status,verbs=get;update;patch // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get;update;patch +// Reconcile namespace resource func (r *NamespaceReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) { return r.reconcilier.Reconcile(request) } diff --git a/controllers/jaegertracing/jaeger_controller.go b/controllers/jaegertracing/jaeger_controller.go index 75689fcb5..18b965655 100644 --- a/controllers/jaegertracing/jaeger_controller.go +++ b/controllers/jaegertracing/jaeger_controller.go @@ -39,7 +39,6 @@ func NewReconciler(client client.Client, clientReader client.Reader, scheme *run } } -// Reconcile jaeger resource // +kubebuilder:rbac:groups=jaegertracing.io,resources=jaegers,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=jaegertracing.io,resources=jaegers/status,verbs=get;update;patch // +kubebuilder:rbac:groups=jaegertracing.io,resources=jaegers/finalizers,verbs=update @@ -57,6 +56,7 @@ func NewReconciler(client client.Client, clientReader client.Reader, scheme *run // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterrolebindings,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;create;update +// Reconcile jaeger resource func (r *JaegerReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) { return r.reconcilier.Reconcile(request) }