From bb19f8430e8508b14a19371abcc5e08dffc0222a Mon Sep 17 00:00:00 2001 From: John Mazzitelli Date: Thu, 12 Sep 2024 10:06:40 -0400 Subject: [PATCH 1/2] require spec.version to be set in Kiali CR and OSSMConsole CR. fixes: https://github.com/kiali/kiali/issues/7741 --- IMPLEMENTATION.adoc | 2 +- playbooks/default-playbook.yml | 1 - playbooks/kiali-deploy.yml | 16 +++++++++++----- playbooks/kiali-remove.yml | 8 +------- playbooks/ossmconsole-deploy.yml | 25 ++++++++++++++++++++----- playbooks/ossmconsole-remove.yml | 8 +------- 6 files changed, 34 insertions(+), 26 deletions(-) delete mode 100644 playbooks/default-playbook.yml diff --git a/IMPLEMENTATION.adoc b/IMPLEMENTATION.adoc index f982a97d..bf7adf87 100644 --- a/IMPLEMENTATION.adoc +++ b/IMPLEMENTATION.adoc @@ -18,7 +18,7 @@ The KO can support installing multiple versions of the Kiali server and OSSMC by NOTE: If you need to add support for a new version or remove support for an obsolete version, see link:./DEVELOPING.adoc[DEVELOPING.adoc] for those instructions. -To tell the KO which version of Kiali or OSSMC to install, you set the `spec.version` field in the Kiali CR or OSSMConsole CR. If no `spec.version` is defined in the CR, the default Ansible role that is executed is defined in link:https://github.com/kiali/kiali-operator/blob/master/playbooks/default-playbook.yml[default-playbook.yml] (side note: the file, and the field inside it, are technically named incorrectly. This isn't the default _playbook_, instead it is the default _role_. But ignore that.) Today, the default version of the Ansible role that is invoked is called, literally, link:https://github.com/kiali/kiali-operator/tree/master/roles/default[default]. This `default` version is the only one that the upstream Kiali project officially supports. This version support is provided for use by other products that want to retain support for earlier Kiali versions (such as Red Hat OpenShift Service Mesh). +To tell the KO which version of Kiali or OSSMC to install, you must set the `spec.version` field in the Kiali CR or OSSMConsole CR. If no `spec.version` is defined in the CR, an error will result and the KO will abort. To use the default Ansible role, set `spec.version` to the literal string `default`. That default version of the Ansible role is called, literally, link:https://github.com/kiali/kiali-operator/tree/master/roles/default[default]. This `default` version is the only one that the upstream Kiali project officially supports. This version support is provided for use by other products that want to retain support for earlier Kiali versions (such as Red Hat OpenShift Service Mesh). == Main Ansible Playbooks diff --git a/playbooks/default-playbook.yml b/playbooks/default-playbook.yml deleted file mode 100644 index a55a813d..00000000 --- a/playbooks/default-playbook.yml +++ /dev/null @@ -1 +0,0 @@ -playbook: default diff --git a/playbooks/kiali-deploy.yml b/playbooks/kiali-deploy.yml index d486f4a4..6ae797ae 100644 --- a/playbooks/kiali-deploy.yml +++ b/playbooks/kiali-deploy.yml @@ -21,14 +21,20 @@ set_fact: playbook_time_start: "{{ '%Y-%m-%d %H:%M:%S' | strftime }}" - - name: Determine the default playbook - include_vars: - file: "default-playbook.yml" - name: default_playbook + - name: Ensure spec.version is specified - we must be told which version to install, abort otherwise + fail: + msg: | + The CR is missing the spec.version field. + You must explicitly indicate which version you want. + The spec.version field must be either the literal string 'default' or + one of the supported versions in the form of 'vX.Y'. + Please consult the Kiali documentation for more details. + when: + - (version is not defined) or (version | length == 0) - name: Determine the version that is to be installed set_fact: - version: "{{ version | default(default_playbook.playbook) }}" + version: "{{ version }}" - name: If upgrade is in progress then run the old version-specific remove role to purge old install include_role: diff --git a/playbooks/kiali-remove.yml b/playbooks/kiali-remove.yml index 71dcbb59..61220615 100644 --- a/playbooks/kiali-remove.yml +++ b/playbooks/kiali-remove.yml @@ -17,15 +17,9 @@ set_fact: playbook_time_start: "{{ '%Y-%m-%d %H:%M:%S' | strftime }}" - - ignore_errors: yes - name: Determine the default playbook - include_vars: - file: "default-playbook.yml" - name: default_playbook - - ignore_errors: yes include_role: - name: "{{ version | default(default_playbook.playbook) }}/kiali-remove" + name: "{{ version | default('default') }}/kiali-remove" - ignore_errors: yes name: Playbook end time diff --git a/playbooks/ossmconsole-deploy.yml b/playbooks/ossmconsole-deploy.yml index 64d3edbb..c5c6857f 100644 --- a/playbooks/ossmconsole-deploy.yml +++ b/playbooks/ossmconsole-deploy.yml @@ -14,14 +14,29 @@ set_fact: playbook_time_start: "{{ '%Y-%m-%d %H:%M:%S' | strftime }}" - - name: Determine the default playbook - include_vars: - file: "default-playbook.yml" - name: default_playbook + - name: Ensure spec.version is specified - we must be told which version to install, abort otherwise + fail: + msg: | + The CR is missing the spec.version field. + You must explicitly indicate which version you want. + The spec.version field must be either the literal string 'default' or + one of the supported versions in the form of 'vX.Y'. + Please consult the Kiali documentation for more details. + when: + - (version is not defined) or (version | length == 0) - name: Determine the version that is to be installed set_fact: - version: "{{ version | default(default_playbook.playbook) }}" + version: "{{ version }}" + + - name: If upgrade is in progress then run the old version-specific remove role to purge old install + include_role: + name: "{{ _kiali_io_ossmconsole.status.specVersion }}/ossmconsole-remove" + when: + - skip_reconciliation is not defined or skip_reconciliation == False + - _kiali_io_ossmconsole.status is defined + - _kiali_io_ossmconsole.status.specVersion is defined + - version != _kiali_io_ossmconsole.status.specVersion - name: Determine the default supported images for all known versions include_vars: diff --git a/playbooks/ossmconsole-remove.yml b/playbooks/ossmconsole-remove.yml index dd3c71a9..8d9f77b7 100644 --- a/playbooks/ossmconsole-remove.yml +++ b/playbooks/ossmconsole-remove.yml @@ -17,15 +17,9 @@ set_fact: playbook_time_start: "{{ '%Y-%m-%d %H:%M:%S' | strftime }}" - - ignore_errors: yes - name: Determine the default playbook - include_vars: - file: "default-playbook.yml" - name: default_playbook - - ignore_errors: yes include_role: - name: "{{ version | default(default_playbook.playbook) }}/ossmconsole-remove" + name: "{{ version | default('default') }}/ossmconsole-remove" - ignore_errors: yes name: Playbook end time From 4bf690690430a1782ee5c01889ad0400d6c88ade Mon Sep 17 00:00:00 2001 From: John Mazzitelli Date: Mon, 16 Sep 2024 11:03:38 -0400 Subject: [PATCH 2/2] olm description change --- .../2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml | 4 ++-- .../kiali-ossm/manifests/kiali.clusterserviceversion.yaml | 4 ++-- .../2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/kiali-community/2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml b/manifests/kiali-community/2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml index acb9f7e7..cb45c128 100644 --- a/manifests/kiali-community/2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml +++ b/manifests/kiali-community/2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml @@ -162,7 +162,7 @@ spec: version: consolelinks.console.openshift.io/v1 specDescriptors: - displayName: Version - description: "The version of the Kiali Server to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When not specified, or when set to the string 'default', the latest supported version of the Kiali Server will be installed. Default: default" + description: "The version of the Kiali Server to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When set to the string 'default', the latest supported version of the Kiali Server will be installed. This setting must be explicitly specified." path: version x-descriptors: - 'urn:alm:descriptor:com.tectonic.ui:text' @@ -200,7 +200,7 @@ spec: version: v1 specDescriptors: - displayName: Version - description: "The version of OSSMC to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When not specified, or when set to the string 'default', the latest supported version of OSSMC will be installed. You must ensure this value is the same as the spec.version field in the Kiali CR that was used to install the Kiali Server, otherwise you are not guaranteed OSSMC will work properly. Default: default" + description: "The version of OSSMC to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When set to the string 'default', the latest supported version of OSSMC will be installed. You must ensure this value is the same as the spec.version field in the Kiali CR that was used to install the Kiali Server, otherwise you are not guaranteed OSSMC will work properly. This setting must be explicitly specified." path: version x-descriptors: - 'urn:alm:descriptor:com.tectonic.ui:text' diff --git a/manifests/kiali-ossm/manifests/kiali.clusterserviceversion.yaml b/manifests/kiali-ossm/manifests/kiali.clusterserviceversion.yaml index 4e1dea68..5de2c5a4 100644 --- a/manifests/kiali-ossm/manifests/kiali.clusterserviceversion.yaml +++ b/manifests/kiali-ossm/manifests/kiali.clusterserviceversion.yaml @@ -172,7 +172,7 @@ spec: version: consolelinks.console.openshift.io/v1 specDescriptors: - displayName: Version - description: "The version of the Kiali Server to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When not specified, or when set to the string 'default', the latest supported version of the Kiali Server will be installed. Default: default" + description: "The version of the Kiali Server to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When set to the string 'default', the latest supported version of the Kiali Server will be installed. This setting must be explicitly specified." path: version x-descriptors: - 'urn:alm:descriptor:com.tectonic.ui:text' @@ -210,7 +210,7 @@ spec: version: v1 specDescriptors: - displayName: Version - description: "The version of OSSMC to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When not specified, or when set to the string 'default', the latest supported version of OSSMC will be installed. You must ensure this value is the same as the spec.version field in the Kiali CR that was used to install the Kiali Server, otherwise you are not guaranteed OSSMC will work properly. Default: default" + description: "The version of OSSMC to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When set to the string 'default', the latest supported version of OSSMC will be installed. You must ensure this value is the same as the spec.version field in the Kiali CR that was used to install the Kiali Server, otherwise you are not guaranteed OSSMC will work properly. This setting must be explicitly specified." path: version x-descriptors: - 'urn:alm:descriptor:com.tectonic.ui:text' diff --git a/manifests/kiali-upstream/2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml b/manifests/kiali-upstream/2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml index d9788995..3a6b976f 100644 --- a/manifests/kiali-upstream/2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml +++ b/manifests/kiali-upstream/2.0.0/manifests/kiali.v2.0.0.clusterserviceversion.yaml @@ -142,7 +142,7 @@ spec: version: route.openshift.io/v1 specDescriptors: - displayName: Version - description: "The version of the Kiali Server to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When not specified, or when set to the string 'default', the latest supported version of the Kiali Server will be installed. Default: default" + description: "The version of the Kiali Server to install. This is specified in the form 'vX.Y'. Check the documentation for the values that are valid and supported. When set to the string 'default', the latest supported version of the Kiali Server will be installed. This setting must be explicitly specified." path: version x-descriptors: - 'urn:alm:descriptor:com.tectonic.ui:text'