Skip to content
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

Dry run option for CP4D and existing-ocp #844

Merged
merged 54 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
80d96a1
#820 Add --dry-run parameter
fketelaars Oct 29, 2024
50f7c81
#820 Create logging role
fketelaars Oct 29, 2024
fc70d36
#820 dry-run for global pull secret
fketelaars Oct 29, 2024
9283f27
#820 Ensure Ansible fails of apply global pull secret fails
fketelaars Oct 30, 2024
74f6d64
#820 Apply entitlement
fketelaars Oct 30, 2024
a515c15
Merge branch 'main' into dry-run
fketelaars Oct 31, 2024
cd2963b
#820 Cartridges dry-run
fketelaars Oct 31, 2024
7e0b628
#820 Fix typo
fketelaars Nov 1, 2024
8ab959a
#820 CP4D infra dependencies
fketelaars Nov 1, 2024
df2b565
#820 Log yaml file
fketelaars Nov 1, 2024
674f8bb
#820 Catalog sources
fketelaars Nov 1, 2024
b1ae00e
#820 Delete cartridge
fketelaars Nov 1, 2024
4913c87
#820 Fix apply cartridges
fketelaars Nov 1, 2024
6c37d89
#820 Fix typo
fketelaars Nov 1, 2024
83ea718
#820 Dry-run for CP4D cluster
fketelaars Nov 1, 2024
61a918f
#820 Dry-run for scheduler
fketelaars Nov 1, 2024
76da56b
#820 Dry-run mirror images
fketelaars Nov 1, 2024
4ba36f3
#820 Dry-run for projects
fketelaars Nov 1, 2024
a51b0a2
#820 Node settings
fketelaars Nov 1, 2024
4ba7e43
#820 Subscriptinos
fketelaars Nov 1, 2024
c600716
#820 Dry-run OpenShift AI
fketelaars Nov 1, 2024
8955a1e
#820 Dry-run OpenShift console banner
fketelaars Nov 1, 2024
a59f36d
#820 Fix typo
fketelaars Nov 1, 2024
891d9b4
#820 Dry-run for Keycloak
fketelaars Nov 1, 2024
6d9250f
#820 Dry-run for OpenShift ADP
fketelaars Nov 1, 2024
d7ff15f
#820 Dry-run for OpenLDAP
fketelaars Nov 3, 2024
25e9aa4
Merge branch 'main' into dry-run
fketelaars Nov 4, 2024
56cfa7b
Merge branch 'main' into dry-run
fketelaars Nov 4, 2024
178dd36
#820 Wrong variable for console banner
fketelaars Nov 8, 2024
65b2048
#820 Create catalog fails with dry-run
fketelaars Nov 8, 2024
c41538b
#820 Skip SSL certificate
fketelaars Nov 20, 2024
ea1ab0d
#820 CP4D Audit dry-run
fketelaars Nov 23, 2024
b19e4b3
#820 LDAP dry-run
fketelaars Nov 23, 2024
b7c77bf
#820 CP4D instances
fketelaars Nov 25, 2024
18f5d91
#820 Skip smoke test with dry-run
fketelaars Nov 25, 2024
f15d4b5
#820 Apply yaml using role
fketelaars Nov 26, 2024
bbbb4b6
#820 Unify execution of command with dry-run
fketelaars Nov 26, 2024
d3758d0
#820 Refactor run-command
fketelaars Nov 30, 2024
2fee1fb
#820 Register variabled
fketelaars Nov 30, 2024
ba01342
#820 Start with clean activities log
fketelaars Nov 30, 2024
e1abb22
#820 Refactor run-command
fketelaars Dec 1, 2024
9aafd05
#820 Additional dry-run conditions
fketelaars Dec 1, 2024
5e28328
#820 Handle dry-run for destroy
fketelaars Dec 2, 2024
c64f6e9
#820 Fix wxo
fketelaars Dec 2, 2024
16d5d8a
#820 Remove path from apply-cr
fketelaars Dec 2, 2024
8dd05d2
#820 Remove /opt/ansible from command path
fketelaars Dec 3, 2024
ba45b52
#820 Fix wxo command
fketelaars Dec 3, 2024
c7a984d
#820 Fix apply cluster components
fketelaars Dec 3, 2024
940b0db
#820 Retry knative eventing
fketelaars Dec 3, 2024
a1ddec6
#820 Completion message
fketelaars Dec 3, 2024
6f78c9e
#820 Typo in activities output file
fketelaars Dec 3, 2024
5acc690
#820 Run DNS through dry-run
fketelaars Dec 3, 2024
cd915ba
#820 Fix typo
fketelaars Dec 3, 2024
cfa3881
#820 Dry-run for MCO
fketelaars Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@
fail: msg="cloud_platform {{ cloud_platform }} only support values {{ supported_cloud_platform_types }} "
when: "cloud_platform not in supported_cloud_platform_types"

