Fix ansible syntax to avoid ansible deprecation warnings (#3512)

* failed

* version_compare

* succeeded

* skipped

* success

* version_compare becomes version since ansible 2.5

* ansible minimal version updated in doc and spec

* last version_compare
This commit is contained in:
Erwan Miran 2018-10-17 00:33:30 +02:00 committed by k8s-ci-robot
parent bfd4ccbeaa
commit 7bec169d58
75 changed files with 153 additions and 153 deletions

View file

@ -134,7 +134,7 @@ plugins can be deployed for a given single cluster.
Requirements Requirements
------------ ------------
- **Ansible v2.4 (or newer) and python-netaddr is installed on the machine - **Ansible v2.5 (or newer) and python-netaddr is installed on the machine
that will run Ansible commands** that will run Ansible commands**
- **Jinja 2.9 (or newer) is required to run the Ansible Playbooks** - **Jinja 2.9 (or newer) is required to run the Ansible Playbooks**
- The target servers must have **access to the Internet** in order to pull docker images. Otherwise, additional configuration is required (See [Offline Environment](https://github.com/kubernetes-incubator/kubespray/blob/master/docs/downloads.md#offline-environment)) - The target servers must have **access to the Internet** in order to pull docker images. Otherwise, additional configuration is required (See [Offline Environment](https://github.com/kubernetes-incubator/kubespray/blob/master/docs/downloads.md#offline-environment))

View file

@ -20,7 +20,7 @@ BuildRequires: python2-setuptools
BuildRequires: python-d2to1 BuildRequires: python-d2to1
BuildRequires: python2-pbr BuildRequires: python2-pbr
Requires: ansible >= 2.4.0 Requires: ansible >= 2.5.0
Requires: python-jinja2 >= 2.10 Requires: python-jinja2 >= 2.10
Requires: python-netaddr Requires: python-netaddr
Requires: python-pbr Requires: python-pbr

View file

@ -45,7 +45,7 @@
docker requires a minimum kernel version of docker requires a minimum kernel version of
{{ docker_kernel_min_version }} on {{ docker_kernel_min_version }} on
{{ ansible_distribution }}-{{ ansible_distribution_version }} {{ ansible_distribution }}-{{ ansible_distribution_version }}
when: (not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]) and (ansible_kernel|version_compare(docker_kernel_min_version, "<")) when: (not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]) and (ansible_kernel is version(docker_kernel_min_version, "<"))
tags: tags:
- facts - facts
@ -58,7 +58,7 @@
url: "{{docker_repo_key_info.url}}" url: "{{docker_repo_key_info.url}}"
state: present state: present
register: keyserver_task_result register: keyserver_task_result
until: keyserver_task_result|succeeded until: keyserver_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | d(3) }}" delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ docker_repo_key_info.repo_keys }}" with_items: "{{ docker_repo_key_info.repo_keys }}"
@ -79,7 +79,7 @@
url: "{{dockerproject_repo_key_info.url}}" url: "{{dockerproject_repo_key_info.url}}"
state: present state: present
register: keyserver_task_result register: keyserver_task_result
until: keyserver_task_result|succeeded until: keyserver_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | d(3) }}" delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ dockerproject_repo_key_info.repo_keys }}" with_items: "{{ dockerproject_repo_key_info.repo_keys }}"
@ -134,7 +134,7 @@
state: present state: present
update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}" update_cache: "{{ omit if ansible_distribution == 'Fedora' else True }}"
register: docker_task_result register: docker_task_result
until: docker_task_result|succeeded until: docker_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | d(3) }}" delay: "{{ retry_stagger | d(3) }}"
with_items: "{{ docker_package_info.pkgs }}" with_items: "{{ docker_package_info.pkgs }}"
@ -145,7 +145,7 @@
- name: get available packages on Ubuntu - name: get available packages on Ubuntu
command: apt-cache policy docker-ce command: apt-cache policy docker-ce
when: when:
- docker_task_result|failed - docker_task_result is failed
- ansible_distribution == 'Ubuntu' - ansible_distribution == 'Ubuntu'
register: available_packages register: available_packages
@ -153,7 +153,7 @@
fail: fail:
msg: "{{available_packages}}" msg: "{{available_packages}}"
when: when:
- docker_task_result|failed - docker_task_result is failed
- ansible_distribution == 'Ubuntu' - ansible_distribution == 'Ubuntu'
# This is required to ensure any apt upgrade will not break kubernetes # This is required to ensure any apt upgrade will not break kubernetes
@ -185,7 +185,7 @@
when: > when: >
dns_mode != 'none' and dns_mode != 'none' and
resolvconf_mode == 'docker_dns' and resolvconf_mode == 'docker_dns' and
installed_docker_version.stdout|version_compare('1.12', '<') installed_docker_version.stdout is version('1.12', '<')
- name: Set docker systemd config - name: Set docker systemd config
import_tasks: systemd.yml import_tasks: systemd.yml

View file

@ -21,7 +21,7 @@ Environment=GOTRACEBACK=crash
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
Delegate=yes Delegate=yes
KillMode=process KillMode=process
ExecStart={{ docker_bin_dir }}/docker{% if installed_docker_version.stdout|version_compare('17.03', '<') %} daemon{% else %}d{% endif %} \ ExecStart={{ docker_bin_dir }}/docker{% if installed_docker_version.stdout is version('17.03', '<') %} daemon{% else %}d{% endif %} \
{% if ansible_os_family == "Suse" %} {% if ansible_os_family == "Suse" %}
--containerd /run/containerd/containerd.sock --add-runtime oci=/usr/bin/docker-runc \ --containerd /run/containerd/containerd.sock --add-runtime oci=/usr/bin/docker-runc \
{% endif %} {% endif %}

View file

@ -41,7 +41,7 @@ docker_pkgs:
docker_package_info: docker_package_info:
pkg_mgr: yum pkg_mgr: yum
pkgs: |- pkgs: |-
{%- if docker_version | version_compare('17.04', '<') -%} {%- if docker_version is version('17.04', '<') -%}
{{ docker_pkgs_use_docker_ce }} {{ docker_pkgs_use_docker_ce }}
{%- else -%} {%- else -%}
{{ docker_pkgs }} {{ docker_pkgs }}

View file

@ -20,7 +20,7 @@
deb: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" deb: "{{ rkt_download_url }}/{{ rkt_pkg_name }}"
state: present state: present
register: rkt_task_result register: rkt_task_result
until: rkt_task_result|succeeded until: rkt_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
@ -36,7 +36,7 @@
pkg: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" pkg: "{{ rkt_download_url }}/{{ rkt_pkg_name }}"
state: present state: present
register: rkt_task_result register: rkt_task_result
until: rkt_task_result|succeeded until: rkt_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
@ -48,7 +48,7 @@
name: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" name: "{{ rkt_download_url }}/{{ rkt_pkg_name }}"
state: present state: present
register: rkt_task_result register: rkt_task_result
until: rkt_task_result|succeeded until: rkt_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: ansible_os_family == "Suse" when: ansible_os_family == "Suse"

View file

@ -31,7 +31,7 @@ spec:
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]' scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %} {% endif %}
serviceAccountName: dnsmasq serviceAccountName: dnsmasq

View file

@ -21,7 +21,7 @@ spec:
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
kubespray/dnsmasq-checksum: "{{ dnsmasq_stat.stat.checksum }}" kubespray/dnsmasq-checksum: "{{ dnsmasq_stat.stat.checksum }}"
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %} {% endif %}
tolerations: tolerations:

View file

@ -15,7 +15,7 @@
- name: container_download | Download containers if pull is required or told to always pull (delegate) - name: container_download | Download containers if pull is required or told to always pull (delegate)
command: "{{ docker_bin_dir }}/docker pull {{ pull_args }}" command: "{{ docker_bin_dir }}/docker pull {{ pull_args }}"
register: pull_task_result register: pull_task_result
until: pull_task_result|succeeded until: pull_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
@ -30,7 +30,7 @@
- name: container_download | Download containers if pull is required or told to always pull (all nodes) - name: container_download | Download containers if pull is required or told to always pull (all nodes)
command: "{{ docker_bin_dir }}/docker pull {{ pull_args }}" command: "{{ docker_bin_dir }}/docker pull {{ pull_args }}"
register: pull_task_result register: pull_task_result
until: pull_task_result|succeeded until: pull_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:

View file

