Skip to content
Snippets Groups Projects
Commit 2cda9823 authored by jwfang's avatar jwfang
Browse files

binding group system:nodes to clusterrole calico-role

parent c9734b6d
No related branches found
No related tags found
No related merge requests found
......@@ -191,7 +191,7 @@
src: "{{ fname }}"
dest: "{{ fname }}"
mode: push
delegate_to: localhost
#delegate_to: localhost
become: false
register: get_task
until: get_task|succeeded
......
......@@ -3,7 +3,7 @@
when: kube_network_plugin == 'canal'
tags: [facts, canal]
- name: Lay Down calico-policy-controller Template
- name: Lay Down calico-policy-controller RBAC Template
template:
src: "{{item.file}}"
dest: "{{kube_config_dir}}/{{item.file}}"
......@@ -15,7 +15,7 @@
when: inventory_hostname == groups['kube-master'][0] and rbac_enabled
tags: canal
- name: Create calico-policy-controller Resources
- name: Create calico-policy-controller RBAC Resources
kube:
name: "{{item.item.name}}"
namespace: "{{ system_namespace }}"
......
......@@ -195,6 +195,28 @@
when: secret_changed|default(false) or etcd_secret_changed|default(false)
notify: restart calico-node
- name: Lay Down calico-node RBAC Template
template:
src: "{{item.file}}"
dest: "{{kube_config_dir}}/{{item.file}}"
with_items:
- {name: calico-node, file: calico-node-clusterrole.yml, type: clusterrole}
- {name: calico-node, file: calico-node-clusterrolebinding.yml, type: clusterrolebinding}
register: manifests
when: inventory_hostname == groups['kube-master'][0] and rbac_enabled
- name: Create calico-node RBAC Resources
kube:
name: "{{item.item.name}}"
namespace: "{{ system_namespace }}"
kubectl: "{{bin_dir}}/kubectl"
resource: "{{item.item.type}}"
filename: "{{kube_config_dir}}/{{item.item.file}}"
state: "{{item.changed | ternary('latest','present') }}"
with_items: "{{ manifests.results }}"
failed_when: manifests|failed and "Error from server (AlreadyExists)" not in manifests.msg
when: inventory_hostname == groups['kube-master'][0] and rbac_enabled
- meta: flush_handlers
- name: Calico | Enable calico-node
......
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: calico-node
namespace: {{ system_namespace }}
rules:
- apiGroups: [""]
resources:
- pods
- nodes
verbs:
- get
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: calico-node
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: calico-node
subjects:
- kind: Group
name: system:nodes
namespace: kube-system
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment