Skip to content

Commit 6547caa

Browse files
adding code fix for all three modules
Signed-off-by: Pavan Sadhana <[email protected]> adding code fix for all modules Signed-off-by: Pavan Sadhana <[email protected]> adding MultiArch removing adding pod affinity code added code for smoke test and must gather modules added file permissions to must gather and tar ball adding MultiArch adding pod affinity code added file permission for must gather removed ocp-mac file
1 parent e50ffec commit 6547caa

File tree

8 files changed

+215
-0
lines changed

8 files changed

+215
-0
lines changed

playbooks/must-gather.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Collect must-gather logs
3+
hosts: bastion
4+
roles:
5+
- must-gather

playbooks/pod-affinity-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Run pod affinity and pause pod test
3+
hosts: bastion
4+
roles:
5+
- pod-affinity-test
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
#defaults file for playbooks/rokes/must-gather
3+
must_gather_dest: /home/must_gather_logs
4+
must_gather_archive: /home/must-gather-logs.tar.gz
5+
#must_gather_local_path: ./must-gather-logs.tar.gz
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
- name: Run oc adm must-gather
3+
command: oc adm must-gather --dest-dir={{ must_gather_dest }}
4+
args:
5+
creates: "{{ must_gather_dest }}/cluster-scoped-resources"
6+
register: must_gather_output
7+
8+
- debug:
9+
var: must_gather_output.stdout_lines
10+
11+
- name: Set permissions for must-gather directory
12+
file:
13+
path: "{{ must_gather_dest }}"
14+
owner: root
15+
group: root
16+
mode: '0755'
17+
state: directory
18+
19+
- name: Compress must-gather logs
20+
command: tar -czf {{ must_gather_archive }} -C {{ must_gather_dest | dirname }} {{ must_gather_dest | basename }}
21+
args:
22+
creates: "{{ must_gather_archive }}"
23+
24+
- name: Set permissions for must-gather tarball
25+
file:
26+
path: "{{ must_gather_archive }}"
27+
owner: root
28+
group: root
29+
mode: '0644'
30+
state: file

playbooks/roles/pod-affinity-test/defaults/main.yml

Whitespace-only changes.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
- name: Create PPC pod with affinity
3+
kubernetes.core.k8s:
4+
state: present
5+
definition:
6+
apiVersion: v1
7+
kind: Pod
8+
metadata:
9+
name: ppc-pod
10+
namespace: default
11+
spec:
12+
affinity:
13+
nodeAffinity:
14+
preferredDuringSchedulingIgnoredDuringExecution:
15+
- weight: 70
16+
preference:
17+
matchExpressions:
18+
- key: kubernetes.io/arch
19+
operator: In
20+
values:
21+
- ppc64le
22+
- weight: 30
23+
preference:
24+
matchExpressions:
25+
- key: kubernetes.io/arch
26+
operator: NotIn
27+
values:
28+
- ppc64le
29+
containers:
30+
- name: web
31+
image: registry.redhat.io/ubi8/pause
32+
33+
- name: Create x86 pod with anti-affinity
34+
kubernetes.core.k8s:
35+
state: present
36+
definition:
37+
apiVersion: v1
38+
kind: Pod
39+
metadata:
40+
name: x86-pod
41+
namespace: default
42+
spec:
43+
affinity:
44+
nodeAffinity:
45+
preferredDuringSchedulingIgnoredDuringExecution:
46+
- weight: 30
47+
preference:
48+
matchExpressions:
49+
- key: kubernetes.io/arch
50+
operator: In
51+
values:
52+
- ppc64le
53+
- weight: 70
54+
preference:
55+
matchExpressions:
56+
- key: kubernetes.io/arch
57+
operator: NotIn
58+
values:
59+
- ppc64le
60+
containers:
61+
- name: web
62+
image: registry.redhat.io/ubi8/pause
63+
64+
- name: Wait until pods are running
65+
command: oc get pods -n default --no-headers
66+
register: pod_status
67+
until: "'Running' in pod_status.stdout"
68+
retries: 10
69+
delay: 10
70+
71+
- name: Launch multiple pause pods
72+
shell: |
73+
for n in $(seq 1 60); do
74+
oc run pause-pod-$n --image=ubi8/pause:8.8-9 -n default
75+
done
76+
77+
- name: Verify all pods running
78+
command: oc get pods -n default -o wide
79+
register: pause_pod_status
80+
changed_when: false
81+
82+
- debug:
83+
msg: "{{ pause_pod_status.stdout_lines }}"
84+
85+
- name: Cleanup - delete all pods
86+
command: oc delete pods --all -n default
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
- name: Create and debug pods with node affinity
3+
# hosts: bastion
4+
tasks:
5+
6+
- name: Create PPC pod with affinity (ppc64le)
7+
kubernetes.core.k8s:
8+
state: present
9+
definition:
10+
apiVersion: v1
11+
kind: Pod
12+
metadata:
13+
name: ppc-pod
14+
namespace: default
15+
spec:
16+
affinity:
17+
nodeAffinity:
18+
requiredDuringSchedulingIgnoredDuringExecution:
19+
nodeSelectorTerms:
20+
- matchExpressions:
21+
- key: kubernetes.io/arch
22+
operator: In
23+
values: [ppc64le]
24+
containers:
25+
- name: web
26+
image: registry.redhat.io/ubi8/pause
27+
28+
- name: Create x86 pod with affinity (amd64)
29+
kubernetes.core.k8s:
30+
state: present
31+
definition:
32+
apiVersion: v1
33+
kind: Pod
34+
metadata:
35+
name: x86-pod
36+
namespace: default
37+
spec:
38+
affinity:
39+
nodeAffinity:
40+
requiredDuringSchedulingIgnoredDuringExecution:
41+
nodeSelectorTerms:
42+
- matchExpressions:
43+
- key: kubernetes.io/arch
44+
operator: In
45+
values: [amd64]
46+
containers:
47+
- name: web
48+
image: registry.redhat.io/ubi8/pause
49+
50+
- name: Wait for both pods to be Running
51+
shell: oc get pods ppc-pod x86-pod -n default --no-headers
52+
register: pod_status
53+
until: "'Running' in pod_status.stdout"
54+
retries: 10
55+
delay: 10
56+
57+
- name: Show pod status
58+
command: oc get pods -o wide -n default
59+
register: pod_list
60+
changed_when: false
61+
62+
- debug:
63+
msg: "{{ pod_list.stdout_lines }}"
64+
65+
- name: Debug x86 pod (ls inside container)
66+
shell: |
67+
oc debug pod/x86-pod -n default -- ls
68+
register: debug_x86
69+
70+
- debug:
71+
msg: "{{ debug_x86.stdout_lines }}"
72+
73+
- name: Debug ppc pod (ls inside container)
74+
shell: |
75+
oc debug pod/ppc-pod -n default -- ls
76+
register: debug_ppc
77+
78+
- debug:
79+
msg: "{{ debug_ppc.stdout_lines }}"

playbooks/smoke-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Deploy and verify arch-specific pods
3+
hosts: bastion
4+
roles:
5+
- smoke-test

0 commit comments

Comments
 (0)