Skip to content

Commit

Permalink
[calico] Separate calico-node and calico-cni-plugin service accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
mzaian committed Sep 14, 2023
1 parent 5921384 commit 3f21223
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
35 changes: 34 additions & 1 deletion roles/network_plugin/calico/templates/calico-cr.yml.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: calico-cni-plugin
rules:
- apiGroups: [""]
resources:
- pods
- nodes
- namespaces
verbs:
- get
- apiGroups: [""]
resources:
- pods/status
verbs:
- patch
- apiGroups: ["crd.projectcalico.org"]
resources:
- blockaffinities
- ipamblocks
- ipamhandles
- clusterinformations
- ippools
- ipreservations
- ipamconfigs
verbs:
- get
- list
- create
- update
- delete
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: calico-node
namespace: kube-system
Expand Down Expand Up @@ -164,6 +197,6 @@ rules:
resources:
- serviceaccounts/token
resourceNames:
- calico-node
- calico-cni-plugin
verbs:
- create
15 changes: 15 additions & 0 deletions roles/network_plugin/calico/templates/calico-crb.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,18 @@ subjects:
- kind: ServiceAccount
name: calico-node
namespace: kube-system

---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: calico-cni-plugin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: calico-cni-plugin
subjects:
- kind: ServiceAccount
name: calico-cni-plugin
namespace: kube-system
7 changes: 7 additions & 0 deletions roles/network_plugin/calico/templates/calico-node-sa.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ kind: ServiceAccount
metadata:
name: calico-node
namespace: kube-system

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: calico-cni-plugin
namespace: kube-system

0 comments on commit 3f21223

Please sign in to comment.