use etcd2 when upgrading unless forced

This commit is contained in:
Matthew Mosesohn 2017-03-30 17:08:13 +04:00
parent d42e4f2344
commit 80828a7c77
3 changed files with 10 additions and 2 deletions

View file

@ -16,6 +16,9 @@ etcd_cert_dir: "{{ etcd_config_dir }}/ssl"
# ETCD backend for k8s data
kube_apiserver_storage_backend: etcd3
# By default, force back to etcd2. Set to true to force etcd3 (experimental!)
force_etcd3: false
# Limits for kube components
kube_controller_memory_limit: 512M
kube_controller_cpu_limit: 250m

View file

@ -42,5 +42,5 @@
url: http://localhost:8080/healthz
register: result
until: result.status == 200
retries: 10
retries: 20
delay: 6

View file

@ -42,6 +42,11 @@
when: kube_apiserver_storage_backend == "etcd3"
failed_when: false
- name: "Pre-upgrade | etcd3 upgrade | use etcd2 unless forced to etc3"
set_fact:
kube_apiserver_storage_backend: "etcd2"
when: old_data_exists.rc == 0 and not force_etcd3|bool
- name: "Pre-upgrade | etcd3 upgrade | see if data was already migrated"
command: "{{ bin_dir }}/etcdctl --endpoints={{ etcd_access_addresses }} get --limit=1 --prefix=true /registry/minions"
environment:
@ -53,7 +58,7 @@
- name: "Pre-upgrade | etcd3 upgrade | set needs_etcd_migration"
set_fact:
needs_etcd_migration: "{{ kube_apiserver_storage_backend == 'etcd3' and data_migrated.stdout_lines|length == 0 and old_data_exists.rc == 0 }}"
needs_etcd_migration: "{{ force_etcd3|default(false) and kube_apiserver_storage_backend == 'etcd3' and data_migrated.stdout_lines|length == 0 and old_data_exists.rc == 0 }}"
- name: "Pre-upgrade | Delete master manifests on all kube-masters"
file: