From 53e5d8b3924d632042a4dd83a5435152ec484218 Mon Sep 17 00:00:00 2001 From: ChengHao Yang <17496418+tico88612@users.noreply.github.com> Date: Tue, 5 Nov 2024 20:52:31 +0800 Subject: [PATCH] Feat: add kubeadm-client.conf support v1beta4 Remove kubeadm api version condition. Currently there is not much difference between the files, if there are more changes in the future, please use different files to distinguish them (you can use the kubeadm_config_api_version variable) Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com> --- roles/kubernetes/kubeadm/tasks/main.yml | 6 +----- ...ubeadm-client.conf.v1beta3.j2 => kubeadm-client.conf.j2} | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) rename roles/kubernetes/kubeadm/templates/{kubeadm-client.conf.v1beta3.j2 => kubeadm-client.conf.j2} (95%) diff --git a/roles/kubernetes/kubeadm/tasks/main.yml b/roles/kubernetes/kubeadm/tasks/main.yml index cb29e2a6a..6b575df0f 100644 --- a/roles/kubernetes/kubeadm/tasks/main.yml +++ b/roles/kubernetes/kubeadm/tasks/main.yml @@ -53,10 +53,6 @@ kubeadm_token: "{{ temp_token.stdout }}" when: kubeadm_token is not defined -- name: Set kubeadm api version to v1beta3 - set_fact: - kubeadmConfig_api_version: v1beta3 - - name: Get kubeconfig for join discovery process command: "{{ kubectl }} -n kube-public get cm cluster-info -o jsonpath='{.data.kubeconfig}'" register: kubeconfig_file_discovery @@ -77,7 +73,7 @@ - name: Create kubeadm client config template: - src: "kubeadm-client.conf.{{ kubeadmConfig_api_version }}.j2" + src: "kubeadm-client.conf.j2" dest: "{{ kube_config_dir }}/kubeadm-client.conf" backup: true mode: "0640" diff --git a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1beta3.j2 b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.j2 similarity index 95% rename from roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1beta3.j2 rename to roles/kubernetes/kubeadm/templates/kubeadm-client.conf.j2 index 5016df9c3..a4e014ca7 100644 --- a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1beta3.j2 +++ b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.j2 @@ -1,5 +1,5 @@ --- -apiVersion: kubeadm.k8s.io/v1beta3 +apiVersion: kubeadm.k8s.io/{{ kubeadm_config_api_version }} kind: JoinConfiguration discovery: {% if kubeadm_use_file_discovery %}