ibm-mas / ansible-devops

Ansible collection supporting devops for IBM Maximo Application Suite
https://ibm-mas.github.io/ansible-devops/
Eclipse Public License 2.0
49 stars 88 forks source link

[minor] Lookup supported kafka version based on installed Strimzi operator version #1240

Closed andrercm closed 6 months ago

andrercm commented 7 months ago

This PR adds a task that validates that the kafka_version set is supported by the installed Strimzi operator. It will store the `https://strimzi.io/downloads/ website content (which contains the mapping between operator version vs supported kafka versions) into a variable and parse it to a dict, then we can extract the supported kafka version list based upon the current installed csv.

Note: This only works for Strimzi as long as the above page remains in this html structure

Could not find the corresponding information for Red Hat AMQ Streams, but if we ever do, hopefully this can be reused.

This task will determine if the existing kafka_version is included in the kafka_supported_versions list, and if not, it will set kafka_version to the latest result from the kafka_supported_versions, that way we'll never get failures whenever there's a newer strimzi operator version supporting newer kafka versions.

Test example:

If kafka_version is initially set to 3.5.0, but operator only supports ['3.6.0', '3.6.1', '3.7.0'], then it will automatically set kafka_version: 3.7.0

TASK [ibm.mas_devops.kafka : Debug Kafka supported versions] *********************************************************************************************************
ok: [localhost] => {
    "msg": [
        "Supported kafka versions ................... ['3.6.0', '3.6.1', '3.7.0']",
        "Current kafka version defined .............. 3.5.0"
    ]
}

TASK [ibm.mas_devops.kafka : Set latest supported kafka version if current kafka version is unsupported] *************************************************************
ok: [localhost]

TASK [ibm.mas_devops.kafka : Kafka version defined] ******************************************************************************************************************
ok: [localhost] => {
    "msg": "3.7.0"
}