@ -99,7 +99,7 @@
delegate_facts: no delegate_facts: no
become: false become: false
register: get_task register: get_task
until: get_task|succeeded until: get_task is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:

View file

@ -36,7 +36,7 @@
when: when:
- dns_mode in ['kubedns', 'dnsmasq_kubedns'] - dns_mode in ['kubedns', 'dnsmasq_kubedns']
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
- rbac_enabled and kubedns_version|version_compare("1.11.0", "<", strict=True) - rbac_enabled and kubedns_version is version("1.11.0", "<", strict=True)
tags: tags:
- dnsmasq - dnsmasq
- kubedns - kubedns

View file

@ -52,9 +52,9 @@
when: when:
- dns_mode != 'none' - dns_mode != 'none'
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
- not item|skipped - not item is skipped
register: resource_result register: resource_result
until: resource_result|succeeded until: resource_result is succeeded
retries: 4 retries: 4
delay: 5 delay: 5
tags: tags:

View file

@ -68,4 +68,4 @@
filename: "{{kube_config_dir}}/{{item.item.file}}" filename: "{{kube_config_dir}}/{{item.item.file}}"
state: "latest" state: "latest"
with_items: "{{ manifests.results }}" with_items: "{{ manifests.results }}"
when: inventory_hostname == groups['kube-master'][0] and not item|skipped when: inventory_hostname == groups['kube-master'][0] and not item is skipped

View file

@ -24,7 +24,7 @@ spec:
annotations: annotations:
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %} {% endif %}
serviceAccountName: coredns serviceAccountName: coredns

View file

@ -140,7 +140,7 @@ spec:
labels: labels:
k8s-app: kubernetes-dashboard k8s-app: kubernetes-dashboard
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %} {% endif %}
containers: containers:

View file

@ -28,7 +28,7 @@ spec:
labels: labels:
k8s-app: kubedns-autoscaler k8s-app: kubedns-autoscaler
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %} {% endif %}
# When having win nodes in cluster without this patch, this pod cloud try to be created in windows # When having win nodes in cluster without this patch, this pod cloud try to be created in windows

View file

@ -27,7 +27,7 @@ spec:
annotations: annotations:
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %} {% endif %}
# When having win nodes in cluster without this patch, this pod cloud try to be created in windows # When having win nodes in cluster without this patch, this pod cloud try to be created in windows

View file

@ -12,7 +12,7 @@ spec:
labels: labels:
app: netchecker-agent app: netchecker-agent
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if netcheck_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if netcheck_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
tolerations: tolerations:

View file

@ -16,10 +16,10 @@ spec:
# When having win nodes in cluster without this patch, this pod cloud try to be created in windows # When having win nodes in cluster without this patch, this pod cloud try to be created in windows
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux
{% if kube_version | version_compare('v1.6', '>=') %} {% if kube_version is version('v1.6', '>=') %}
dnsPolicy: ClusterFirstWithHostNet dnsPolicy: ClusterFirstWithHostNet
{% endif %} {% endif %}
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if netcheck_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if netcheck_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
tolerations: tolerations:

View file

@ -11,7 +11,7 @@ spec:
app: netchecker-server app: netchecker-server
namespace: {{ netcheck_namespace }} namespace: {{ netcheck_namespace }}
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if netcheck_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if netcheck_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
containers: containers:

View file

@ -49,7 +49,7 @@
with_items: "{{ psp_manifests.results }}" with_items: "{{ psp_manifests.results }}"
when: when:
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
- not item|skipped - not item is skipped
- name: Kubernetes Apps | Add ClusterRoleBinding to admit nodes - name: Kubernetes Apps | Add ClusterRoleBinding to admit nodes
template: template:
@ -130,8 +130,8 @@
- rbac_enabled - rbac_enabled
- cloud_provider is defined - cloud_provider is defined
- cloud_provider == 'vsphere' - cloud_provider == 'vsphere'
- kube_version | version_compare('v1.9.0', '>=') - kube_version is version('v1.9.0', '>=')
- kube_version | version_compare('v1.9.3', '<=') - kube_version is version('v1.9.3', '<=')
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
tags: vsphere tags: vsphere
@ -146,8 +146,8 @@
- cloud_provider == 'vsphere' - cloud_provider == 'vsphere'
- vsphere_cloud_provider.rc is defined - vsphere_cloud_provider.rc is defined
- vsphere_cloud_provider.rc != 0 - vsphere_cloud_provider.rc != 0
- kube_version | version_compare('v1.9.0', '>=') - kube_version is version('v1.9.0', '>=')
- kube_version | version_compare('v1.9.3', '<=') - kube_version is version('v1.9.3', '<=')
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
tags: vsphere tags: vsphere
@ -164,8 +164,8 @@
- cloud_provider == 'vsphere' - cloud_provider == 'vsphere'
- vsphere_cloud_provider.rc is defined - vsphere_cloud_provider.rc is defined
- vsphere_cloud_provider.rc != 0 - vsphere_cloud_provider.rc != 0
- kube_version | version_compare('v1.9.0', '>=') - kube_version is version('v1.9.0', '>=')
- kube_version | version_compare('v1.9.3', '<=') - kube_version is version('v1.9.3', '<=')
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
tags: vsphere tags: vsphere
@ -178,7 +178,7 @@
- name: PriorityClass | Copy k8s-cluster-critical-pc.yml file - name: PriorityClass | Copy k8s-cluster-critical-pc.yml file
copy: src=k8s-cluster-critical-pc.yml dest={{ kube_config_dir }}/k8s-cluster-critical-pc.yml copy: src=k8s-cluster-critical-pc.yml dest={{ kube_config_dir }}/k8s-cluster-critical-pc.yml
when: when:
- kube_version|version_compare('v1.11.1', '>=') - kube_version is version('v1.11.1', '>=')
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
- name: PriorityClass | Create k8s-cluster-critical - name: PriorityClass | Create k8s-cluster-critical
@ -189,5 +189,5 @@
filename: "{{ kube_config_dir }}/k8s-cluster-critical-pc.yml" filename: "{{ kube_config_dir }}/k8s-cluster-critical-pc.yml"
state: latest state: latest
when: when:
- kube_version|version_compare('v1.11.1', '>=') - kube_version is version('v1.11.1', '>=')
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]

View file

@ -19,7 +19,7 @@ spec:
app: cephfs-provisioner app: cephfs-provisioner
version: {{ cephfs_provisioner_image_tag }} version: {{ cephfs_provisioner_image_tag }}
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if cephfs_provisioner_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if cephfs_provisioner_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
serviceAccount: cephfs-provisioner serviceAccount: cephfs-provisioner

View file

@ -18,7 +18,7 @@ spec:
k8s-app: local-volume-provisioner k8s-app: local-volume-provisioner
version: {{ local_volume_provisioner_image_tag }} version: {{ local_volume_provisioner_image_tag }}
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if local_volume_provisioner_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if local_volume_provisioner_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
serviceAccountName: local-volume-provisioner serviceAccountName: local-volume-provisioner

View file

