Browse Source

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>
pull/11674/head
ChengHao Yang 2 weeks ago
parent
commit
53e5d8b392
Failed to extract signature
2 changed files with 2 additions and 6 deletions
  1. 6
      roles/kubernetes/kubeadm/tasks/main.yml
  2. 2
      roles/kubernetes/kubeadm/templates/kubeadm-client.conf.j2

6
roles/kubernetes/kubeadm/tasks/main.yml

@ -53,10 +53,6 @@
kubeadm_token: "{{ temp_token.stdout }}" kubeadm_token: "{{ temp_token.stdout }}"
when: kubeadm_token is not defined 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 - name: Get kubeconfig for join discovery process
command: "{{ kubectl }} -n kube-public get cm cluster-info -o jsonpath='{.data.kubeconfig}'" command: "{{ kubectl }} -n kube-public get cm cluster-info -o jsonpath='{.data.kubeconfig}'"
register: kubeconfig_file_discovery register: kubeconfig_file_discovery
@ -77,7 +73,7 @@
- name: Create kubeadm client config - name: Create kubeadm client config
template: template:
src: "kubeadm-client.conf.{{ kubeadmConfig_api_version }}.j2"
src: "kubeadm-client.conf.j2"
dest: "{{ kube_config_dir }}/kubeadm-client.conf" dest: "{{ kube_config_dir }}/kubeadm-client.conf"
backup: true backup: true
mode: "0640" mode: "0640"

roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1beta3.j2 → 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 kind: JoinConfiguration
discovery: discovery:
{% if kubeadm_use_file_discovery %} {% if kubeadm_use_file_discovery %}
Loading…
Cancel
Save