fix apply for netchecker upgrade (#1659)
* fix apply for netchecker upgrade and graceful upgrade * Speed up daemonset upgrades. Make check wait for ds upgrades.
This commit is contained in:
parent
8d766a2ca9
commit
b294db5aed
9 changed files with 21 additions and 21 deletions
|
@ -10,6 +10,7 @@
|
||||||
kube:
|
kube:
|
||||||
name: "netchecker-server"
|
name: "netchecker-server"
|
||||||
namespace: "{{ netcheck_namespace }}"
|
namespace: "{{ netcheck_namespace }}"
|
||||||
|
filename: "{{ netchecker_server_manifest.stat.path }}"
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "deploy"
|
resource: "deploy"
|
||||||
state: latest
|
state: latest
|
||||||
|
|
|
@ -42,6 +42,5 @@ spec:
|
||||||
memory: {{ netchecker_agent_memory_requests }}
|
memory: {{ netchecker_agent_memory_requests }}
|
||||||
updateStrategy:
|
updateStrategy:
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: 100%
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
|
|
||||||
|
|
|
@ -46,5 +46,5 @@ spec:
|
||||||
memory: {{ netchecker_agent_memory_requests }}
|
memory: {{ netchecker_agent_memory_requests }}
|
||||||
updateStrategy:
|
updateStrategy:
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: 100%
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
|
|
|
@ -13,22 +13,18 @@
|
||||||
kube_apiserver_storage_backend: "etcd2"
|
kube_apiserver_storage_backend: "etcd2"
|
||||||
when: old_data_exists.rc == 0 and not force_etcd3|bool
|
when: old_data_exists.rc == 0 and not force_etcd3|bool
|
||||||
|
|
||||||
- name: "Pre-upgrade | Delete master manifests on all kube-masters"
|
- name: "Pre-upgrade | Delete master manifests"
|
||||||
file:
|
file:
|
||||||
path: "/etc/kubernetes/manifests/{{item[1]}}.manifest"
|
path: "/etc/kubernetes/manifests/{{item}}.manifest"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{item[0]}}"
|
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{groups['kube-master']}}"
|
|
||||||
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
||||||
register: kube_apiserver_manifest_replaced
|
register: kube_apiserver_manifest_replaced
|
||||||
when: (secret_changed|default(false) or etcd_secret_changed|default(false))
|
when: (secret_changed|default(false) or etcd_secret_changed|default(false))
|
||||||
|
|
||||||
- name: "Pre-upgrade | Delete master containers forcefully on all kube-masters"
|
- name: "Pre-upgrade | Delete master containers forcefully"
|
||||||
shell: "docker ps -f name=k8s-{{item}}* -q | xargs --no-run-if-empty docker rm -f"
|
shell: "docker ps -f name=k8s-{{item}}* -q | xargs --no-run-if-empty docker rm -f"
|
||||||
delegate_to: "{{item[0]}}"
|
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{groups['kube-master']}}"
|
|
||||||
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
||||||
when: kube_apiserver_manifest_replaced.changed
|
when: kube_apiserver_manifest_replaced.changed
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
|
@ -161,6 +161,6 @@ spec:
|
||||||
path: "{{ calico_cert_dir }}"
|
path: "{{ calico_cert_dir }}"
|
||||||
updateStrategy:
|
updateStrategy:
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: {{ serial | default('20%') }}
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
|
|
||||||
|
|
|
@ -190,5 +190,5 @@ spec:
|
||||||
readOnly: true
|
readOnly: true
|
||||||
updateStrategy:
|
updateStrategy:
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: {{ serial | default('20%') }}
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
|
|
|
@ -121,5 +121,5 @@ spec:
|
||||||
path: /opt/cni/bin
|
path: /opt/cni/bin
|
||||||
updateStrategy:
|
updateStrategy:
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: {{ serial | default('20%') }}
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
|
|
|
@ -156,6 +156,6 @@ items:
|
||||||
path: /lib/modules
|
path: /lib/modules
|
||||||
updateStrategy:
|
updateStrategy:
|
||||||
rollingUpdate:
|
rollingUpdate:
|
||||||
maxUnavailable: 1
|
maxUnavailable: {{ serial | default('20%') }}
|
||||||
type: RollingUpdate
|
type: RollingUpdate
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,11 @@
|
||||||
bin_dir: "/usr/local/bin"
|
bin_dir: "/usr/local/bin"
|
||||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||||
|
|
||||||
- name: Check kubectl output
|
|
||||||
shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
|
|
||||||
register: get_pods
|
|
||||||
|
|
||||||
- debug: msg="{{get_pods.stdout.split('\n')}}"
|
|
||||||
|
|
||||||
- name: Get pod names
|
- name: Get pod names
|
||||||
shell: "{{bin_dir}}/kubectl get pods -o json"
|
shell: "{{bin_dir}}/kubectl get pods -o json"
|
||||||
register: pods
|
register: pods
|
||||||
until: '"ContainerCreating" not in pods.stdout'
|
until: '"ContainerCreating" not in pods.stdout and "Terminating" not in pods.stdout'
|
||||||
retries: 60
|
retries: 60
|
||||||
delay: 2
|
delay: 2
|
||||||
no_log: true
|
no_log: true
|
||||||
|
@ -30,11 +25,20 @@
|
||||||
command: "{{bin_dir}}/kubectl get pods -o
|
command: "{{bin_dir}}/kubectl get pods -o
|
||||||
jsonpath='{range .items[?(.spec.hostNetwork)]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
|
jsonpath='{range .items[?(.spec.hostNetwork)]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
|
||||||
register: hostnet_pods
|
register: hostnet_pods
|
||||||
|
no_log: true
|
||||||
|
|
||||||
- name: Get running pods
|
- name: Get running pods
|
||||||
command: "{{bin_dir}}/kubectl get pods -o
|
command: "{{bin_dir}}/kubectl get pods -o
|
||||||
jsonpath='{range .items[?(.status.phase==\"Running\")]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
|
jsonpath='{range .items[?(.status.phase==\"Running\")]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
|
||||||
register: running_pods
|
register: running_pods
|
||||||
|
no_log: true
|
||||||
|
|
||||||
|
- name: Check kubectl output
|
||||||
|
shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
|
||||||
|
register: get_pods
|
||||||
|
no_log: true
|
||||||
|
|
||||||
|
- debug: msg="{{get_pods.stdout.split('\n')}}"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
kube_pods_subnet: 10.233.64.0/18
|
kube_pods_subnet: 10.233.64.0/18
|
||||||
|
|
Loading…
Reference in a new issue