@ -45,7 +45,7 @@
--upgrade --tiller-image={{ tiller_image_repo }}:{{ tiller_image_tag }} --upgrade --tiller-image={{ tiller_image_repo }}:{{ tiller_image_tag }}
{% if rbac_enabled %} --service-account=tiller{% endif %} {% if rbac_enabled %} --service-account=tiller{% endif %}
{% if tiller_node_selectors is defined %} --node-selectors {{ tiller_node_selectors }}{% endif %} {% if tiller_node_selectors is defined %} --node-selectors {{ tiller_node_selectors }}{% endif %}
{% if kube_version|version_compare('v1.11.1', '>=') %} --override spec.template.spec.priorityClassName={% if tiller_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{% endif %} {% if kube_version is version('v1.11.1', '>=') %} --override spec.template.spec.priorityClassName={% if tiller_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{% endif %}
{% if tiller_override is defined and tiller_override != "" %} --override {{ tiller_override }}{% endif %} {% if tiller_override is defined and tiller_override != "" %} --override {{ tiller_override }}{% endif %}
{% if tiller_max_history is defined %} --history-max={{ tiller_max_history }}{% endif %} {% if tiller_max_history is defined %} --history-max={{ tiller_max_history }}{% endif %}
{% if tiller_enable_tls %} --tiller-tls --tiller-tls-verify --tiller-tls-cert={{ tiller_tls_cert }} --tiller-tls-key={{ tiller_tls_key }} --tls-ca-cert={{ tiller_tls_ca_cert }} {% endif %} {% if tiller_enable_tls %} --tiller-tls --tiller-tls-verify --tiller-tls-cert={{ tiller_tls_cert }} --tiller-tls-key={{ tiller_tls_key }} --tls-ca-cert={{ tiller_tls_ca_cert }} {% endif %}
@ -65,7 +65,7 @@
{% if helm_stable_repo_url is defined %} --stable-repo-url {{ helm_stable_repo_url }}{% endif %} {% if helm_stable_repo_url is defined %} --stable-repo-url {{ helm_stable_repo_url }}{% endif %}
{% if rbac_enabled %} --service-account=tiller{% endif %} {% if rbac_enabled %} --service-account=tiller{% endif %}
{% if tiller_node_selectors is defined %} --node-selectors {{ tiller_node_selectors }}{% endif %} {% if tiller_node_selectors is defined %} --node-selectors {{ tiller_node_selectors }}{% endif %}
{% if kube_version|version_compare('v1.11.1', '>=') %} --override spec.template.spec.priorityClassName={% if tiller_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{% endif %} {% if kube_version is version('v1.11.1', '>=') %} --override spec.template.spec.priorityClassName={% if tiller_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{% endif %}
{% if tiller_override is defined and tiller_override != "" %} --override {{ tiller_override }}{% endif %} {% if tiller_override is defined and tiller_override != "" %} --override {{ tiller_override }}{% endif %}
{% if tiller_max_history is defined %} --history-max={{ tiller_max_history }}{% endif %} {% if tiller_max_history is defined %} --history-max={{ tiller_max_history }}{% endif %}
{% if tiller_enable_tls %} --tiller-tls --tiller-tls-verify --tiller-tls-cert={{ tiller_tls_cert }} --tiller-tls-key={{ tiller_tls_key }} --tls-ca-cert={{ tiller_tls_ca_cert }} {% endif %} {% if tiller_enable_tls %} --tiller-tls --tiller-tls-verify --tiller-tls-cert={{ tiller_tls_cert }} --tiller-tls-key={{ tiller_tls_key }} --tls-ca-cert={{ tiller_tls_ca_cert }} {% endif %}
@ -74,7 +74,7 @@
| {{bin_dir}}/kubectl apply -f - | {{bin_dir}}/kubectl apply -f -
changed_when: false changed_when: false
when: when:
- (tiller_override is defined and tiller_override != "") or (kube_version|version_compare('v1.11.1', '>=')) - (tiller_override is defined and tiller_override != "") or (kube_version is version('v1.11.1', '>='))
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
environment: "{{proxy_env}}" environment: "{{proxy_env}}"

View file

@ -22,7 +22,7 @@ spec:
release: cert-manager release: cert-manager
annotations: annotations:
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if cert_manager_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if cert_manager_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
serviceAccountName: cert-manager serviceAccountName: cert-manager

View file

@ -19,7 +19,7 @@ spec:
app.kubernetes.io/name: default-backend app.kubernetes.io/name: default-backend
app.kubernetes.io/part-of: ingress-nginx app.kubernetes.io/part-of: ingress-nginx
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if ingress_nginx_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if ingress_nginx_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
terminationGracePeriodSeconds: 60 terminationGracePeriodSeconds: 60

View file

@ -29,7 +29,7 @@ spec:
nodeSelector: nodeSelector:
{{ ingress_nginx_nodeselector | to_nice_yaml }} {{ ingress_nginx_nodeselector | to_nice_yaml }}
{%- endif %} {%- endif %}
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if ingress_nginx_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if ingress_nginx_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
containers: containers:

View file

@ -10,7 +10,7 @@
with_items: with_items:
- "{{ calico_node_manifests.results }}" - "{{ calico_node_manifests.results }}"
when: when:
- inventory_hostname == groups['kube-master'][0] and not item|skipped - inventory_hostname == groups['kube-master'][0] and not item is skipped
- name: "calico upgrade complete" - name: "calico upgrade complete"
shell: "{{ bin_dir }}/calico-upgrade complete --no-prompts --apiconfigv1 /etc/calico/etcdv2.yml --apiconfigv3 /etc/calico/etcdv3.yml" shell: "{{ bin_dir }}/calico-upgrade complete --no-prompts --apiconfigv1 /etc/calico/etcdv2.yml --apiconfigv3 /etc/calico/etcdv3.yml"

View file

@ -8,4 +8,4 @@
filename: "{{kube_config_dir}}/{{item.item.file}}" filename: "{{kube_config_dir}}/{{item.item.file}}"
state: "latest" state: "latest"
with_items: "{{ canal_manifests.results }}" with_items: "{{ canal_manifests.results }}"
when: inventory_hostname == groups['kube-master'][0] and not item|skipped when: inventory_hostname == groups['kube-master'][0] and not item is skipped

View file

@ -8,7 +8,7 @@
filename: "{{kube_config_dir}}/{{item.item.file}}" filename: "{{kube_config_dir}}/{{item.item.file}}"
state: "latest" state: "latest"
with_items: "{{ cilium_node_manifests.results }}" with_items: "{{ cilium_node_manifests.results }}"
when: inventory_hostname == groups['kube-master'][0] and not item|skipped when: inventory_hostname == groups['kube-master'][0] and not item is skipped
- name: Cilium | Wait for pods to run - name: Cilium | Wait for pods to run
command: "{{bin_dir}}/kubectl -n kube-system get pods -l k8s-app=cilium -o jsonpath='{.items[?(@.status.containerStatuses[0].ready==false)].metadata.name}'" command: "{{bin_dir}}/kubectl -n kube-system get pods -l k8s-app=cilium -o jsonpath='{.items[?(@.status.containerStatuses[0].ready==false)].metadata.name}'"

View file

@ -8,7 +8,7 @@
filename: "{{kube_config_dir}}/{{item.item.file}}" filename: "{{kube_config_dir}}/{{item.item.file}}"
state: "latest" state: "latest"
with_items: "{{ flannel_node_manifests.results }}" with_items: "{{ flannel_node_manifests.results }}"
when: inventory_hostname == groups['kube-master'][0] and not item|skipped when: inventory_hostname == groups['kube-master'][0] and not item is skipped
- name: Flannel | Wait for flannel subnet.env file presence - name: Flannel | Wait for flannel subnet.env file presence
wait_for: wait_for:

View file

@ -34,4 +34,4 @@
- "{{ calico_kube_manifests.results }}" - "{{ calico_kube_manifests.results }}"
when: when:
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
- not item|skipped - not item is skipped

View file

@ -29,7 +29,7 @@ spec:
tolerations: tolerations:
- effect: NoSchedule - effect: NoSchedule
operator: Exists operator: Exists
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %} {% endif %}
containers: containers:

View file

@ -21,7 +21,7 @@ spec:
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
version: v{{ registry_proxy_image_tag }} version: v{{ registry_proxy_image_tag }}
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if registry_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if registry_namespace == 'kube-system' %}system-node-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
serviceAccountName: registry-proxy serviceAccountName: registry-proxy

View file

@ -22,7 +22,7 @@ spec:
version: v{{ registry_image_tag }} version: v{{ registry_image_tag }}
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: {% if registry_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}} priorityClassName: {% if registry_namespace == 'kube-system' %}system-cluster-critical{% else %}k8s-cluster-critical{% endif %}{{''}}
{% endif %} {% endif %}
serviceAccountName: registry serviceAccountName: registry

View file

@ -34,19 +34,19 @@
- name: sets kubeadm api version to v1alpha1 - name: sets kubeadm api version to v1alpha1
set_fact: set_fact:
kubeadmConfig_api_version: v1alpha1 kubeadmConfig_api_version: v1alpha1
when: kubeadm_output.stdout|version_compare('v1.11.0', '<') when: kubeadm_output.stdout is version('v1.11.0', '<')
- name: sets kubeadm api version to v1alpha2 - name: sets kubeadm api version to v1alpha2
set_fact: set_fact:
kubeadmConfig_api_version: v1alpha2 kubeadmConfig_api_version: v1alpha2
when: when:
- kubeadm_output.stdout|version_compare('v1.11.0', '>=') - kubeadm_output.stdout is version('v1.11.0', '>=')
- kubeadm_output.stdout|version_compare('v1.12.0', '<') - kubeadm_output.stdout is version('v1.12.0', '<')
- name: sets kubeadm api version to v1alpha3 - name: sets kubeadm api version to v1alpha3
set_fact: set_fact:
kubeadmConfig_api_version: v1alpha3 kubeadmConfig_api_version: v1alpha3
when: kubeadm_output.stdout|version_compare('v1.12.0', '>=') when: kubeadm_output.stdout is version('v1.12.0', '>=')
- name: Create kubeadm client config - name: Create kubeadm client config
template: template:

View file

@ -80,7 +80,7 @@ kube_apiserver_admission_control:
- ServiceAccount - ServiceAccount
- DefaultStorageClass - DefaultStorageClass
- >- - >-
{%- if kube_version | version_compare('v1.9', '<') -%} {%- if kube_version is version('v1.9', '<') -%}
GenericAdmissionWebhook GenericAdmissionWebhook
{%- else -%} {%- else -%}
MutatingAdmissionWebhook,ValidatingAdmissionWebhook MutatingAdmissionWebhook,ValidatingAdmissionWebhook

View file

@ -84,19 +84,19 @@
- name: sets kubeadm api version to v1alpha1 - name: sets kubeadm api version to v1alpha1
set_fact: set_fact:
kubeadmConfig_api_version: v1alpha1 kubeadmConfig_api_version: v1alpha1
when: kubeadm_output.stdout|version_compare('v1.11.0', '<') when: kubeadm_output.stdout is version('v1.11.0', '<')
- name: sets kubeadm api version to v1alpha2 - name: sets kubeadm api version to v1alpha2
set_fact: set_fact:
kubeadmConfig_api_version: v1alpha2 kubeadmConfig_api_version: v1alpha2
when: when:
- kubeadm_output.stdout|version_compare('v1.11.0', '>=') - kubeadm_output.stdout is version('v1.11.0', '>=')
- kubeadm_output.stdout|version_compare('v1.12.0', '<') - kubeadm_output.stdout is version('v1.12.0', '<')
- name: sets kubeadm api version to v1alpha3 - name: sets kubeadm api version to v1alpha3
set_fact: set_fact:
kubeadmConfig_api_version: v1alpha3 kubeadmConfig_api_version: v1alpha3
when: kubeadm_output.stdout|version_compare('v1.12.0', '>=') when: kubeadm_output.stdout is version('v1.12.0', '>=')
# Nginx LB(default), If kubeadm_config_api_fqdn is defined, use other LB by kubeadm controlPlaneEndpoint. # Nginx LB(default), If kubeadm_config_api_fqdn is defined, use other LB by kubeadm controlPlaneEndpoint.
- name: set kubeadm_config_api_fqdn define - name: set kubeadm_config_api_fqdn define

View file

@ -26,10 +26,10 @@ cloudProvider: {{ cloud_provider }}
{% if kube_proxy_mode == 'ipvs' %} {% if kube_proxy_mode == 'ipvs' %}
kubeProxy: kubeProxy:
config: config:
{% if kube_version | version_compare('v1.10', '<') %} {% if kube_version is version('v1.10', '<') %}
featureGates: SupportIPVSProxyMode=true featureGates: SupportIPVSProxyMode=true
{% endif %} {% endif %}
{% if kube_version | version_compare('v1.10', '>=') %} {% if kube_version is version('v1.10', '>=') %}
featureGates: featureGates:
SupportIPVSProxyMode: true SupportIPVSProxyMode: true
{% endif %} {% endif %}
@ -49,7 +49,7 @@ apiServerExtraArgs:
insecure-bind-address: {{ kube_apiserver_insecure_bind_address }} insecure-bind-address: {{ kube_apiserver_insecure_bind_address }}
{% endif %} {% endif %}
insecure-port: "{{ kube_apiserver_insecure_port }}" insecure-port: "{{ kube_apiserver_insecure_port }}"
{% if kube_version | version_compare('v1.10', '<') %} {% if kube_version is version('v1.10', '<') %}
admission-control: {{ kube_apiserver_admission_control | join(',') }} admission-control: {{ kube_apiserver_admission_control | join(',') }}
{% else %} {% else %}
{% if kube_apiserver_enable_admission_plugins|length > 0 %} {% if kube_apiserver_enable_admission_plugins|length > 0 %}
@ -60,7 +60,7 @@ apiServerExtraArgs:
{% endif %} {% endif %}
{% endif %} {% endif %}
apiserver-count: "{{ kube_apiserver_count }}" apiserver-count: "{{ kube_apiserver_count }}"
{% if kube_version | version_compare('v1.9', '>=') %} {% if kube_version is version('v1.9', '>=') %}
endpoint-reconciler-type: lease endpoint-reconciler-type: lease
{% endif %} {% endif %}
{% if etcd_events_cluster_enabled %} {% if etcd_events_cluster_enabled %}
@ -72,7 +72,7 @@ apiServerExtraArgs:
request-timeout: "{{ kube_apiserver_request_timeout }}" request-timeout: "{{ kube_apiserver_request_timeout }}"
repair-malformed-updates: "false" repair-malformed-updates: "false"
enable-aggregator-routing: "{{ kube_api_aggregator_routing }}" enable-aggregator-routing: "{{ kube_api_aggregator_routing }}"
{% if kube_api_anonymous_auth is defined and kube_version | version_compare('v1.5', '>=') %} {% if kube_api_anonymous_auth is defined and kube_version is version('v1.5', '>=') %}
anonymous-auth: "{{ kube_api_anonymous_auth }}" anonymous-auth: "{{ kube_api_anonymous_auth }}"
{% endif %} {% endif %}
{% if kube_basic_auth|default(true) %} {% if kube_basic_auth|default(true) %}

View file

@ -41,7 +41,7 @@ apiServerExtraArgs:
insecure-bind-address: {{ kube_apiserver_insecure_bind_address }} insecure-bind-address: {{ kube_apiserver_insecure_bind_address }}
{% endif %} {% endif %}
insecure-port: "{{ kube_apiserver_insecure_port }}" insecure-port: "{{ kube_apiserver_insecure_port }}"
{% if kube_version | version_compare('v1.10', '<') %} {% if kube_version is version('v1.10', '<') %}
admission-control: {{ kube_apiserver_admission_control | join(',') }} admission-control: {{ kube_apiserver_admission_control | join(',') }}
{% else %} {% else %}
{% if kube_apiserver_enable_admission_plugins|length > 0 %} {% if kube_apiserver_enable_admission_plugins|length > 0 %}
@ -52,7 +52,7 @@ apiServerExtraArgs:
{% endif %} {% endif %}
{% endif %} {% endif %}
apiserver-count: "{{ kube_apiserver_count }}" apiserver-count: "{{ kube_apiserver_count }}"
{% if kube_version | version_compare('v1.9', '>=') %} {% if kube_version is version('v1.9', '>=') %}
endpoint-reconciler-type: lease endpoint-reconciler-type: lease
{% endif %} {% endif %}
{% if etcd_events_cluster_enabled %} {% if etcd_events_cluster_enabled %}
@ -64,7 +64,7 @@ apiServerExtraArgs:
request-timeout: "{{ kube_apiserver_request_timeout }}" request-timeout: "{{ kube_apiserver_request_timeout }}"
repair-malformed-updates: "false" repair-malformed-updates: "false"
enable-aggregator-routing: "{{ kube_api_aggregator_routing }}" enable-aggregator-routing: "{{ kube_api_aggregator_routing }}"
{% if kube_api_anonymous_auth is defined and kube_version | version_compare('v1.5', '>=') %} {% if kube_api_anonymous_auth is defined and kube_version is version('v1.5', '>=') %}
anonymous-auth: "{{ kube_api_anonymous_auth }}" anonymous-auth: "{{ kube_api_anonymous_auth }}"
{% endif %} {% endif %}
{% if kube_basic_auth|default(true) %} {% if kube_basic_auth|default(true) %}

View file

@ -44,7 +44,7 @@ apiServerExtraArgs:
insecure-bind-address: {{ kube_apiserver_insecure_bind_address }} insecure-bind-address: {{ kube_apiserver_insecure_bind_address }}
{% endif %} {% endif %}
insecure-port: "{{ kube_apiserver_insecure_port }}" insecure-port: "{{ kube_apiserver_insecure_port }}"
{% if kube_version | version_compare('v1.10', '<') %} {% if kube_version is version('v1.10', '<') %}
admission-control: {{ kube_apiserver_admission_control | join(',') }} admission-control: {{ kube_apiserver_admission_control | join(',') }}
{% else %} {% else %}
{% if kube_apiserver_enable_admission_plugins|length > 0 %} {% if kube_apiserver_enable_admission_plugins|length > 0 %}
@ -55,7 +55,7 @@ apiServerExtraArgs:
{% endif %} {% endif %}
{% endif %} {% endif %}
apiserver-count: "{{ kube_apiserver_count }}" apiserver-count: "{{ kube_apiserver_count }}"
{% if kube_version | version_compare('v1.9', '>=') %} {% if kube_version is version('v1.9', '>=') %}
endpoint-reconciler-type: lease endpoint-reconciler-type: lease
{% endif %} {% endif %}
{% if etcd_events_cluster_enabled %} {% if etcd_events_cluster_enabled %}

View file

@ -11,10 +11,10 @@ metadata:
kubespray.apiserver-cert/serial: "{{ apiserver_cert_serial }}" kubespray.apiserver-cert/serial: "{{ apiserver_cert_serial }}"
spec: spec:
hostNetwork: true hostNetwork: true
{% if kube_version | version_compare('v1.6', '>=') %} {% if kube_version is version('v1.6', '>=') %}
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
{% endif %} {% endif %}
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
containers: containers:
@ -43,7 +43,7 @@ spec:
{% if etcd_events_cluster_enabled %} {% if etcd_events_cluster_enabled %}
- --etcd-servers-overrides=/events#{{ etcd_events_access_addresses_semicolon }} - --etcd-servers-overrides=/events#{{ etcd_events_access_addresses_semicolon }}
{% endif %} {% endif %}
{% if kube_version | version_compare('v1.9', '<') %} {% if kube_version is version('v1.9', '<') %}
- --etcd-quorum-read=true - --etcd-quorum-read=true
{% endif %} {% endif %}
- --etcd-cafile={{ etcd_cert_dir }}/ca.pem - --etcd-cafile={{ etcd_cert_dir }}/ca.pem
@ -54,10 +54,10 @@ spec:
{% endif %} {% endif %}
- --bind-address={{ kube_apiserver_bind_address }} - --bind-address={{ kube_apiserver_bind_address }}
- --apiserver-count={{ kube_apiserver_count }} - --apiserver-count={{ kube_apiserver_count }}
{% if kube_version | version_compare('v1.9', '>=') %} {% if kube_version is version('v1.9', '>=') %}
- --endpoint-reconciler-type=lease - --endpoint-reconciler-type=lease
{% endif %} {% endif %}
{% if kube_version | version_compare('v1.10', '<') %} {% if kube_version is version('v1.10', '<') %}
- --admission-control={{ kube_apiserver_admission_control | join(',') }} - --admission-control={{ kube_apiserver_admission_control | join(',') }}
{% else %} {% else %}
{% if kube_apiserver_enable_admission_plugins|length > 0 %} {% if kube_apiserver_enable_admission_plugins|length > 0 %}
@ -114,7 +114,7 @@ spec:
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if enable_network_policy %} {% if enable_network_policy %}
{% if kube_version | version_compare('v1.8', '<') %} {% if kube_version is version('v1.8', '<') %}
- --runtime-config=extensions/v1beta1/networkpolicies=true - --runtime-config=extensions/v1beta1/networkpolicies=true
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -124,7 +124,7 @@ spec:
- --cloud-provider={{ cloud_provider }} - --cloud-provider={{ cloud_provider }}
- --cloud-config={{ kube_config_dir }}/cloud_config - --cloud-config={{ kube_config_dir }}/cloud_config
{% endif %} {% endif %}
{% if kube_api_anonymous_auth is defined and kube_version | version_compare('v1.5', '>=') %} {% if kube_api_anonymous_auth is defined and kube_version is version('v1.5', '>=') %}
- --anonymous-auth={{ kube_api_anonymous_auth }} - --anonymous-auth={{ kube_api_anonymous_auth }}
{% endif %} {% endif %}
{% if authorization_modes %} {% if authorization_modes %}
@ -136,7 +136,7 @@ spec:
{% if kube_feature_gates %} {% if kube_feature_gates %}
- --feature-gates={{ kube_feature_gates|join(',') }} - --feature-gates={{ kube_feature_gates|join(',') }}
{% endif %} {% endif %}
{% if kube_version | version_compare('v1.9', '>=') %} {% if kube_version is version('v1.9', '>=') %}
- --requestheader-client-ca-file={{ kube_cert_dir }}/{{ kube_front_proxy_ca }} - --requestheader-client-ca-file={{ kube_cert_dir }}/{{ kube_front_proxy_ca }}
{# FIXME(mattymo): Vault certs do not work with front-proxy-client #} {# FIXME(mattymo): Vault certs do not work with front-proxy-client #}
{% if cert_management == "vault" %} {% if cert_management == "vault" %}

View file

@ -10,10 +10,10 @@ metadata:
kubespray.controller-manager-cert/serial: "{{ controller_manager_cert_serial }}" kubespray.controller-manager-cert/serial: "{{ controller_manager_cert_serial }}"
spec: spec:
hostNetwork: true hostNetwork: true
{% if kube_version | version_compare('v1.6', '>=') %} {% if kube_version is version('v1.6', '>=') %}
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
{% endif %} {% endif %}
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
containers: containers:

View file

@ -9,10 +9,10 @@ metadata:
kubespray.scheduler-cert/serial: "{{ scheduler_cert_serial }}" kubespray.scheduler-cert/serial: "{{ scheduler_cert_serial }}"
spec: spec:
hostNetwork: true hostNetwork: true
{% if kube_version | version_compare('v1.6', '>=') %} {% if kube_version is version('v1.6', '>=') %}
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
{% endif %} {% endif %}
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
containers: containers:

View file

@ -1,17 +1,17 @@
[Global] [Global]
{% if kube_version | version_compare('v1.6', '>=') %} {% if kube_version is version('v1.6', '>=') %}
zone={{ aws_zone|default("") }} zone={{ aws_zone|default("") }}
vpc={{ aws_vpc|default("") }} vpc={{ aws_vpc|default("") }}
subnetId={{ aws_subnet_id|default("") }} subnetId={{ aws_subnet_id|default("") }}
routeTableId={{ aws_route_table_id|default("") }} routeTableId={{ aws_route_table_id|default("") }}
{% if kube_version | version_compare('v1.10', '>=') %} {% if kube_version is version('v1.10', '>=') %}
roleArn={{ aws_role_arn|default("") }} roleArn={{ aws_role_arn|default("") }}
{% endif %} {% endif %}
kubernetesClusterTag={{ aws_kubernetes_cluster_tag|default("") }} kubernetesClusterTag={{ aws_kubernetes_cluster_tag|default("") }}
kubernetesClusterId={{ aws_kubernetes_cluster_id|default("") }} kubernetesClusterId={{ aws_kubernetes_cluster_id|default("") }}
disableSecurityGroupIngress={{ "true" if aws_disable_security_group_ingress|default(False) else "false" }} disableSecurityGroupIngress={{ "true" if aws_disable_security_group_ingress|default(False) else "false" }}
disableStrictZoneCheck={{ "true" if aws_disable_strict_zone_check|default(False) else "false" }} disableStrictZoneCheck={{ "true" if aws_disable_strict_zone_check|default(False) else "false" }}
{% if kube_version | version_compare('v1.7', '>=') %} {% if kube_version is version('v1.7', '>=') %}
elbSecurityGroup={{ aws_elb_security_group|default("") }} elbSecurityGroup={{ aws_elb_security_group|default("") }}
{% endif %} {% endif %}
{% endif %} {% endif %}

View file

@ -17,7 +17,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{# start kubeadm specific settings #} {# start kubeadm specific settings #}
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \ --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig={{ kube_config_dir }}/kubelet.conf \ --kubeconfig={{ kube_config_dir }}/kubelet.conf \
{% if kube_version | version_compare('v1.8', '<') %} {% if kube_version is version('v1.8', '<') %}
--require-kubeconfig \ --require-kubeconfig \
{% endif %} {% endif %}
{% if kubelet_authentication_token_webhook %} {% if kubelet_authentication_token_webhook %}
@ -29,7 +29,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
--enforce-node-allocatable={{ kubelet_enforce_node_allocatable }} \ --enforce-node-allocatable={{ kubelet_enforce_node_allocatable }} \
--client-ca-file={{ kube_cert_dir }}/ca.crt \ --client-ca-file={{ kube_cert_dir }}/ca.crt \
--pod-manifest-path={{ kube_manifest_dir }} \ --pod-manifest-path={{ kube_manifest_dir }} \
{% if kube_version | version_compare('v1.12.0', '<') %} {% if kube_version is version('v1.12.0', '<') %}
--cadvisor-port={{ kube_cadvisor_port }} \ --cadvisor-port={{ kube_cadvisor_port }} \
{% endif %} {% endif %}
{# end kubeadm specific settings #} {# end kubeadm specific settings #}
@ -37,7 +37,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
--node-status-update-frequency={{ kubelet_status_update_frequency }} \ --node-status-update-frequency={{ kubelet_status_update_frequency }} \
--cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \ --cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \
--max-pods={{ kubelet_max_pods }} \ --max-pods={{ kubelet_max_pods }} \
{% if container_manager == 'docker' and kube_version | version_compare('v1.12.0', '<') %} {% if container_manager == 'docker' and kube_version is version('v1.12.0', '<') %}
--docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \ --docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \
{% endif %} {% endif %}
{% if container_manager == 'crio' %} {% if container_manager == 'crio' %}
@ -46,7 +46,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{% endif %} {% endif %}
--anonymous-auth=false \ --anonymous-auth=false \
--read-only-port={{ kube_read_only_port }} \ --read-only-port={{ kube_read_only_port }} \
{% if kube_version | version_compare('v1.8', '<') %} {% if kube_version is version('v1.8', '<') %}
--experimental-fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \ --experimental-fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \
{% else %} {% else %}
--fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \ --fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \

View file

@ -12,12 +12,12 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{# Base kubelet args #} {# Base kubelet args #}
{% set kubelet_args_base %} {% set kubelet_args_base %}
--pod-manifest-path={{ kube_manifest_dir }} \ --pod-manifest-path={{ kube_manifest_dir }} \
{% if kube_version | version_compare('v1.12.0', '<') %} {% if kube_version is version('v1.12.0', '<') %}
--cadvisor-port={{ kube_cadvisor_port }} \ --cadvisor-port={{ kube_cadvisor_port }} \
{% endif %} {% endif %}
--pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \ --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \
--node-status-update-frequency={{ kubelet_status_update_frequency }} \ --node-status-update-frequency={{ kubelet_status_update_frequency }} \
{% if container_manager == 'docker' and kube_version | version_compare('v1.12.0', '<') %} {% if container_manager == 'docker' and kube_version is version('v1.12.0', '<') %}
--docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \ --docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \
{% endif %} {% endif %}
--client-ca-file={{ kube_cert_dir }}/ca.pem \ --client-ca-file={{ kube_cert_dir }}/ca.pem \
@ -25,9 +25,9 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
--tls-private-key-file={{ kube_cert_dir }}/node-{{ inventory_hostname }}-key.pem \ --tls-private-key-file={{ kube_cert_dir }}/node-{{ inventory_hostname }}-key.pem \
--anonymous-auth=false \ --anonymous-auth=false \
--read-only-port={{ kube_read_only_port }} \ --read-only-port={{ kube_read_only_port }} \
{% if kube_version | version_compare('v1.6', '>=') %} {% if kube_version is version('v1.6', '>=') %}
{# flag got removed with 1.7.0 #} {# flag got removed with 1.7.0 #}
{% if kube_version | version_compare('v1.7', '<') %} {% if kube_version is version('v1.7', '<') %}
--enable-cri={{ kubelet_enable_cri }} \ --enable-cri={{ kubelet_enable_cri }} \
{% endif %} {% endif %}
{% if container_manager == 'crio' %} {% if container_manager == 'crio' %}
@ -37,7 +37,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
--cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \ --cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \
--cgroups-per-qos={{ kubelet_cgroups_per_qos }} \ --cgroups-per-qos={{ kubelet_cgroups_per_qos }} \
--max-pods={{ kubelet_max_pods }} \ --max-pods={{ kubelet_max_pods }} \
{% if kube_version | version_compare('v1.8', '<') %} {% if kube_version is version('v1.8', '<') %}
--experimental-fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \ --experimental-fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \
{% else %} {% else %}
--fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \ --fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \
@ -68,7 +68,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{% set kubelet_args_dns %}{{ kubelet_args_cluster_dns }} --cluster-domain={{ dns_domain }} --resolv-conf={{ kube_resolv_conf }}{% endset %} {% set kubelet_args_dns %}{{ kubelet_args_cluster_dns }} --cluster-domain={{ dns_domain }} --resolv-conf={{ kube_resolv_conf }}{% endset %}
{# Location of the apiserver #} {# Location of the apiserver #}
{% if kube_version | version_compare('v1.8', '<') %} {% if kube_version is version('v1.8', '<') %}
{% set kubelet_args_kubeconfig %}--kubeconfig={{ kube_config_dir}}/node-kubeconfig.yaml --require-kubeconfig{% endset %} {% set kubelet_args_kubeconfig %}--kubeconfig={{ kube_config_dir}}/node-kubeconfig.yaml --require-kubeconfig{% endset %}
{% else %} {% else %}
{% set kubelet_args_kubeconfig %}--kubeconfig={{ kube_config_dir}}/node-kubeconfig.yaml{% endset %} {% set kubelet_args_kubeconfig %}--kubeconfig={{ kube_config_dir}}/node-kubeconfig.yaml{% endset %}
@ -76,7 +76,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{% if standalone_kubelet|bool %} {% if standalone_kubelet|bool %}
{# We are on a master-only host. Make the master unschedulable in this case. #} {# We are on a master-only host. Make the master unschedulable in this case. #}
{% if kube_version | version_compare('v1.6', '>=') %} {% if kube_version is version('v1.6', '>=') %}
{# Set taints on the master so that it's unschedulable by default. Use node-role.kubernetes.io/master taint like kubeadm. #} {# Set taints on the master so that it's unschedulable by default. Use node-role.kubernetes.io/master taint like kubeadm. #}
{% set kubelet_args_kubeconfig %}{{ kubelet_args_kubeconfig }} --register-with-taints=node-role.kubernetes.io/master=:NoSchedule{% endset %} {% set kubelet_args_kubeconfig %}{{ kubelet_args_kubeconfig }} --register-with-taints=node-role.kubernetes.io/master=:NoSchedule{% endset %}
{% else %} {% else %}

View file

@ -9,13 +9,13 @@ metadata:
kubespray.kube-proxy-cert/serial: "{{ kube_proxy_cert_serial }}" kubespray.kube-proxy-cert/serial: "{{ kube_proxy_cert_serial }}"
spec: spec:
hostNetwork: true hostNetwork: true
{% if kube_version | version_compare('v1.6', '>=') %} {% if kube_version is version('v1.6', '>=') %}
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
{% endif %} {% endif %}
# When having win nodes in cluster without this patch, this pod cloud try to be created in windows # When having win nodes in cluster without this patch, this pod cloud try to be created in windows
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
containers: containers:
@ -56,7 +56,7 @@ spec:
- --masquerade-all - --masquerade-all
{% elif kube_proxy_mode == 'ipvs' %} {% elif kube_proxy_mode == 'ipvs' %}
- --masquerade-all - --masquerade-all
{% if kube_version | version_compare('v1.10', '<') %} {% if kube_version is version('v1.10', '<') %}
- --feature-gates=SupportIPVSProxyMode=true - --feature-gates=SupportIPVSProxyMode=true
{% endif %} {% endif %}
- --ipvs-min-sync-period=5s - --ipvs-min-sync-period=5s

View file

@ -10,7 +10,7 @@ spec:
# When having win nodes in cluster without this patch, this pod cloud try to be created in windows # When having win nodes in cluster without this patch, this pod cloud try to be created in windows
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux beta.kubernetes.io/os: linux
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
containers: containers:

View file

@ -4,7 +4,7 @@ password = "{{ vsphere_password }}"
port = {{ vsphere_vcenter_port }} port = {{ vsphere_vcenter_port }}
insecure-flag = {{ vsphere_insecure }} insecure-flag = {{ vsphere_insecure }}
{% if kube_version | version_compare('v1.9.2', '>=') %} {% if kube_version is version('v1.9.2', '>=') %}
datacenters = "{{ vsphere_datacenter }}" datacenters = "{{ vsphere_datacenter }}"
{% else %} {% else %}
datastore = "{{ vsphere_datastore }}" datastore = "{{ vsphere_datastore }}"
@ -19,7 +19,7 @@ vm-name = "{{ vsphere_vm_name }}"
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if kube_version | version_compare('v1.9.2', '>=') %} {% if kube_version is version('v1.9.2', '>=') %}
[VirtualCenter "{{ vsphere_vcenter_ip }}"] [VirtualCenter "{{ vsphere_vcenter_ip }}"]

View file

@ -2,7 +2,7 @@
- name: Stop if ansible version is too low - name: Stop if ansible version is too low
assert: assert:
that: that:
- ansible_version.full|version_compare('2.3.0', '>=') - ansible_version.full is version('2.3.0', '>=')
run_once: yes run_once: yes
- name: Stop if either kube-master, kube-node or etcd is empty - name: Stop if either kube-master, kube-node or etcd is empty
@ -114,7 +114,7 @@
- name: Stop if kernel version is too low - name: Stop if kernel version is too low
assert: assert:
that: ansible_kernel.split('-')[0]|version_compare('4.8', '>=') that: ansible_kernel.split('-')[0] is version('4.8', '>=')
when: kube_network_plugin == 'cilium' when: kube_network_plugin == 'cilium'
ignore_errors: "{{ ignore_assert_errors }}" ignore_errors: "{{ ignore_assert_errors }}"
@ -146,7 +146,7 @@
- name: "Check that calico version is enought for upgrade" - name: "Check that calico version is enought for upgrade"
assert: assert:
that: that:
- calico_version_on_server.stdout|version_compare('v2.6.5', '>=') - calico_version_on_server.stdout is version('v2.6.5', '>=')
msg: "Your version of calico is not fresh enough for upgrade. Minimum version v2.6.5" msg: "Your version of calico is not fresh enough for upgrade. Minimum version v2.6.5"
when: when:
- 'calico_version_on_server.stdout is defined' - 'calico_version_on_server.stdout is defined'

View file

@ -4,7 +4,7 @@
update_cache: yes update_cache: yes
name: '*' name: '*'
register: yum_task_result register: yum_task_result
until: yum_task_result|succeeded until: yum_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
@ -15,7 +15,7 @@
- name: Expire management cache (YUM) for Updation - Redhat - name: Expire management cache (YUM) for Updation - Redhat
shell: yum clean expire-cache shell: yum clean expire-cache
register: expire_cache_output register: expire_cache_output
until: expire_cache_output|succeeded until: expire_cache_output is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
@ -27,7 +27,7 @@
- name: Update package management cache (YUM) - Redhat - name: Update package management cache (YUM) - Redhat
shell: yum makecache shell: yum makecache
register: make_cache_output register: make_cache_output
until: make_cache_output|succeeded until: make_cache_output is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
@ -40,7 +40,7 @@
- name: Update package management cache (zypper) - SUSE - name: Update package management cache (zypper) - SUSE
shell: zypper -n --gpg-auto-import-keys ref shell: zypper -n --gpg-auto-import-keys ref
register: make_cache_output register: make_cache_output
until: make_cache_output|succeeded until: make_cache_output is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
@ -58,7 +58,7 @@
- name: Install python-dnf for latest RedHat versions - name: Install python-dnf for latest RedHat versions
command: dnf install -y python-dnf yum command: dnf install -y python-dnf yum
register: dnf_task_result register: dnf_task_result
until: dnf_task_result|succeeded until: dnf_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
@ -86,7 +86,7 @@
name: "{{ item }}" name: "{{ item }}"
state: latest state: latest
register: pkgs_task_result register: pkgs_task_result
until: pkgs_task_result|succeeded until: pkgs_task_result is succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}" with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"

View file

@ -296,7 +296,7 @@ feature_gate_v1_12: []
## List of key=value pairs that describe feature gates for ## List of key=value pairs that describe feature gates for
## the k8s cluster. ## the k8s cluster.
kube_feature_gates: |- kube_feature_gates: |-
{%- if kube_version | version_compare('v1.12.0', '<') -%} {%- if kube_version is version('v1.12.0', '<') -%}
{{ feature_gate_v1_11 }} {{ feature_gate_v1_11 }}
{%- else -%} {%- else -%}
{{ feature_gate_v1_12 }} {{ feature_gate_v1_12 }}

View file

@ -63,7 +63,7 @@
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
delegate_to: "{{groups['etcd'][0]}}" delegate_to: "{{groups['etcd'][0]}}"
when: when:
- calico_version | version_compare("v3.0.0", ">=") - calico_version is version("v3.0.0", ">=")
- name: Calico-rr | Configure route reflector (legacy) - name: Calico-rr | Configure route reflector (legacy)
command: |- command: |-
@ -81,7 +81,7 @@
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
delegate_to: "{{groups['etcd'][0]}}" delegate_to: "{{groups['etcd'][0]}}"
when: when:
- calico_version | version_compare("v3.0.0", "<") - calico_version is version("v3.0.0", "<")
- meta: flush_handlers - meta: flush_handlers

View file

@ -20,7 +20,7 @@
- name: "Check that calico version is enough for upgrade" - name: "Check that calico version is enough for upgrade"
assert: assert:
that: that:
- calico_version_on_server.stdout|version_compare('v2.6.5', '>=') - calico_version_on_server.stdout is version('v2.6.5', '>=')
msg: "Your version of calico is not fresh enough for upgrade" msg: "Your version of calico is not fresh enough for upgrade"
when: calico_upgrade_enabled when: calico_upgrade_enabled
@ -28,8 +28,8 @@
set_fact: set_fact:
calico_upgrade_needed: True calico_upgrade_needed: True
when: when:
- calico_version_on_server.stdout|version_compare('v2.6.5', '>=') - calico_version_on_server.stdout is version('v2.6.5', '>=')
- calico_version_on_server.stdout|version_compare('v3.0.0', '<') - calico_version_on_server.stdout is version('v3.0.0', '<')
when: when:
- 'calico_version_on_server.stdout is defined' - 'calico_version_on_server.stdout is defined'

View file

@ -102,7 +102,7 @@
delegate_to: "{{ groups['kube-master'][0] }}" delegate_to: "{{ groups['kube-master'][0] }}"
when: when:
- 'calico_conf.stdout == "0"' - 'calico_conf.stdout == "0"'
- calico_version | version_compare("v3.0.0", ">=") - calico_version is version("v3.0.0", ">=")
- name: Calico | Configure calico network pool (legacy) - name: Calico | Configure calico network pool (legacy)
shell: > shell: >
@ -119,7 +119,7 @@
delegate_to: "{{ groups['kube-master'][0] }}" delegate_to: "{{ groups['kube-master'][0] }}"
when: when:
- 'calico_conf.stdout == "0"' - 'calico_conf.stdout == "0"'
- calico_version | version_compare("v3.0.0", "<") - calico_version is version("v3.0.0", "<")
- name: "Determine nodeToNodeMesh needed state" - name: "Determine nodeToNodeMesh needed state"
set_fact: set_fact:
@ -144,19 +144,19 @@
run_once: true run_once: true
delegate_to: "{{ groups['kube-master'][0] }}" delegate_to: "{{ groups['kube-master'][0] }}"
when: when:
- calico_version | version_compare('v3.0.0', '>=') - calico_version is version('v3.0.0', '>=')
- name: Calico | Set global as_num (legacy) - name: Calico | Set global as_num (legacy)
command: "{{ bin_dir}}/calicoctl config set asNumber {{ global_as_num }}" command: "{{ bin_dir}}/calicoctl config set asNumber {{ global_as_num }}"
run_once: true run_once: true
when: when:
- calico_version | version_compare('v3.0.0', '<') - calico_version is version('v3.0.0', '<')
- name: Calico | Disable node mesh (legacy) - name: Calico | Disable node mesh (legacy)
command: "{{ bin_dir }}/calicoctl config set nodeToNodeMesh off" command: "{{ bin_dir }}/calicoctl config set nodeToNodeMesh off"
run_once: yes run_once: yes
when: when:
- calico_version | version_compare('v3.0.0', '<') - calico_version is version('v3.0.0', '<')
- nodeToMeshEnabled|default(True) - nodeToMeshEnabled|default(True)
- name: Calico | Configure node asNumber for per node peering - name: Calico | Configure node asNumber for per node peering
@ -176,7 +176,7 @@
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
- calico_version | version_compare('v3.0.0', '>=') - calico_version is version('v3.0.0', '>=')
- peer_with_router|default(false) - peer_with_router|default(false)
- inventory_hostname in groups['k8s-cluster'] - inventory_hostname in groups['k8s-cluster']
- local_as is defined - local_as is defined
@ -199,7 +199,7 @@
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: when:
- calico_version | version_compare('v3.0.0', '<') - calico_version is version('v3.0.0', '<')
- peer_with_router|default(false) - peer_with_router|default(false)
- inventory_hostname in groups['k8s-cluster'] - inventory_hostname in groups['k8s-cluster']
- local_as is defined - local_as is defined
@ -223,7 +223,7 @@
with_items: with_items:
- "{{ peers|rejectattr('scope','equalto', 'global')|default([]) }}" - "{{ peers|rejectattr('scope','equalto', 'global')|default([]) }}"
when: when:
- calico_version | version_compare('v3.0.0', '>=') - calico_version is version('v3.0.0', '>=')
- peer_with_router|default(false) - peer_with_router|default(false)
- inventory_hostname in groups['k8s-cluster'] - inventory_hostname in groups['k8s-cluster']
@ -280,7 +280,7 @@
with_items: "{{ peers|selectattr('scope','equalto', 'global')|default([]) }}" with_items: "{{ peers|selectattr('scope','equalto', 'global')|default([]) }}"
run_once: true run_once: true
when: when:
- calico_version | version_compare('v3.0.0', '<') - calico_version is version('v3.0.0', '<')
- peer_with_router|default(false) - peer_with_router|default(false)
- inventory_hostname in groups['k8s-cluster'] - inventory_hostname in groups['k8s-cluster']
@ -302,7 +302,7 @@
with_items: with_items:
- "{{ groups['calico-rr'] | default([]) }}" - "{{ groups['calico-rr'] | default([]) }}"
when: when:
- calico_version | version_compare('v3.0.0', '>=') - calico_version is version('v3.0.0', '>=')
- peer_with_calico_rr|default(false) - peer_with_calico_rr|default(false)
- inventory_hostname in groups['k8s-cluster'] - inventory_hostname in groups['k8s-cluster']
- hostvars[item]['cluster_id'] == cluster_id - hostvars[item]['cluster_id'] == cluster_id
@ -322,7 +322,7 @@
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{ groups['calico-rr'] | default([]) }}" with_items: "{{ groups['calico-rr'] | default([]) }}"
when: when:
- calico_version | version_compare('v3.0.0', '<') - calico_version is version('v3.0.0', '<')
- not calico_upgrade_enabled - not calico_upgrade_enabled
- peer_with_calico_rr|default(false) - peer_with_calico_rr|default(false)
- hostvars[item]['cluster_id'] == cluster_id - hostvars[item]['cluster_id'] == cluster_id

View file

@ -22,7 +22,7 @@ spec:
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
kubespray.etcd-cert/serial: "{{ etcd_client_cert_serial }}" kubespray.etcd-cert/serial: "{{ etcd_client_cert_serial }}"
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
hostNetwork: true hostNetwork: true

View file

@ -18,7 +18,7 @@ spec:
labels: labels:
k8s-app: canal-node k8s-app: canal-node
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
hostNetwork: true hostNetwork: true

View file

@ -32,7 +32,7 @@ spec:
prometheus.io/port: "9090" prometheus.io/port: "9090"
{% endif %} {% endif %}
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
serviceAccountName: cilium serviceAccountName: cilium

View file

@ -19,7 +19,7 @@ spec:
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12) # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
# The API proxy must run in the host network namespace so that # The API proxy must run in the host network namespace so that

View file

@ -18,7 +18,7 @@ spec:
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12) # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
hostNetwork: true hostNetwork: true

View file

@ -17,7 +17,7 @@ spec:
annotations: annotations:
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
hostNetwork: true hostNetwork: true

View file

@ -17,7 +17,7 @@ spec:
annotations: annotations:
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
hostNetwork: true hostNetwork: true

View file

@ -19,7 +19,7 @@ spec:
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12) # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
# The netmaster must run in the host network namespace so that # The netmaster must run in the host network namespace so that

View file

@ -23,7 +23,7 @@ spec:
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12) # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
hostNetwork: true hostNetwork: true

View file

@ -20,7 +20,7 @@ spec:
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12) # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
hostNetwork: true hostNetwork: true

