Skip to content

Commit

Permalink
Merge pull request #861 from IBM/fk-misc
Browse files Browse the repository at this point in the history
#853 Do not install OperatorGroup if already existing
  • Loading branch information
fketelaars authored Dec 15, 2024
2 parents a854777 + 4579a76 commit 4b09064
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 122 deletions.
14 changes: 14 additions & 0 deletions automation-roles/40-configure-infra/nfd-operator/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@
_p_command_description: Create Node Feature Discovery operator namespace
_p_command: "oc create ns openshift-nfd || true"

- name: Check if OpenShift NFD OperatorGroup already exists, to avoid creating another one
shell: |
oc get operatorgroups.operators.coreos.com -n openshift-nfd \
--no-headers | wc -l
register: _nfd_og

- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create NFD operator Group
_p_apply_yaml_template: nfd-operator-group.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nfd-operator-group.yaml"
when: _nfd_og.stdout == "0"

- name: Retrieve default channel for Node Feature Discovery manifest
shell:
oc get packagemanifest nfd -o jsonpath='{.status.defaultChannel}'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openshift-nfd-og
namespace: openshift-nfd
spec:
targetNamespaces:
- openshift-nfd
upgradeStrategy: Default
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openshift-nfd-og
namespace: openshift-nfd
spec:
targetNamespaces:
- openshift-nfd
upgradeStrategy: Default
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
Expand Down
14 changes: 14 additions & 0 deletions automation-roles/40-configure-infra/nvidia-operator/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@
_p_command_description: Create NVIDIA operator namespace nvidia-gpu-operator
_p_command: "oc create ns nvidia-gpu-operator || true"

- name: Check if NVIDIA GPU OperatorGroup already exists, to avoid creating another one
shell: |
oc get operatorgroups.operators.coreos.com -n nvidia-gpu-operator \
--no-headers | wc -l
register: _nvidia_og

- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create NVIDIA operator group
_p_apply_yaml_template: nvidia-operator-group.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-nvidia-operator-group.yaml"
when: _nvidia_og.stdout == "0"

- name: Retrieve default channel for the NVIDIA GPU manifest
shell:
oc get packagemanifest gpu-operator-certified -o jsonpath='{.status.defaultChannel}'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: nvidia-gpu-operator-og
namespace: nvidia-gpu-operator
spec:
targetNamespaces:
- nvidia-gpu-operator
upgradeStrategy: Default
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: nvidia-gpu-operator-og
namespace: nvidia-gpu-operator
spec:
targetNamespaces:
- nvidia-gpu-operator
upgradeStrategy: Default
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
Expand Down

This file was deleted.

95 changes: 94 additions & 1 deletion automation-roles/40-configure-infra/openshift-ai/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,95 @@
---
- include_tasks: install-opernshift-ai.yml

- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create OpenShift AI namespaces
_p_apply_yaml_template: openshift-ai-ns.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/openshift-{{ _p_openshift_cluster.name }}-openshift-ai-ns.yaml"

- name: Check if OpenShift AI OperatorGroup already exists, to avoid creating another one
shell: |
oc get operatorgroups.operators.coreos.com -n redhat-ods-operator \
--no-headers | wc -l
register: _openshift_ai_og

- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create OpenShift AI operator group
_p_apply_yaml_template: openshift-ai-operator-group.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-openshift-ai-operator-group.yaml"
when: _openshift_ai_og.stdout == "0"

- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create OpenShift AI operator
_p_apply_yaml_template: openshift-ai-operator.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/{{ _p_openshift_cluster.name }}-openshift-ai-operator.yaml"

- name: Wait until OpenShift AI operator CSV has status Succeeded
shell: |
oc get csv -n redhat-ods-operator \
-l operators.coreos.com/rhods-operator.redhat-ods-operator \
--no-headers \
-o custom-columns='name:metadata.name,phase:status.phase' | \
grep -i succeeded | wc -l
register: _openshift_ai_csv_status
retries: 30
delay: 30
until: _openshift_ai_csv_status.stdout == "1"
vars:
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) ...
when: not cpd_dry_run

- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create OpenShift AI DSCInitialization
_p_apply_yaml_template: dscinitialization.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/openshift-{{ _p_openshift_cluster.name }}-openshift-ai-dsc-init.yaml"

- name: Wait until OpenShift AI DSCInitialization default-dsci is ready
shell: |
oc get DSCInitialization default-dsci \
--no-headers \
-o custom-columns='name:metadata.name,phase:status.phase' | \
grep -i ready | wc -l
register: _openshift_ai_dsc_init_status
retries: 30
delay: 30
until: _openshift_ai_dsc_init_status.stdout == "1"
vars:
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) ...
when: not cpd_dry_run

- include_role:
name: generate-apply-yaml
vars:
_p_apply_yaml_description: Create OpenShift AI DataScienceCluster
_p_apply_yaml_template: datasciencecluster.j2
_p_apply_yaml_output_file: "{{ status_dir }}/openshift/openshift-{{ _p_openshift_cluster.name }}-openshift-ai-dsc.yaml"

- name: Wait until OpenShift AI DataScienceCluster default-dsc is ready
shell: |
oc get DataScienceCluster default-dsc \
--no-headers \
-o custom-columns='name:metadata.name,phase:status.phase' | \
grep -i ready | wc -l
register: _openshift_ai_dsc_status
retries: 30
delay: 30
until: _openshift_ai_dsc_status.stdout == "1"
vars:
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) ...
when: not cpd_dry_run
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: redhat-ods-operator
---
apiVersion: v1
kind: Namespace
metadata:
name: redhat-ods-monitoring
---
apiVersion: v1
kind: Namespace
metadata:
name: redhat-ods-applications
---
apiVersion: v1
kind: Namespace
metadata:
name: rhods-notebooks
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: redhat-ods-operator
namespace: redhat-ods-operator
spec:
upgradeStrategy: Default
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: redhat-ods-operator
---
apiVersion: v1
kind: Namespace
metadata:
name: redhat-ods-monitoring
---
apiVersion: v1
kind: Namespace
metadata:
name: redhat-ods-applications
---
apiVersion: v1
kind: Namespace
metadata:
name: rhods-notebooks
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: redhat-ods-operator
namespace: redhat-ods-operator
spec:
upgradeStrategy: Default
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
Expand Down

0 comments on commit 4b09064

Please sign in to comment.