- include_tasks: ibmcloud-validate-variables.yml
- name: "Fail if dry-run specified for other cloud platform than existing-ocp"
fail:
msg: "--dry-run can only be specified for existing-ocp"
when:
- cloud_platform == 'ibm-cloud'
- cpd_dry_run | bool
- cloud_platform != 'existing-ocp'

- include_tasks: ibmcloud-validate-variables.yml
when: cloud_platform == 'ibm-cloud'

- include_tasks: aws-validate-variables.yml
when:
- cloud_platform == 'aws'
when: cloud_platform == 'aws'

- include_tasks: azure-validate-variables.yml
when:
- cloud_platform == 'azure'
when: cloud_platform == 'azure'

- name: Fail if destroy was not confirmed
fail:
msg: "Destroy was not confirmed with --confirm-destroy parameter or via global_config confirm_destroy property"
when:
- _confirm_destroy | bool != True
- _confirm_destroy | bool != True
- not cpd_dry_run
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
fail: msg="cloud_platform {{ cloud_platform }} only support values {{ supported_cloud_platform_types }} "
when: "cloud_platform not in supported_cloud_platform_types"

- name: "Fail if dry-run specified for other cloud platform than existing-ocp"
fail:
msg: "--dry-run can only be specified for existing-ocp"
when:
- cpd_dry_run | bool
- cloud_platform != 'existing-ocp'

- include_tasks: ibmcloud-validate-variables.yml
when:
- cloud_platform == 'ibm-cloud'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@
repo: "{{ _cntk_github_repo }}"
dest: "{{ status_dir }}/openshift/multi-tenancy-gitops"

- name: Install GitOps operator
shell: |
oc apply -f {{ status_dir }}/openshift/multi-tenancy-gitops/setup/ocp4x
- name: 'Lookup *.yaml files in {{ status_dir }}/openshift/multi-tenancy-gitops'
find:
paths: '{{ status_dir }}/openshift/multi-tenancy-gitops'
file_type: any
patterns: '*.yaml'
follow: False
recurse: False
register: _gitops_yaml_files

- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: "Install GitOps operator"
_p_apply_yaml_output_file: "{{ item.path }}"
loop: '{{ _gitops_yaml_files.files }}'

- name: Wait until OpenShift GitOps CSV has status Succeeded
shell: |
Expand All @@ -30,11 +42,13 @@
{%- set result = ansible_callback_diy.result.output -%}
{%- set retries_left = result.retries - result.attempts -%}
Retrying: {{ ansible_callback_diy.task.name }} ({{ retries_left }} Retries left) ...
when: not cpd_dry_run

- name: Create ArgoCD instance
shell: |
oc apply -f {{ status_dir }}/openshift/multi-tenancy-gitops/setup/ocp4x/argocd-instance/argocd-instance.yaml \
-n openshift-gitops
- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: "Create ArgoCD instance"
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/multi-tenancy-gitops/setup/ocp4x/argocd-instance/argocd-instance.yaml"

