run calico-policy-controller with proper sa/role/rolebinding

This commit is contained in:
jwfang
2017-07-04 20:03:55 +08:00
parent fd01377f12
commit c9734b6d7b
5 changed files with 63 additions and 0 deletions

View File

@@ -3,6 +3,31 @@
when: kube_network_plugin == 'canal'
tags: [facts, canal]
- name: Lay Down calico-policy-controller Template
template:
src: "{{item.file}}"
dest: "{{kube_config_dir}}/{{item.file}}"
with_items:
- {name: calico-policy-controller, file: calico-policy-controller-sa.yml, type: sa}
- {name: calico-policy-controller, file: calico-policy-controller-clusterrole.yml, type: clusterrole}
- {name: calico-policy-controller, file: calico-policy-controller-clusterrolebinding.yml, type: clusterrolebinding}
register: manifests
when: inventory_hostname == groups['kube-master'][0] and rbac_enabled
tags: canal
- name: Create calico-policy-controller 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
tags: canal
- name: Write calico-policy-controller yaml
template:
src: calico-policy-controller.yml.j2