Skip to content

Commit 8c7b85e

Browse files
committed
Templates: Set provider ID directly via kubelet
This commit sets the provider ID in the ubuntu templates. To avoid issues with potential mismatches between node names and openstack servers we can configure the kubelet to set the provider ID. Otherwise, the cloud controller will try to match nodes and servers based on just the name. The names can differ because of special characters, like dots. When this happens, the cloud controller will be unable to match them and thus believe that the node has no underlying server.
1 parent 1c7fb2e commit 8c7b85e

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

kustomize/v1alpha7/default/cluster-template.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ spec:
5151
name: '{{ local_hostname }}'
5252
kubeletExtraArgs:
5353
cloud-provider: external
54+
provider-id: "openstack:///'{{ instance_id }}'"
5455
clusterConfiguration:
5556
apiServer:
5657
extraArgs:
@@ -63,6 +64,7 @@ spec:
6364
name: '{{ local_hostname }}'
6465
kubeletExtraArgs:
6566
cloud-provider: external
67+
provider-id: "openstack:///'{{ instance_id }}'"
6668
files: []
6769
version: "${KUBERNETES_VERSION}"
6870
---
@@ -133,6 +135,7 @@ spec:
133135
name: '{{ local_hostname }}'
134136
kubeletExtraArgs:
135137
cloud-provider: external
138+
provider-id: "openstack:///'{{ instance_id }}'"
136139
---
137140
apiVersion: v1
138141
kind: Secret

kustomize/v1alpha7/flatcar/patch-flatcar.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ spec:
1717
joinConfiguration:
1818
nodeRegistration:
1919
name: $${COREOS_OPENSTACK_HOSTNAME}
20+
kubeletExtraArgs:
21+
provider-id: null
2022
initConfiguration:
2123
nodeRegistration:
2224
name: $${COREOS_OPENSTACK_HOSTNAME}
25+
kubeletExtraArgs:
26+
# Fixme(lentzi90): This is here just to override the value set in the default
27+
# kustomization. It will be replaced with a value that works for flatcar in
28+
# https://github.com/kubernetes-sigs/cluster-api-provider-openstack/pull/1564
29+
provider-id: null
2330
format: ignition
2431
ignition:
2532
containerLinuxConfig:
@@ -54,6 +61,11 @@ spec:
5461
joinConfiguration:
5562
nodeRegistration:
5663
name: $${COREOS_OPENSTACK_HOSTNAME}
64+
kubeletExtraArgs:
65+
# Fixme(lentzi90): This is here just to override the value set in the default
66+
# kustomization. It will be replaced with a value that works for flatcar in
67+
# https://github.com/kubernetes-sigs/cluster-api-provider-openstack/pull/1564
68+
provider-id: null
5769
preKubeadmCommands:
5870
- export COREOS_OPENSTACK_HOSTNAME=$${COREOS_OPENSTACK_HOSTNAME%.*}
5971
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp

templates/cluster-template-without-lb.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
nodeRegistration:
2121
kubeletExtraArgs:
2222
cloud-provider: external
23+
provider-id: openstack:///'{{ instance_id }}'
2324
name: '{{ local_hostname }}'
2425
---
2526
apiVersion: cluster.x-k8s.io/v1beta1
@@ -83,11 +84,13 @@ spec:
8384
nodeRegistration:
8485
kubeletExtraArgs:
8586
cloud-provider: external
87+
provider-id: openstack:///'{{ instance_id }}'
8688
name: '{{ local_hostname }}'
8789
joinConfiguration:
8890
nodeRegistration:
8991
kubeletExtraArgs:
9092
cloud-provider: external
93+
provider-id: openstack:///'{{ instance_id }}'
9194
name: '{{ local_hostname }}'
9295
machineTemplate:
9396
infrastructureRef:

templates/cluster-template.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
nodeRegistration:
2121
kubeletExtraArgs:
2222
cloud-provider: external
23+
provider-id: openstack:///'{{ instance_id }}'
2324
name: '{{ local_hostname }}'
2425
---
2526
apiVersion: cluster.x-k8s.io/v1beta1
@@ -83,11 +84,13 @@ spec:
8384
nodeRegistration:
8485
kubeletExtraArgs:
8586
cloud-provider: external
87+
provider-id: openstack:///'{{ instance_id }}'
8688
name: '{{ local_hostname }}'
8789
joinConfiguration:
8890
nodeRegistration:
8991
kubeletExtraArgs:
9092
cloud-provider: external
93+
provider-id: openstack:///'{{ instance_id }}'
9194
name: '{{ local_hostname }}'
9295
machineTemplate:
9396
infrastructureRef:

0 commit comments

Comments
 (0)