You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.9 KiB

  1. ---
  2. - name: "Pre-upgrade | check for kube-apiserver unit file"
  3. stat:
  4. path: /etc/systemd/system/kube-apiserver.service
  5. register: kube_apiserver_service_file
  6. tags: [facts, kube-apiserver]
  7. - name: "Pre-upgrade | check for kube-apiserver init script"
  8. stat:
  9. path: /etc/init.d/kube-apiserver
  10. register: kube_apiserver_init_script
  11. tags: [facts, kube-apiserver]
  12. - name: "Pre-upgrade | stop kube-apiserver if service defined"
  13. service:
  14. name: kube-apiserver
  15. state: stopped
  16. when: (kube_apiserver_service_file.stat.exists|default(False) or kube_apiserver_init_script.stat.exists|default(False))
  17. tags: kube-apiserver
  18. - name: "Pre-upgrade | remove kube-apiserver service definition"
  19. file:
  20. path: "{{ item }}"
  21. state: absent
  22. when: (kube_apiserver_service_file.stat.exists|default(False) or kube_apiserver_init_script.stat.exists|default(False))
  23. with_items:
  24. - /etc/systemd/system/kube-apiserver.service
  25. - /etc/init.d/kube-apiserver
  26. tags: kube-apiserver
  27. - name: "Pre-upgrade | See if kube-apiserver manifest exists"
  28. stat:
  29. path: /etc/kubernetes/manifests/kube-apiserver.manifest
  30. register: kube_apiserver_manifest
  31. when: secret_changed|default(false) or etcd_secret_changed|default(false)
  32. - name: "Pre-upgrade | Write invalid image to kube-apiserver manifest if secrets were changed"
  33. replace:
  34. dest: /etc/kubernetes/manifests/kube-apiserver.manifest
  35. regexp: '(\s+)image:\s+.*?$'
  36. replace: '\1image: kill.apiserver.using.fake.image.in:manifest'
  37. register: kube_apiserver_manifest_replaced
  38. when: (secret_changed|default(false) or etcd_secret_changed|default(false)) and kube_apiserver_manifest.stat.exists
  39. - name: "Pre-upgrade | Pause while waiting for kubelet to delete kube-apiserver pod"
  40. pause: seconds=20
  41. when: (secret_changed|default(false) or etcd_secret_changed|default(false)) and kube_apiserver_manifest.stat.exists
  42. tags: kube-apiserver