- name: Wait until ArgoCD instance has been created in OpenShift project openshift-gitops
shell: |
Expand All @@ -49,5 +63,6 @@
{%- set result = ansible_callback_diy.result.output -%}
{%- set retries_left = result.retries - result.attempts -%}
Retrying: {{ ansible_callback_diy.task.name }} ({{ retries_left }} Retries left) ...
when: not cpd_dry_run

when: (_p_openshift_cluster.cloud_native_toolkit | default(False) | bool)
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
that:
- _p_upstream_dns is defined

- shell: |
echo '{{ lookup('template','dns.j2',convert_data=False) | string }}'

- name: Patch the DNS custom resource
shell:
oc patch dns.operator/default \
--type=json \
-p '[{"op":"replace","path":"/spec/servers","value":{{ lookup('template','dns.j2',convert_data=False) }} }]' -o yaml
- include_role:
name: run-command
vars:
_p_command_description: Patch the DNS custom resource
_p_command: oc patch dns.operator/default --type=json -p '[{"op":"replace","path":"/spec/servers","value":{{ lookup('template','dns.j2',convert_data=False) }} }]' -o yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@
state: directory
mode: u+rwx

- name: Create Project {{ _openldap_project_name }}
ansible.builtin.include_role:
name: common
tasks_from: create-project
- include_role:
name: run-command
vars:
common_namespace_name: "{{ _openldap_project_name }}"
common_output_directory: "{{ _v_openldap_base_dir }}"
_p_command_description: Create project {{ _openldap_project_name }}
_p_command: "oc adm new-project {{ _openldap_project_name }} || true"

- name: Prepare OpenLDAP yaml file for cluster {{ current_openshift_cluster.name }}
ansible.builtin.template:
Expand All @@ -62,6 +60,12 @@
- deployments
- services

- include_role:
name: log-deployer-activity
vars:
_p_activity_description: "Install OpenLDAP"
_p_activity_yaml: "{{ _v_openldap_base_dir }}/{{ current_openshift_cluster.name }}-{{ _current_demo_openldap.name }}-openldap-{{ item }}.yaml"

- name: Add OpenLDAP item {{ item.name }}
kubernetes.core.k8s:
state: present
Expand All @@ -74,4 +78,5 @@
- {name: secrets, wait_sleep: 15, wait_timeout: 15}
- {name: persistentvolumeclaims, wait_sleep: 15, wait_timeout: 300}
- {name: deployments, wait_sleep: 15, wait_timeout: 600}
- {name: services, wait_sleep: 15, wait_timeout: 15}
- {name: services, wait_sleep: 15, wait_timeout: 15}
when: not cpd_dry_run
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
- name: Remove OpenShift project {{ _openldap_project_name }}
kubernetes.core.k8s:
state: absent
api_version: project.openshift.io/v1
kind: Project
name: "{{ _openldap_project_name }}"
wait: true
wait_sleep: 15
wait_timeout: 120
- include_role:
name: run-command
vars:
_p_command_description: Delete project {{ _openldap_project_name }}
_p_command: "oc delete ns {{ _openldap_project_name }} --ignore-not-found"
39 changes: 19 additions & 20 deletions automation-roles/40-configure-infra/nfd-operator/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
- name: Create openshift-nfd OpenShift project
shell: |
oc create ns openshift-nfd || true
- include_role:
name: run-command
vars:
_p_command_description: Create Node Feature Discovery operator namespace
_p_command: "oc create ns openshift-nfd || true"

- name: Retrieve default channel for Node Feature Discovery manifest
shell:
Expand All @@ -11,18 +13,16 @@
- set_fact:
_nfd_channel: "{{ _nfd_packagemanifest.stdout }}"

