From 5a78d8db791de919900ded0c82397f865a99dfb3 Mon Sep 17 00:00:00 2001 From: Beto Rodriguez Date: Tue, 26 Nov 2024 16:11:01 -0600 Subject: [PATCH] Remove special cast for starting_csv --- roles/olm_operator/README.md | 2 +- roles/olm_operator/tasks/main.yml | 48 +------------------------------ 2 files changed, 2 insertions(+), 48 deletions(-) diff --git a/roles/olm_operator/README.md b/roles/olm_operator/README.md index 6e7ee2bcd..9efe5197c 100644 --- a/roles/olm_operator/README.md +++ b/roles/olm_operator/README.md @@ -7,7 +7,7 @@ Role to deploy an OLM-based operator. Name | Required | Default | Description --------------------------- |-----------|------------------------|-------------------------------------- channel | No | \ | The default channel of the operator is calculated and used when undefined -install_approval | No | Manual | Operator install plan approval mode, either Automatic or Manual (default) +install_approval | No | Manual | Operator install plan approval mode after initial installation, either Automatic or Manual namespace | Yes | undefined | Namespace where the operator will be installed ns_labels | No | {} | Dictionary of labels (name: value) to be assigned to the operator namespace operator | Yes | undefined | Name of the operator to install diff --git a/roles/olm_operator/tasks/main.yml b/roles/olm_operator/tasks/main.yml index bc323fa70..9d2343913 100644 --- a/roles/olm_operator/tasks/main.yml +++ b/roles/olm_operator/tasks/main.yml @@ -130,7 +130,7 @@ namespace: "{{ namespace }}" spec: channel: "{{ desired_channel }}" - installPlanApproval: "{{ starting_csv | default('') | length | ternary('Manual', 'Automatic') }}" + installPlanApproval: "Automatic" config: resources: {} name: "{{ operator }}" @@ -138,52 +138,6 @@ sourceNamespace: "{{ source_ns }}" startingCSV: "{{ operator_csv }}" - - name: Wait for subscription to be ready - community.kubernetes.k8s_info: - api: operators.coreos.com/v1alpha1 - kind: Subscription - namespace: "{{ namespace }}" - name: "{{ operator }}" - register: sub - retries: 20 - delay: 30 - until: - - sub.resources is defined - - sub.resources | length == 1 - - "'status' in sub.resources[0]" - - sub.resources[0].status.installedCSV is defined - - sub.resources[0].status.installedCSV == operator_csv - - - name: Handle with a starting CSV - when: - - starting_csv | default('') | length - block: - - name: Get Install plans for {{ operator }} - community.kubernetes.k8s_info: - api: operators.coreos.com/v1alpha1 - kind: InstallPlan - namespace: "{{ namespace }}" - register: _oo_install_plans - retries: 5 - delay: 5 - until: - - _oo_install_plans.resources is defined - - _oo_install_plans.resources | length - - - name: Approve install plan for specific CSV - community.kubernetes.k8s: - definition: - apiVersion: operators.coreos.com/v1alpha1 - kind: InstallPlan - metadata: - name: "{{ install_plan }}" - namespace: "{{ namespace }}" - spec: - approved: true - vars: - query: "resources[? spec.approved == `false` && contains(spec.clusterServiceVersionNames, '{{ operator_csv }}')]" - install_plan: "{{ (_oo_install_plans | json_query(query) | first).metadata.name }}" - - name: Wait for CSV to be ready community.kubernetes.k8s_info: api: operators.coreos.com/v1alpha1