Skip to content

Commit

Permalink
Add retries in ocp4_workload_rhacs (#9023)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkupferer authored Jan 30, 2025
1 parent 21d7ae3 commit bd1ad06
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
name: central
namespace: stackrox
register: r_acs_portal_route
until: r_acs_portal_route is successful
retries: 30
delay: 5

- name: Get Web Console route
kubernetes.core.k8s_info:
Expand All @@ -15,13 +18,19 @@
namespace: openshift-console
name: console
register: r_console_route
until: r_console_route is successful
retries: 30
delay: 5

- name: Get API server URL
kubernetes.core.k8s_info:
api_version: config.openshift.io/v1
kind: Infrastructure
name: cluster
register: r_api_url
until: r_api_url is successful
retries: 30
delay: 5

- name: Set fact for ACS route
ansible.builtin.set_fact:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
api_version: v1
kind: Namespace
name: stackrox
register: r_k8s
until: r_k8s is successful
retries: 30
delay: 5

- name: Delete rbac
ansible.builtin.shell: oc get clusterrole,clusterrolebinding,role,rolebinding,psp -o name | grep stackrox | xargs oc delete --wait
Expand All @@ -24,6 +28,10 @@
api_versionersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
name: stackrox
register: r_k8s
until: r_k8s is successful
retries: 30
delay: 5

- name: remove all labels from all namespaces
ansible.builtin.shell: >-
Expand Down
24 changes: 24 additions & 0 deletions ansible/roles_ocp_workloads/ocp4_workload_rhacs/tasks/workload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
api_version: v1
kind: Namespace
name: stackrox
register: r_k8s
until: r_k8s is successful
retries: 30
delay: 5

- name: Generate random password for Central admin
ansible.builtin.set_fact:
Expand All @@ -46,11 +50,19 @@
data:
password: "{{ ocp4_workload_rhacs_central_admin_password | b64encode }}"
type: Opaque
register: r_k8s
until: r_k8s is successful
retries: 30
delay: 5

- name: Create Central via CR
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'central.yaml.j2') | from_yaml }}"
register: r_k8s
until: r_k8s is successful
retries: 30
delay: 5

- name: Get Central route
kubernetes.core.k8s_info:
Expand Down Expand Up @@ -129,6 +141,10 @@
namespace: stackrox
state: present
definition: "{{ f_stackrox_bundle }}"
register: r_k8s
until: r_k8s is successful
retries: 30
delay: 5

- name: Install Sensor on OpenShift Container Platform
kubernetes.core.k8s:
Expand All @@ -153,6 +169,10 @@
collection: EBPF
imageFlavor: Regular
taintToleration: TolerateTaints
register: r_k8s
until: r_k8s is successful
retries: 30
delay: 5

- name: Wait for ready sensor
kubernetes.core.k8s_info:
Expand Down Expand Up @@ -182,6 +202,10 @@
href: 'https://{{ f_stackrox_central_addr }}'
location: ApplicationMenu
text: Red Hat Advanced Cluster Security for Kubernetes
register: r_k8s
until: r_k8s is successful
retries: 30
delay: 5

- name: Get roxctl
become: true
Expand Down

0 comments on commit bd1ad06

Please sign in to comment.