-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PodSecurityPolicy] Move the install of psp
- Loading branch information
1 parent
3f06591
commit 65a1a0d
Showing
6 changed files
with
54 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
- name: Check AppArmor status | ||
command: which apparmor_parser | ||
register: apparmor_status | ||
when: | ||
- podsecuritypolicy_enabled | ||
- inventory_hostname == groups['kube_control_plane'][0] | ||
failed_when: false | ||
|
||
- name: Set apparmor_enabled | ||
set_fact: | ||
apparmor_enabled: "{{ apparmor_status.rc == 0 }}" | ||
when: | ||
- podsecuritypolicy_enabled | ||
- inventory_hostname == groups['kube_control_plane'][0] | ||
|
||
- name: Render templates for PodSecurityPolicy | ||
template: | ||
src: "{{ item.file }}.j2" | ||
dest: "{{ kube_config_dir }}/{{ item.file }}" | ||
mode: 0640 | ||
register: psp_manifests | ||
with_items: | ||
- {file: psp.yml, type: psp, name: psp} | ||
- {file: psp-cr.yml, type: clusterrole, name: psp-cr} | ||
- {file: psp-crb.yml, type: rolebinding, name: psp-crb} | ||
when: | ||
- podsecuritypolicy_enabled | ||
- inventory_hostname == groups['kube_control_plane'][0] | ||
|
||
- name: Add policies, roles, bindings for PodSecurityPolicy | ||
kube: | ||
name: "{{ item.item.name }}" | ||
kubectl: "{{ bin_dir }}/kubectl" | ||
resource: "{{ item.item.type }}" | ||
filename: "{{ kube_config_dir }}/{{ item.item.file }}" | ||
state: "latest" | ||
register: result | ||
until: result is succeeded | ||
retries: 10 | ||
delay: 6 | ||
with_items: "{{ psp_manifests.results }}" | ||
environment: | ||
KUBECONFIG: "{{ kube_config_dir }}/admin.conf" | ||
when: | ||
- inventory_hostname == groups['kube_control_plane'][0] | ||
- not item is skipped | ||
loop_control: | ||
label: "{{ item.item.file }}" |
File renamed without changes.
File renamed without changes.
File renamed without changes.