Skip to content

Need better way of checking version in Ansible based installation #6108

@bingoarun

Description

@bingoarun

Ansible based installation fails with specific Kubernetes versions. (>= 1.10)

https://github.com/istio/istio/blob/master/install/ansible/istio/tasks/main.yml
Line number 27 to 30

- assert:
    that:
      - "vo.stdout >= minimum_cluster_version"
    msg: "Cluster version must be at least {{ minimum_cluster_version }}"

This way of comparison will work for only single digit version numbers and not for double digit.

>>> "1.10.0" > "1.7.0"
False
>>> "1.6.0" > "1.7.0"
False
>>> "1.8.0" > "1.7.0"
True

Playbook failed example

TASK [istio : print vo] *****************************************************************************************************************************
task path: /home/arun/Projects/bingoarun/istio/install/ansible/istio/tasks/main.yml:27
ok: [localhost] => {
    "vo": {
        "changed": true, 
        "cmd": "kubectl version | sed -En \"s/Server Version.*GitVersion.*v([[:digit:]]*\\.[[:digit:]]*\\.[[:digit:]]*).*/\\1/p\" | tail -1", 
        "delta": "0:00:00.097379", 
        "end": "2018-06-08 17:57:48.440238", 
        "failed": false, 
        "rc": 0, 
        "start": "2018-06-08 17:57:48.342859", 
        "stderr": "", 
        "stderr_lines": [], 
        "stdout": "1.10.0", 
        "stdout_lines": [
            "1.10.0"
        ]
    }
}

TASK [istio : assert] *******************************************************************************************************************************
task path: /home/arun/Projects/bingoarun/istio/install/ansible/istio/tasks/main.yml:31
fatal: [localhost]: FAILED! => {
    "assertion": "vo.stdout >= minimum_cluster_version", 
    "changed": false, 
    "evaluated_to": false, 
    "msg": "Cluster version must be at least 1.7.0"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions