2020-08-12 18:08:12 +00:00
|
|
|
---
|
2021-10-08 09:47:39 +00:00
|
|
|
# Source: calico/templates/calico-node-rbac.yaml
|
2020-08-12 18:08:12 +00:00
|
|
|
# Include a clusterrole for the calico-node DaemonSet,
|
|
|
|
# and bind it to the calico-node serviceaccount.
|
|
|
|
kind: ClusterRole
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: calico-node
|
|
|
|
rules:
|
2022-08-12 15:02:56 +00:00
|
|
|
# Used for creating service account tokens to be used by the CNI plugin
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- serviceaccounts/token
|
|
|
|
resourceNames:
|
|
|
|
- canal
|
|
|
|
verbs:
|
|
|
|
- create
|
2020-08-12 18:08:12 +00:00
|
|
|
# The CNI plugin needs to get pods, nodes, and namespaces.
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- pods
|
|
|
|
- nodes
|
|
|
|
- namespaces
|
|
|
|
verbs:
|
|
|
|
- get
|
2021-10-08 09:47:39 +00:00
|
|
|
# EndpointSlices are used for Service-based network policy rule
|
|
|
|
# enforcement.
|
|
|
|
- apiGroups: ["discovery.k8s.io"]
|
|
|
|
resources:
|
|
|
|
- endpointslices
|
|
|
|
verbs:
|
|
|
|
- watch
|
|
|
|
- list
|
2020-08-12 18:08:12 +00:00
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- endpoints
|
|
|
|
- services
|
|
|
|
verbs:
|
|
|
|
# Used to discover service IPs for advertisement.
|
|
|
|
- watch
|
|
|
|
- list
|
|
|
|
# Used to discover Typhas.
|
|
|
|
- get
|
|
|
|
# Pod CIDR auto-detection on kubeadm needs access to config maps.
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- configmaps
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- nodes/status
|
|
|
|
verbs:
|
|
|
|
# Needed for clearing NodeNetworkUnavailable flag.
|
|
|
|
- patch
|
|
|
|
# Calico stores some configuration information in node annotations.
|
|
|
|
- update
|
|
|
|
# Watch for changes to Kubernetes NetworkPolicies.
|
|
|
|
- apiGroups: ["networking.k8s.io"]
|
|
|
|
resources:
|
|
|
|
- networkpolicies
|
|
|
|
verbs:
|
|
|
|
- watch
|
|
|
|
- list
|
|
|
|
# Used by Calico for policy information.
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- pods
|
|
|
|
- namespaces
|
|
|
|
- serviceaccounts
|
|
|
|
verbs:
|
|
|
|
- list
|
|
|
|
- watch
|
|
|
|
# The CNI plugin patches pods/status.
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- pods/status
|
|
|
|
verbs:
|
|
|
|
- patch
|
|
|
|
# Calico monitors various CRDs for config.
|
|
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
|
|
resources:
|
2022-03-17 13:12:35 +00:00
|
|
|
- caliconodestatuses
|
2020-08-12 18:08:12 +00:00
|
|
|
- globalfelixconfigs
|
|
|
|
- felixconfigurations
|
|
|
|
- bgppeers
|
|
|
|
- globalbgpconfigs
|
|
|
|
- bgpconfigurations
|
|
|
|
- ippools
|
2022-10-06 14:45:26 +00:00
|
|
|
- ipreservations
|
2020-08-12 18:08:12 +00:00
|
|
|
- ipamblocks
|
|
|
|
- globalnetworkpolicies
|
|
|
|
- globalnetworksets
|
|
|
|
- networkpolicies
|
|
|
|
- networksets
|
|
|
|
- clusterinformations
|
|
|
|
- hostendpoints
|
|
|
|
- blockaffinities
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- watch
|
|
|
|
# Calico must create and update some CRDs on startup.
|
|
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
|
|
resources:
|
2022-03-17 13:50:26 +00:00
|
|
|
- caliconodestatuses
|
2020-08-12 18:08:12 +00:00
|
|
|
- ippools
|
|
|
|
- felixconfigurations
|
|
|
|
- clusterinformations
|
|
|
|
verbs:
|
|
|
|
- create
|
|
|
|
- update
|
|
|
|
# Calico stores some configuration information on the node.
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- nodes
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- watch
|
2021-10-08 09:47:39 +00:00
|
|
|
# These permissions are only required for upgrade from v2.6, and can
|
2020-08-12 18:08:12 +00:00
|
|
|
# be removed after upgrade or on fresh installations.
|
|
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
|
|
resources:
|
|
|
|
- bgpconfigurations
|
|
|
|
- bgppeers
|
|
|
|
verbs:
|
|
|
|
- create
|
|
|
|
- update
|
|
|
|
|
|
|
|
---
|
|
|
|
# Flannel ClusterRole
|
|
|
|
# Pulled from https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel-rbac.yml
|
|
|
|
kind: ClusterRole
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: flannel
|
|
|
|
rules:
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- pods
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- nodes
|
|
|
|
verbs:
|
|
|
|
- list
|
|
|
|
- watch
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- nodes/status
|
|
|
|
verbs:
|
|
|
|
- patch
|
|
|
|
---
|
|
|
|
# Bind the flannel ClusterRole to the canal ServiceAccount.
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: canal-flannel
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: flannel
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: canal
|
|
|
|
namespace: kube-system
|
|
|
|
---
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
metadata:
|
|
|
|
name: canal-calico
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: calico-node
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: canal
|
|
|
|
namespace: kube-system
|
2022-02-08 12:02:35 +00:00
|
|
|
{{ if .Values.calico.calicoKubeControllers }}
|
|
|
|
---
|
|
|
|
# Include a clusterrole for the kube-controllers component,
|
|
|
|
# and bind it to the calico-kube-controllers serviceaccount.
|
|
|
|
kind: ClusterRole
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: calico-kube-controllers
|
|
|
|
rules:
|
|
|
|
# Nodes are watched to monitor for deletions.
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- nodes
|
|
|
|
verbs:
|
|
|
|
- watch
|
|
|
|
- list
|
|
|
|
- get
|
|
|
|
# Pods are watched to check for existence as part of IPAM controller.
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources:
|
|
|
|
- pods
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- watch
|
|
|
|
# IPAM resources are manipulated when nodes are deleted.
|
|
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
|
|
resources:
|
|
|
|
- ippools
|
|
|
|
- ipreservations
|
|
|
|
verbs:
|
|
|
|
- list
|
|
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
|
|
resources:
|
|
|
|
- blockaffinities
|
|
|
|
- ipamblocks
|
|
|
|
- ipamhandles
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- create
|
|
|
|
- update
|
|
|
|
- delete
|
|
|
|
- watch
|
|
|
|
# kube-controllers manages hostendpoints.
|
|
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
|
|
resources:
|
|
|
|
- hostendpoints
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- create
|
|
|
|
- update
|
|
|
|
- delete
|
|
|
|
# Needs access to update clusterinformations.
|
|
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
|
|
resources:
|
|
|
|
- clusterinformations
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- create
|
|
|
|
- update
|
|
|
|
# KubeControllersConfiguration is where it gets its config
|
|
|
|
- apiGroups: ["crd.projectcalico.org"]
|
|
|
|
resources:
|
|
|
|
- kubecontrollersconfigurations
|
|
|
|
verbs:
|
|
|
|
# read its own config
|
|
|
|
- get
|
|
|
|
# create a default if none exists
|
|
|
|
- create
|
|
|
|
# update status
|
|
|
|
- update
|
|
|
|
# watch for changes
|
|
|
|
- watch
|
|
|
|
---
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: calico-kube-controllers
|
|
|
|
roleRef:
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
kind: ClusterRole
|
|
|
|
name: calico-kube-controllers
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: calico-kube-controllers
|
|
|
|
namespace: kube-system
|
|
|
|
{{ end }}
|