From 5b383125cfd5388012e84f07d0ce5b7929479257 Mon Sep 17 00:00:00 2001 From: Abhay Krishna Date: Mon, 29 Jan 2024 13:52:17 -0800 Subject: [PATCH] Set kubeconfig volume path for kube-vip static pod based on OS (#7396) --- pkg/providers/tinkerbell/config/template-cp.yaml | 4 ++++ pkg/providers/tinkerbell/reconciler/reconciler_test.go | 2 +- .../expected_results_bottlerocket_cert_bundles_config_cp.yaml | 2 +- .../expected_results_bottlerocket_kernel_config_cp.yaml | 2 +- .../testdata/expected_results_bottlerocket_ntp_config_cp.yaml | 2 +- .../expected_results_bottlerocket_settings_config_cp.yaml | 2 +- ...d_results_bottlerocket_upgrade_cert_bundles_config_cp.yaml | 2 +- ...er_tinkerbell_bottlerocket_cp_minimal_registry_mirror.yaml | 2 +- ..._tinkerbell_bottlerocket_cp_registry_mirror_with_auth.yaml | 2 +- ..._tinkerbell_bottlerocket_cp_registry_mirror_with_cert.yaml | 2 +- pkg/providers/vsphere/config/template-cp.yaml | 4 ++++ ...expected_results_bottlerocket_boot_settings_config_cp.yaml | 2 +- .../expected_results_bottlerocket_cert_bundles_config_cp.yaml | 2 +- .../expected_results_bottlerocket_external_etcd_cp.yaml | 2 +- .../expected_results_bottlerocket_kernel_config_cp.yaml | 2 +- .../expected_results_bottlerocket_mirror_config_cp.yaml | 2 +- ...ected_results_bottlerocket_mirror_config_with_auth_cp.yaml | 2 +- ...ected_results_bottlerocket_mirror_config_with_cert_cp.yaml | 2 +- .../testdata/expected_results_bottlerocket_ntp_config_cp.yaml | 2 +- .../expected_results_bottlerocket_settings_config_cp.yaml | 2 +- 20 files changed, 26 insertions(+), 18 deletions(-) diff --git a/pkg/providers/tinkerbell/config/template-cp.yaml b/pkg/providers/tinkerbell/config/template-cp.yaml index cacce41cccaa..d1691a4faaae 100644 --- a/pkg/providers/tinkerbell/config/template-cp.yaml +++ b/pkg/providers/tinkerbell/config/template-cp.yaml @@ -296,7 +296,11 @@ spec: hostNetwork: true volumes: - hostPath: +{{- if (eq .format "bottlerocket") }} + path: /var/lib/kubeadm/admin.conf +{{- else }} path: /etc/kubernetes/admin.conf +{{- end }} name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/tinkerbell/reconciler/reconciler_test.go b/pkg/providers/tinkerbell/reconciler/reconciler_test.go index 2237c90cda02..4efa36d966b9 100644 --- a/pkg/providers/tinkerbell/reconciler/reconciler_test.go +++ b/pkg/providers/tinkerbell/reconciler/reconciler_test.go @@ -1302,7 +1302,7 @@ func tinkerbellCP(clusterName string, opts ...cpOpt) *tinkerbell.ControlPlane { Permissions: "", Encoding: "", Append: false, - Content: "apiVersion: v1\nkind: Pod\nmetadata:\n creationTimestamp: null\n name: kube-vip\n namespace: kube-system\nspec:\n containers:\n - args:\n - manager\n env:\n - name: vip_arp\n value: \"true\"\n - name: port\n value: \"6443\"\n - name: vip_cidr\n value: \"32\"\n - name: cp_enable\n value: \"true\"\n - name: cp_namespace\n value: kube-system\n - name: vip_ddns\n value: \"false\"\n - name: vip_leaderelection\n value: \"true\"\n - name: vip_leaseduration\n value: \"15\"\n - name: vip_renewdeadline\n value: \"10\"\n - name: vip_retryperiod\n value: \"2\"\n - name: address\n value: 1.1.1.1\n image: \n imagePullPolicy: IfNotPresent\n name: kube-vip\n resources: {}\n securityContext:\n capabilities:\n add:\n - NET_ADMIN\n - NET_RAW\n volumeMounts:\n - mountPath: /etc/kubernetes/admin.conf\n name: kubeconfig\n hostNetwork: true\n volumes:\n - hostPath:\n path: /etc/kubernetes/admin.conf\n name: kubeconfig\nstatus: {}\n", + Content: "apiVersion: v1\nkind: Pod\nmetadata:\n creationTimestamp: null\n name: kube-vip\n namespace: kube-system\nspec:\n containers:\n - args:\n - manager\n env:\n - name: vip_arp\n value: \"true\"\n - name: port\n value: \"6443\"\n - name: vip_cidr\n value: \"32\"\n - name: cp_enable\n value: \"true\"\n - name: cp_namespace\n value: kube-system\n - name: vip_ddns\n value: \"false\"\n - name: vip_leaderelection\n value: \"true\"\n - name: vip_leaseduration\n value: \"15\"\n - name: vip_renewdeadline\n value: \"10\"\n - name: vip_retryperiod\n value: \"2\"\n - name: address\n value: 1.1.1.1\n image: \n imagePullPolicy: IfNotPresent\n name: kube-vip\n resources: {}\n securityContext:\n capabilities:\n add:\n - NET_ADMIN\n - NET_RAW\n volumeMounts:\n - mountPath: /etc/kubernetes/admin.conf\n name: kubeconfig\n hostNetwork: true\n volumes:\n - hostPath:\n path: /var/lib/kubeadm/admin.conf\n name: kubeconfig\nstatus: {}\n", ContentFrom: nil, }, { diff --git a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_cert_bundles_config_cp.yaml b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_cert_bundles_config_cp.yaml index 8828ab211bbd..509e69fb8082 100644 --- a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_cert_bundles_config_cp.yaml +++ b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_cert_bundles_config_cp.yaml @@ -211,7 +211,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_kernel_config_cp.yaml b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_kernel_config_cp.yaml index 702115fe1eaf..73f26dcf0397 100644 --- a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_kernel_config_cp.yaml +++ b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_kernel_config_cp.yaml @@ -177,7 +177,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_ntp_config_cp.yaml b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_ntp_config_cp.yaml index 1e4b0c5bb3cf..686a54386389 100644 --- a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_ntp_config_cp.yaml +++ b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_ntp_config_cp.yaml @@ -151,7 +151,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_settings_config_cp.yaml b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_settings_config_cp.yaml index 68272ac1e36c..bd76ca91d187 100644 --- a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_settings_config_cp.yaml +++ b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_settings_config_cp.yaml @@ -169,7 +169,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_upgrade_cert_bundles_config_cp.yaml b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_upgrade_cert_bundles_config_cp.yaml index f520beb54706..3613b2f5fed2 100644 --- a/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_upgrade_cert_bundles_config_cp.yaml +++ b/pkg/providers/tinkerbell/testdata/expected_results_bottlerocket_upgrade_cert_bundles_config_cp.yaml @@ -160,7 +160,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_minimal_registry_mirror.yaml b/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_minimal_registry_mirror.yaml index 51f4d1445063..31e9f3e1d8ec 100644 --- a/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_minimal_registry_mirror.yaml +++ b/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_minimal_registry_mirror.yaml @@ -155,7 +155,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_registry_mirror_with_auth.yaml b/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_registry_mirror_with_auth.yaml index cfd20452e65f..b1f890829731 100644 --- a/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_registry_mirror_with_auth.yaml +++ b/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_registry_mirror_with_auth.yaml @@ -191,7 +191,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_registry_mirror_with_cert.yaml b/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_registry_mirror_with_cert.yaml index e08703db33b4..2f43a51c3082 100644 --- a/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_registry_mirror_with_cert.yaml +++ b/pkg/providers/tinkerbell/testdata/expected_results_cluster_tinkerbell_bottlerocket_cp_registry_mirror_with_cert.yaml @@ -191,7 +191,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/config/template-cp.yaml b/pkg/providers/vsphere/config/template-cp.yaml index 223b906fa513..b0df77caa004 100644 --- a/pkg/providers/vsphere/config/template-cp.yaml +++ b/pkg/providers/vsphere/config/template-cp.yaml @@ -283,7 +283,11 @@ spec: hostNetwork: true volumes: - hostPath: +{{- if (eq .format "bottlerocket") }} + path: /var/lib/kubeadm/admin.conf +{{- else }} path: /etc/kubernetes/admin.conf +{{- end }} name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_boot_settings_config_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_boot_settings_config_cp.yaml index d8f2e5dbb4ed..0f953e00da4e 100644 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_boot_settings_config_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_boot_settings_config_cp.yaml @@ -199,7 +199,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_cert_bundles_config_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_cert_bundles_config_cp.yaml index 287bcb3718c7..bf5d21c78083 100644 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_cert_bundles_config_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_cert_bundles_config_cp.yaml @@ -208,7 +208,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_external_etcd_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_external_etcd_cp.yaml index b2239b54ad2e..49cb5fb08112 100644 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_external_etcd_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_external_etcd_cp.yaml @@ -194,7 +194,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_kernel_config_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_kernel_config_cp.yaml index a2d1cd7ad9cf..d661923d68d9 100644 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_kernel_config_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_kernel_config_cp.yaml @@ -192,7 +192,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_cp.yaml index abf8327a4256..605e23f9a9d0 100644 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_cp.yaml @@ -189,7 +189,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_with_auth_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_with_auth_cp.yaml index 56238034d0fa..ab55a262c2a1 100644 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_with_auth_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_with_auth_cp.yaml @@ -207,7 +207,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_with_cert_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_with_cert_cp.yaml index 183922b9de74..7e5e6bda6ec7 100644 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_with_cert_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_mirror_config_with_cert_cp.yaml @@ -207,7 +207,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_ntp_config_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_ntp_config_cp.yaml index 616bcbf92fa8..9e63ac1e9bdc 100755 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_ntp_config_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_ntp_config_cp.yaml @@ -187,7 +187,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root diff --git a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_settings_config_cp.yaml b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_settings_config_cp.yaml index 7147d14586b0..de36a85cca25 100644 --- a/pkg/providers/vsphere/testdata/expected_results_bottlerocket_settings_config_cp.yaml +++ b/pkg/providers/vsphere/testdata/expected_results_bottlerocket_settings_config_cp.yaml @@ -196,7 +196,7 @@ spec: hostNetwork: true volumes: - hostPath: - path: /etc/kubernetes/admin.conf + path: /var/lib/kubeadm/admin.conf name: kubeconfig status: {} owner: root:root