View file

@ -55,7 +55,7 @@ spec:
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12) # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
serviceAccountName: flannel serviceAccountName: flannel

View file

@ -63,7 +63,7 @@ spec:
annotations: annotations:
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-cluster-critical priorityClassName: system-cluster-critical
{% endif %} {% endif %}
serviceAccountName: kube-router serviceAccountName: kube-router

View file

@ -118,7 +118,7 @@ items:
# Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12) # Mark pod as critical for rescheduling (Will have no effect starting with kubernetes 1.12)
scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/critical-pod: ''
spec: spec:
{% if kube_version|version_compare('v1.11.1', '>=') %} {% if kube_version is version('v1.11.1', '>=') %}
priorityClassName: system-node-critical priorityClassName: system-node-critical
{% endif %} {% endif %}
containers: containers:

View file

@ -44,7 +44,7 @@
- name: Ensure minimum version for drain label selector if necessary - name: Ensure minimum version for drain label selector if necessary
assert: assert:
that: "kubectl_version.stdout.split(' ')[-1] | version_compare('v1.10.0', '>=')" that: "kubectl_version.stdout.split(' ')[-1] is version('v1.10.0', '>=')"
when: when:
- drain_nodes - drain_nodes
- needs_cordoning - needs_cordoning

View file

@ -12,7 +12,7 @@
headers: "{{ vault_client_headers }}" headers: "{{ vault_client_headers }}"
status_code: "{{ vault_successful_http_codes | join(',') }}" status_code: "{{ vault_successful_http_codes | join(',') }}"
register: vault_health_check register: vault_health_check
until: vault_health_check|succeeded until: vault_health_check is succeeded
retries: 10 retries: 10
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
run_once: yes run_once: yes