- name: Generate NFD operator file {{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-operator.yaml
template:
src: nfd-operator.j2
dest: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-operator.yaml"

- name: Create NFD operator
shell: |
oc apply -f {{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-operator.yaml
- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create NFD operator
_p_apply_yaml_template: nfd-operator.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-operator.yaml"

- name: Wait until NFD Operator CSV has status Succeeded
shell: |
oc get csv -n openshift-nfd \
oc get csv -n openshift-nfd \
-l operators.coreos.com/nfd.openshift-nfd \
--no-headers \
-o custom-columns='name:metadata.name,phase:status.phase' | \
Expand All @@ -36,16 +36,15 @@
{%- set result = ansible_callback_diy.result.output -%}
{%- set retries_left = result.retries - result.attempts -%}
Retrying: {{ ansible_callback_diy.task.name }} ({{ retries_left }} Retries left) ...
when: not cpd_dry_run

- name: Get OpenShift version
include_role:
name: openshift-get-version

- name: Generate NodeFeatureDiscovery CR file {{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-cr.yaml
template:
src: nfd-cr.j2
dest: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-cr.yaml"

- name: Create NFD CR
shell: |
oc apply -f {{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-cr.yaml
- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Generate NodeFeatureDiscovery CR
_p_apply_yaml_template: nfd-cr.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-cr.yaml"
48 changes: 24 additions & 24 deletions automation-roles/40-configure-infra/nvidia-operator/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
- name: Create nvidia-gpu-operator OpenShift project
shell: |
oc create ns nvidia-gpu-operator || true
- include_role:
name: run-command
vars:
_p_command_description: Create NVIDIA operator namespace nvidia-gpu-operator
_p_command: "oc create ns nvidia-gpu-operator || true"

- name: Retrieve default channel for the NVIDIA GPU manifest
shell:
Expand All @@ -11,18 +13,16 @@
- set_fact:
_nvidia_channel: "{{ _nvidia_packagemanifest.stdout }}"

- name: Generate NVIDIA operator file {{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-operator.yaml
template:
src: nvidia-operator.j2
dest: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-operator.yaml"

- name: Create NVIDIA operator
shell: |
oc apply -f {{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-operator.yaml
- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create NVIDIA operator
_p_apply_yaml_template: nvidia-operator.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-operator.yaml"

- name: Wait until NVIDIA Operator CSV has status Succeeded
shell: |
oc get csv -n nvidia-gpu-operator \
oc get csv -n nvidia-gpu-operator \
-l operators.coreos.com/gpu-operator-certified.nvidia-gpu-operator \
--no-headers \
-o custom-columns='name:metadata.name,phase:status.phase' | \
Expand All @@ -36,22 +36,21 @@
{%- set result = ansible_callback_diy.result.output -%}
{%- set retries_left = result.retries - result.attempts -%}
Retrying: {{ ansible_callback_diy.task.name }} ({{ retries_left }} Retries left) ...
when: not cpd_dry_run

- name: Generate NVIDIA ClusterPolicy CR file {{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-cluster-policy-cr.yaml
template:
src: nvidia-cluster-policy-cr.j2
dest: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-cluster-policy-cr.yaml"

- name: Create NVIDIA ClusterPolicy CR
shell: |
oc apply -f {{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-cluster-policy-cr.yaml
- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Generate NVIDIA ClusterPolicy CR
_p_apply_yaml_template: nvidia-cluster-policy-cr.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-cluster-policy-cr.yaml"

- name: Wait until NVIDIA ClusterPolicy has status Ready
shell: |
oc get clusterpolicies.nvidia.com gpu-cluster-policy \
--no-headers \
-o custom-columns='name:metadata.name,phase:status.state' | \
grep -i ready | wc -l
--no-headers \
-o custom-columns='name:metadata.name,phase:status.state' | \
grep -i ready | wc -l
register: _nvidia_cluster_policy_status
retries: 30
delay: 30
Expand All @@ -60,4 +59,5 @@
ansible_callback_diy_runner_retry_msg: >-
{%- set result = ansible_callback_diy.result.output -%}
{%- set retries_left = result.retries - result.attempts -%}
Retrying: {{ ansible_callback_diy.task.name }} ({{ retries_left }} Retries left) ...
Retrying: {{ ansible_callback_diy.task.name }} ({{ retries_left }} Retries left) ...
when: not cpd_dry_run
Loading
Loading