|
|
@ -29,6 +29,52 @@ |
|
|
|
- rbac_enabled |
|
|
|
- node_crb_manifest.changed |
|
|
|
|
|
|
|
- name: Kubernetes Apps | Add webhook ClusterRole that grants access to proxy, stats, log, spec, and metrics on a kubelet |
|
|
|
template: |
|
|
|
src: "node-webhook-cr.yml.j2" |
|
|
|
dest: "{{ kube_config_dir }}/node-webhook-cr.yml" |
|
|
|
register: node_webhook_cr_manifest |
|
|
|
when: |
|
|
|
- rbac_enabled |
|
|
|
- kubelet_authorization_mode_webhook |
|
|
|
tags: node-webhook |
|
|
|
|
|
|
|
- name: Apply webhook ClusterRole |
|
|
|
kube: |
|
|
|
name: "system:node-webhook" |
|
|
|
kubectl: "{{bin_dir}}/kubectl" |
|
|
|
resource: "clusterrole" |
|
|
|
filename: "{{ kube_config_dir }}/node-webhook-cr.yml" |
|
|
|
state: latest |
|
|
|
when: |
|
|
|
- rbac_enabled |
|
|
|
- kubelet_authorization_mode_webhook |
|
|
|
- node_webhook_cr_manifest.changed |
|
|
|
tags: node-webhook |
|
|
|
|
|
|
|
- name: Kubernetes Apps | Add ClusterRoleBinding for system:nodes to webhook ClusterRole |
|
|
|
template: |
|
|
|
src: "node-webhook-crb.yml.j2" |
|
|
|
dest: "{{ kube_config_dir }}/node-webhook-crb.yml" |
|
|
|
register: node_webhook_crb_manifest |
|
|
|
when: |
|
|
|
- rbac_enabled |
|
|
|
- kubelet_authorization_mode_webhook |
|
|
|
tags: node-webhook |
|
|
|
|
|
|
|
- name: Grant system:nodes the webhook ClusterRole |
|
|
|
kube: |
|
|
|
name: "system:node-webhook" |
|
|
|
kubectl: "{{bin_dir}}/kubectl" |
|
|
|
resource: "clusterrolebinding" |
|
|
|
filename: "{{ kube_config_dir }}/node-webhook-crb.yml" |
|
|
|
state: latest |
|
|
|
when: |
|
|
|
- rbac_enabled |
|
|
|
- kubelet_authorization_mode_webhook |
|
|
|
- node_webhook_crb_manifest.changed |
|
|
|
tags: node-webhook |
|
|
|
|
|
|
|
# This is not a cluster role, but should be run after kubeconfig is set on master |
|
|
|
- name: Write kube system namespace manifest |
|
|
|
template: |
|
|
|