-
Notifications
You must be signed in to change notification settings - Fork 33
WIP: MAC automation #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Pavan-Sadhana3
wants to merge
1
commit into
ocp-power-automation:main
Choose a base branch
from
Pavan-Sadhana3:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
WIP: MAC automation #127
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| - name: Collect must-gather logs | ||
| hosts: bastion | ||
| roles: | ||
| - must-gather |
This file contains hidden or 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,5 @@ | ||
| --- | ||
| - name: Run pod affinity and pause pod test | ||
| hosts: bastion | ||
| roles: | ||
| - pod-affinity-test |
This file contains hidden or 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,5 @@ | ||
| --- | ||
| #defaults file for playbooks/rokes/must-gather | ||
| must_gather_dest: /home/must_gather_logs | ||
| must_gather_archive: /home/must-gather-logs.tar.gz | ||
| #must_gather_local_path: ./must-gather-logs.tar.gz |
This file contains hidden or 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,30 @@ | ||
| --- | ||
| - name: Run oc adm must-gather | ||
| command: oc adm must-gather --dest-dir={{ must_gather_dest }} | ||
| args: | ||
| creates: "{{ must_gather_dest }}/cluster-scoped-resources" | ||
| register: must_gather_output | ||
|
|
||
| - debug: | ||
| var: must_gather_output.stdout_lines | ||
|
|
||
| - name: Set permissions for must-gather directory | ||
| file: | ||
| path: "{{ must_gather_dest }}" | ||
| owner: root | ||
| group: root | ||
| mode: '0755' | ||
| state: directory | ||
|
|
||
| - name: Compress must-gather logs | ||
| command: tar -czf {{ must_gather_archive }} -C {{ must_gather_dest | dirname }} {{ must_gather_dest | basename }} | ||
| args: | ||
| creates: "{{ must_gather_archive }}" | ||
|
|
||
| - name: Set permissions for must-gather tarball | ||
| file: | ||
| path: "{{ must_gather_archive }}" | ||
| owner: root | ||
| group: root | ||
| mode: '0644' | ||
| state: file |
Empty file.
This file contains hidden or 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,86 @@ | ||
| --- | ||
| - name: Create PPC pod with affinity | ||
| kubernetes.core.k8s: | ||
| state: present | ||
| definition: | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: ppc-pod | ||
| namespace: default | ||
| spec: | ||
| affinity: | ||
| nodeAffinity: | ||
| preferredDuringSchedulingIgnoredDuringExecution: | ||
| - weight: 70 | ||
| preference: | ||
| matchExpressions: | ||
| - key: kubernetes.io/arch | ||
| operator: In | ||
| values: | ||
| - ppc64le | ||
| - weight: 30 | ||
| preference: | ||
| matchExpressions: | ||
| - key: kubernetes.io/arch | ||
| operator: NotIn | ||
| values: | ||
| - ppc64le | ||
| containers: | ||
| - name: web | ||
| image: registry.redhat.io/ubi8/pause | ||
|
|
||
| - name: Create x86 pod with anti-affinity | ||
| kubernetes.core.k8s: | ||
| state: present | ||
| definition: | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: x86-pod | ||
| namespace: default | ||
| spec: | ||
| affinity: | ||
| nodeAffinity: | ||
| preferredDuringSchedulingIgnoredDuringExecution: | ||
| - weight: 30 | ||
| preference: | ||
| matchExpressions: | ||
| - key: kubernetes.io/arch | ||
| operator: In | ||
| values: | ||
| - ppc64le | ||
| - weight: 70 | ||
| preference: | ||
| matchExpressions: | ||
| - key: kubernetes.io/arch | ||
| operator: NotIn | ||
| values: | ||
| - ppc64le | ||
| containers: | ||
| - name: web | ||
| image: registry.redhat.io/ubi8/pause | ||
|
|
||
| - name: Wait until pods are running | ||
| command: oc get pods -n default --no-headers | ||
| register: pod_status | ||
| until: "'Running' in pod_status.stdout" | ||
| retries: 10 | ||
| delay: 10 | ||
|
|
||
| - name: Launch multiple pause pods | ||
| shell: | | ||
| for n in $(seq 1 60); do | ||
| oc run pause-pod-$n --image=ubi8/pause:8.8-9 -n default | ||
| done | ||
|
|
||
| - name: Verify all pods running | ||
| command: oc get pods -n default -o wide | ||
| register: pause_pod_status | ||
| changed_when: false | ||
|
|
||
| - debug: | ||
| msg: "{{ pause_pod_status.stdout_lines }}" | ||
|
|
||
| - name: Cleanup - delete all pods | ||
| command: oc delete pods --all -n default |
This file contains hidden or 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,79 @@ | ||
| --- | ||
| - name: Create and debug pods with node affinity | ||
| # hosts: bastion | ||
| tasks: | ||
|
|
||
| - name: Create PPC pod with affinity (ppc64le) | ||
| kubernetes.core.k8s: | ||
| state: present | ||
| definition: | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: ppc-pod | ||
| namespace: default | ||
| spec: | ||
| affinity: | ||
| nodeAffinity: | ||
| requiredDuringSchedulingIgnoredDuringExecution: | ||
| nodeSelectorTerms: | ||
| - matchExpressions: | ||
| - key: kubernetes.io/arch | ||
| operator: In | ||
| values: [ppc64le] | ||
| containers: | ||
| - name: web | ||
| image: registry.redhat.io/ubi8/pause | ||
|
|
||
| - name: Create x86 pod with affinity (amd64) | ||
| kubernetes.core.k8s: | ||
| state: present | ||
| definition: | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: x86-pod | ||
| namespace: default | ||
| spec: | ||
| affinity: | ||
| nodeAffinity: | ||
| requiredDuringSchedulingIgnoredDuringExecution: | ||
| nodeSelectorTerms: | ||
| - matchExpressions: | ||
| - key: kubernetes.io/arch | ||
| operator: In | ||
| values: [amd64] | ||
| containers: | ||
| - name: web | ||
| image: registry.redhat.io/ubi8/pause | ||
|
|
||
| - name: Wait for both pods to be Running | ||
| shell: oc get pods ppc-pod x86-pod -n default --no-headers | ||
| register: pod_status | ||
| until: "'Running' in pod_status.stdout" | ||
| retries: 10 | ||
| delay: 10 | ||
|
|
||
| - name: Show pod status | ||
| command: oc get pods -o wide -n default | ||
| register: pod_list | ||
| changed_when: false | ||
|
|
||
| - debug: | ||
| msg: "{{ pod_list.stdout_lines }}" | ||
|
|
||
| - name: Debug x86 pod (ls inside container) | ||
| shell: | | ||
| oc debug pod/x86-pod -n default -- ls | ||
| register: debug_x86 | ||
|
|
||
| - debug: | ||
| msg: "{{ debug_x86.stdout_lines }}" | ||
|
|
||
| - name: Debug ppc pod (ls inside container) | ||
| shell: | | ||
| oc debug pod/ppc-pod -n default -- ls | ||
| register: debug_ppc | ||
|
|
||
| - debug: | ||
| msg: "{{ debug_ppc.stdout_lines }}" |
This file contains hidden or 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,5 @@ | ||
| --- | ||
| - name: Deploy and verify arch-specific pods | ||
| hosts: bastion | ||
| roles: | ||
| - smoke-test |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the file permission to the /home/must_gather_logs . once it's created .
even for /home/must-gather-logs.tar.gz .