Skip to content

Commit

Permalink
require spec.version to be set in Kiali CR and OSSMConsole CR.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmazzitelli committed Sep 12, 2024
1 parent cdca540 commit 278247f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion IMPLEMENTATION.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion playbooks/default-playbook.yml

This file was deleted.

16 changes: 11 additions & 5 deletions playbooks/kiali-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 1 addition & 7 deletions playbooks/kiali-remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 20 additions & 5 deletions playbooks/ossmconsole-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}/kiali-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:
Expand Down
8 changes: 1 addition & 7 deletions playbooks/ossmconsole-remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 278247f

Please sign in to comment.