You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2021/10/17 01:03:27 UTC

[skywalking-swck] branch master updated: fix event RBAC error (#36)

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-swck.git


The following commit(s) were added to refs/heads/master by this push:
     new 271a3fb  fix event RBAC error (#36)
271a3fb is described below

commit 271a3fb7b5667e762023a47cf92748592f67da44
Author: dashanji <71...@users.noreply.github.com>
AuthorDate: Sun Oct 17 09:03:20 2021 +0800

    fix event RBAC error (#36)
---
 config/operator/rbac/role.yaml               | 7 +++++++
 controllers/operator/javaagent_controller.go | 6 ++++++
 controllers/operator/oapserver_controller.go | 1 +
 controllers/operator/ui_controller.go        | 1 +
 docs/java-agent-injector.md                  | 4 ++--
 5 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/config/operator/rbac/role.yaml b/config/operator/rbac/role.yaml
index 337c199..0ba8a84 100644
--- a/config/operator/rbac/role.yaml
+++ b/config/operator/rbac/role.yaml
@@ -46,6 +46,13 @@ rules:
 - apiGroups:
   - ""
   resources:
+  - events
+  verbs:
+  - create
+  - patch
+- apiGroups:
+  - ""
+  resources:
   - pods
   verbs:
   - create
diff --git a/controllers/operator/javaagent_controller.go b/controllers/operator/javaagent_controller.go
index 3abfae5..addc13d 100644
--- a/controllers/operator/javaagent_controller.go
+++ b/controllers/operator/javaagent_controller.go
@@ -168,6 +168,12 @@ func (r *JavaAgentReconciler) updateStatus(ctx context.Context, log logr.Logger,
 		errCol.Collect(fmt.Errorf("failed to get javaagent: %w", err))
 	}
 
+	// avoid printing error info when the javaagent is creating
+	if javaagent.Name == "" {
+		log.Info("javaagent is creating...", "name", selectorname+"-javaagent")
+		return errCol.Error()
+	}
+
 	// return all pods in the request namespace with the podselector
 	podList := &core.PodList{}
 	label := strings.Split(podselector, "=")
diff --git a/controllers/operator/oapserver_controller.go b/controllers/operator/oapserver_controller.go
index 20b38f7..812ac5e 100644
--- a/controllers/operator/oapserver_controller.go
+++ b/controllers/operator/oapserver_controller.go
@@ -57,6 +57,7 @@ type OAPServerReconciler struct {
 // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterroles;clusterrolebindings,verbs=*
 // +kubebuilder:rbac:groups=operator.skywalking.apache.org,resources=storages,verbs=get;list;watch;create;update;patch;delete
 // +kubebuilder:rbac:groups=operator.skywalking.apache.org,resources=storages/status,verbs=get;update;patch
+// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
 
 func (r *OAPServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
 	log := r.Log.WithValues("oapserver", req.NamespacedName)
diff --git a/controllers/operator/ui_controller.go b/controllers/operator/ui_controller.go
index 44ddc0b..99f9fe3 100644
--- a/controllers/operator/ui_controller.go
+++ b/controllers/operator/ui_controller.go
@@ -48,6 +48,7 @@ type UIReconciler struct {
 // +kubebuilder:rbac:groups=operator.skywalking.apache.org,resources=uis,verbs=get;list;watch;create;update;patch;delete
 // +kubebuilder:rbac:groups=operator.skywalking.apache.org,resources=uis/status,verbs=get;update;patch
 // +kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=get;list;watch;create;update;patch;delete
+// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
 
 func (r *UIReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
 	log := r.Log.WithValues("ui", req.NamespacedName)
diff --git a/docs/java-agent-injector.md b/docs/java-agent-injector.md
index 5841c23..62bb934 100644
--- a/docs/java-agent-injector.md
+++ b/docs/java-agent-injector.md
@@ -138,7 +138,7 @@ The optional plugin configuration is the annotation as below.
 
 | Annotation key                   | Description                                                  | Annotation value |
 | -------------------------------- | ------------------------------------------------------------ | ---------------- |
-| `optional.skywalking.apache.org` | Select the optional plugin which needs to be moved to the directory(/plugins). Users can select several optional plugins by separating from `|`, such as `trace|webflux|cloud-gateway-2.1.x`. | not set          |
+| `optional.skywalking.apache.org` | Select the optional plugin which needs to be moved to the directory(/plugins). Users can select several optional plugins by separating from `|`, such as `trace|webflux|cloud-gateway-2.1.x`. | not set          |
 
 #### 5. optional reporter plugin configuration
 
@@ -146,7 +146,7 @@ The optional reporter plugin configuration is the annotation as below.
 
 | Annotation key                            | Description                                                  | Annotation value |
 | ----------------------------------------- | ------------------------------------------------------------ | ---------------- |
-| `optional-reporter.skywalking.apache.org` | Select the optional reporter plugin which needs to be moved to the directory(/plugins). Users can select several optional reporter plugins by separating from `|`, such as `kafka`. | not set          |
+| `optional-reporter.skywalking.apache.org` | Select the optional reporter plugin which needs to be moved to the directory(/plugins). Users can select several optional reporter plugins by separating from `|`, such as `kafka`. | not set          |
 
 ## Configure sidecar