View file

@ -20,7 +20,7 @@
url: "http://localhost:{{ vault_port }}/" url: "http://localhost:{{ vault_port }}/"
secret_shares: 1 secret_shares: 1
secret_threshold: 1 secret_threshold: 1
until: "vault_temp_init|succeeded" until: "vault_temp_init is succeeded"
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
register: vault_temp_init register: vault_temp_init

View file

@ -4,7 +4,7 @@
shell: docker stop {{ vault_temp_container_name }} || rkt stop {{ vault_temp_container_name }} shell: docker stop {{ vault_temp_container_name }} || rkt stop {{ vault_temp_container_name }}
failed_when: false failed_when: false
register: vault_temp_stop register: vault_temp_stop
changed_when: vault_temp_stop|succeeded changed_when: vault_temp_stop is succeeded
# Check if vault is reachable on the localhost # Check if vault is reachable on the localhost
- name: check_vault | Attempt to pull local https Vault health - name: check_vault | Attempt to pull local https Vault health

View file

@ -7,7 +7,7 @@
method: HEAD method: HEAD
status_code: 200,429,501,503 status_code: 200,429,501,503
register: vault_leader_check register: vault_leader_check
until: "vault_leader_check|succeeded" until: "vault_leader_check is succeeded"
retries: 10 retries: 10
- name: find_leader | Set fact for current http leader - name: find_leader | Set fact for current http leader

View file

@ -55,7 +55,7 @@
no_log: true no_log: true
- debug: var=agents.content|from_json - debug: var=agents.content|from_json
failed_when: not agents|success and not agents.content=='{}' failed_when: not agents is success and not agents.content=='{}'
run_once: true run_once: true
- name: Check netchecker status - name: Check netchecker status
@ -70,7 +70,7 @@
when: not agents.content=='{}' when: not agents.content=='{}'
- debug: var=result.content|from_json - debug: var=result.content|from_json
failed_when: not result|success failed_when: not result is success
run_once: true run_once: true
when: not agents.content=='{}' when: not agents.content=='{}'
delegate_to: "{{groups['kube-master'][0]}}" delegate_to: "{{groups['kube-master'][0]}}"