Skip to content

Commit

Permalink
minimize the rbac permissions for karmada-agent
Browse files Browse the repository at this point in the history
Signed-off-by: B1F030 <646337422@qq.com>
  • Loading branch information
B1F030 committed Oct 29, 2024
1 parent 07c6cb4 commit c1bef1b
Showing 1 changed file with 86 additions and 27 deletions.
113 changes: 86 additions & 27 deletions artifacts/deploy/bootstrap-token-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,28 @@ metadata:
name: system:karmada:agent
rules:
- apiGroups:
- authentication.k8s.io
- cluster.karmada.io
resources:
- tokenreviews
- clusters
verbs:
- create
- list
- watch
- apiGroups:
- cluster.karmada.io
resources:
- clusters
# resourceNames:
# - {{clustername}}
verbs:
- create
- get
- list
- watch
- patch
- update
- delete
- apiGroups:
- cluster.karmada.io
resources:
- clusters/status
# resourceNames:
# - {{clustername}}
verbs:
- patch
- update
- apiGroups:
- work.karmada.io
Expand All @@ -140,7 +139,6 @@ rules:
- resourceinterpreterwebhookconfigurations
- resourceinterpretercustomizations
verbs:
- get
- list
- watch
- apiGroups:
Expand All @@ -149,17 +147,15 @@ rules:
- namespaces
verbs:
- get
- list
- watch
- create
- apiGroups:
- ""
resources:
- secrets
# resourceNames:
# - {{clustername}}-impersonator
# - {{clustername}}
verbs:
- get
- list
- watch
- create
- patch
- apiGroups:
Expand All @@ -168,9 +164,7 @@ rules:
- leases
verbs:
- create
- delete
- get
- patch
- update
- apiGroups:
- certificates.k8s.io
Expand All @@ -179,16 +173,6 @@ rules:
verbs:
- create
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- update

---
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -203,3 +187,78 @@ subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: system:nodes

# ---
# apiVersion: rbac.authorization.k8s.io/v1
# kind: Role
# metadata:
# name: system:karmada:agent-secret
# namespace: "{{cluster_namespace}}" # default to karmada-cluster
# rules:
# - apiGroups:
# - ""
# resources:
# - secrets
# # resourceNames:
# # - {{clustername}}-impersonator
# # - {{clustername}}
# verbs:
# - get
# - create
# - patch

# ---
# apiVersion: rbac.authorization.k8s.io/v1
# kind: RoleBinding
# metadata:
# name: system:karmada:agent-secret
# namespace: "{{cluster_namespace}}" # default to karmada-cluster
# roleRef:
# apiGroup: rbac.authorization.k8s.io
# kind: Role
# name: system:karmada:agent-secret
# subjects:
# - apiGroup: rbac.authorization.k8s.io
# kind: Group
# name: system:nodes

# ---
# apiVersion: rbac.authorization.k8s.io/v1
# kind: Role
# metadata:
# name: system:karmada:agent-work
# namespace: "karmada-es-{{clustername}}"
# rules:
# - apiGroups:
# - work.karmada.io
# resources:
# - works
# verbs:
# - create
# - get
# - list
# - watch
# - update
# - delete
# - apiGroups:
# - work.karmada.io
# resources:
# - works/status
# verbs:
# - patch
# - update

# ---
# apiVersion: rbac.authorization.k8s.io/v1
# kind: RoleBinding
# metadata:
# name: system:karmada:agent-work
# namespace: "karmada-es-{{clustername}}"
# roleRef:
# apiGroup: rbac.authorization.k8s.io
# kind: Role
# name: system:karmada:agent-work
# subjects:
# - apiGroup: rbac.authorization.k8s.io
# kind: Group
# name: system:nodes

0 comments on commit c1bef1b

Please sign in to comment.