Skip to content

Commit

Permalink
add rbac and env POD_NAME to fix incorrect event refobject (#293)
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiwei Yin <[email protected]>
  • Loading branch information
zhiweiyin318 authored Sep 13, 2023
1 parent 83b79e5 commit 8d77b40
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/bootstrap/manifests/klusterlet/cluster_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ rules:
- apiGroups: [""]
resources: ["secrets", "configmaps", "serviceaccounts"]
verbs: ["create", "get", "list", "update", "watch", "patch", "delete"]
# get pods and replicasets is for event creation
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
- apiGroups: [ "apps" ]
resources: [ "replicasets" ]
verbs: [ "get" ]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["create", "get", "list", "update", "watch", "patch"]
Expand Down
5 changes: 5 additions & 0 deletions pkg/bootstrap/manifests/klusterlet/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ spec:
- "/registration-operator"
- "klusterlet"
- "--disable-leader-election"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down

0 comments on commit 8d77b40

Please sign in to comment.