File tree 2 files changed +17
-1
lines changed
projects/cluster/toolbox/cluster_preload_image
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 5
5
state : directory
6
6
mode : ' 0755'
7
7
8
+ - name : Lookup the namespace user ID range
9
+ shell :
10
+ set -o pipefail;
11
+
12
+ oc get ns {{ cluster_preload_image_namespace }} -ojsonpath={.metadata.annotations} | jq -r '.["openshift.io/sa.scc.uid-range"]' | cut -d/ -f1
13
+ register : namespace_uid_range_cmd
14
+
15
+ - name : Save the namespace uid as run_as_user
16
+ set_fact :
17
+ run_as_user : " {{ namespace_uid_range_cmd.stdout }}"
18
+
8
19
- name : Apply the DaemonSet template
9
20
template :
10
21
src : " {{ cluster_preload_image_ds_template }}"
89
100
oc describe pods -l name={{ cluster_preload_image_name }}
90
101
-n {{ cluster_preload_image_namespace }}
91
102
> "{{ artifact_extra_logs_dir }}/pods.descr"
103
+ failed_when : false
92
104
93
105
- name : Get the status of the preload Pods
94
106
shell :
95
107
oc get pods -l name={{ cluster_preload_image_name }}
96
108
-owide
97
109
-n {{ cluster_preload_image_namespace }}
98
110
> "{{ artifact_extra_logs_dir }}/pods.status"
111
+ failed_when : false
99
112
100
113
- name : Get the yaml of the daemonset
101
114
shell :
102
115
oc get ds/{{ cluster_preload_image_name }}
103
116
-oyaml
104
117
-n {{ cluster_preload_image_namespace }}
105
118
> "{{ artifact_extra_logs_dir }}/daemonset.yaml"
119
+ failed_when : false
106
120
107
121
- name : Get the status of the daemonset
108
122
shell :
109
123
oc get ds/{{ cluster_preload_image_name }}
110
124
-n {{ cluster_preload_image_namespace }}
111
125
> "{{ artifact_extra_logs_dir }}/daemonset.status"
126
+ failed_when : false
112
127
113
128
- name : Delete the DaemonSet, it it exists
114
129
command :
Original file line number Diff line number Diff line change 29
29
- sleep
30
30
- 1d
31
31
securityContext:
32
- runAsUser: 999
32
+ # prevent the image from requesting to run as root
33
+ runAsUser: {{ run_as_user }}
33
34
allowPrivilegeEscalation: false
34
35
capabilities:
35
36
drop: ["ALL"]
You can’t perform that action at this time.
0 commit comments