Merge pull request #3305 from mattymo/fixup_upgrade

Fixes for upgrade mode
pull/3318/head
k8s-ci-robot 2018-09-13 12:57:23 -07:00 committed by GitHub
commit 9964ba77ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,5 @@
---
drain_grace_period: 300
drain_timeout: 360s
drain_label_selector: ""
drain_pod_selector: ""
drain_nodes: true

View File

@ -32,6 +32,24 @@
delegate_to: "{{ groups['kube-master'][0] }}"
when: needs_cordoning
- name: Check kubectl version
command: kubectl version --client --short
register: kubectl_version
delegate_to: "{{ groups['kube-master'][0] }}"
run_once: yes
when:
- drain_nodes
- needs_cordoning
- 'drain_pod_selector != ""'
- name: Ensure minimum version for drain label selector if necessary
assert:
that: "kubectl_version.stdout.split(' ')[-1] | version_compare('v1.10.0', '>=')"
when:
- drain_nodes
- needs_cordoning
- 'drain_pod_selector != ""'
- name: Drain node
command: >-
{{ bin_dir }}/kubectl drain
@ -40,7 +58,7 @@
--grace-period {{ drain_grace_period }}
--timeout {{ drain_timeout }}
--delete-local-data {{ inventory_hostname }}
{% if drain_label_selector != "" %}--selector '{{ drain_label_selector }}'{% endif %}
{% if drain_pod_selector != "" %}--pod-selector '{{ drain_pod_selector }}'{% endif %}
delegate_to: "{{ groups['kube-master'][0] }}"
when:
- drain_nodes