Merge "Use symlinks instead of bind mounts for K8s versioning"

This commit is contained in:
Zuul 2024-05-03 21:36:32 +00:00 committed by Gerrit Code Review
commit 5248f7517e
4 changed files with 20 additions and 20 deletions

View File

@ -12,16 +12,16 @@
- name: Set Kubernetes local directory
set_fact:
kube_local_dir: "/usr/local/kubernetes"
kube_symlink_dir: "/var/lib/kubernetes"
# When updating kubernetes, kubeadm and kubelet/kubectl need to be updated separately
# and we will have "stage1" and "stage2" subdirectories to separate these different stages.
- name: Bind Kubernetes stage1 and stage2 directories
mount:
path: "{{ kube_local_dir }}/current/{{ item }}"
# When updating Kubernetes, kubeadm and kubelet need to be updated separately
# so we will have "stage1" and "stage2" symlinks under
# /var/lib/kubernetes to separate these different stages.
- name: Link Kubernetes stage1 and stage2 directories
ansible.builtin.file:
src: "{{ kube_local_dir }}/{{ kubernetes_version }}/{{ item }}"
opts: bind
state: mounted
fstype: none
dest: "{{ kube_symlink_dir }}/{{ item }}"
state: link
with_items:
- "stage1"
- "stage2"

View File

@ -39,9 +39,9 @@
when: last_config_file_exists and reconfigure_endpoints and
(mgmt_virtual != prev_mgmt_virtual)
- name: Mount current Kubernetes version
- name: Create symlinks for current Kubernetes version
import_role:
name: common/k8s-bind-mount
name: common/k8s-symlinks
- name: Refresh local DNS (i.e. /etc/hosts)
import_tasks: refresh_local_dns.yml

View File

@ -12,16 +12,16 @@
- name: Set Kubernetes local directory
set_fact:
kube_local_dir: "/usr/local/kubernetes"
kube_symlink_dir: "/var/lib/kubernetes"
# When updating kubernetes, kubeadm and kubelet/kubectl need to be updated separately
# and we will have "stage1" and "stage2" subdirectories to separate these different stages.
- name: Bind Kubernetes stage1 and stage2 directories
mount:
path: "{{ kube_local_dir }}/current/{{ item }}"
# When updating kubernetes, kubeadm, and kubelet need to be updated separately
# so we will have "stage1" and "stage2" symlinks under
# /var/lib/kubernetes to separate these different stages.
- name: Link Kubernetes stage1 and stage2 directories
ansible.builtin.file:
src: "{{ kube_local_dir }}/{{ kubernetes_version }}/{{ item }}"
opts: bind
state: mounted
fstype: none
dest: "{{ kube_symlink_dir }}/{{ item }}"
state: link
with_items:
- "stage1"
- "stage2"

View File

@ -29,9 +29,9 @@
import_role:
name: common/get-kube-version
- name: Mount k8s bind mount
- name: Create symlinks for current Kubernetes version
import_role:
name: common/k8s-bind-mount
name: common/k8s-symlinks
- name: Enable kubelet
systemd: