Skip to content

Commit 41674c8

Browse files
authored
Merge pull request #1522 from tormath1/tormath1/flatcar
⚠️ flatcar: make external-cloud-provider-flatcar the default one
2 parents 097d20a + 06c7274 commit 41674c8

File tree

11 files changed

+147
-120
lines changed

11 files changed

+147
-120
lines changed

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ e2e-templates: $(addprefix $(E2E_TEMPLATES_DIR)/, \
162162
cluster-template-without-lb.yaml \
163163
cluster-template.yaml) \
164164
$(addprefix $(E2E_NO_ARTIFACT_TEMPLATES_DIR)/, \
165-
cluster-template-flatcar.yaml \
166-
cluster-template-external-cloud-provider-flatcar.yaml) \
165+
cluster-template-flatcar.yaml)
167166

168167
$(E2E_TEMPLATES_DIR)/cluster-template.yaml: $(E2E_KUSTOMIZE_DIR)/with-tags $(KUSTOMIZE) FORCE
169168
$(KUSTOMIZE) build "$<" > "$@"
@@ -424,8 +423,7 @@ release-notes: $(RELEASE_NOTES) ## Generate release notes
424423
templates: ## Generate cluster templates
425424
templates: templates/cluster-template.yaml \
426425
templates/cluster-template-without-lb.yaml \
427-
templates/cluster-template-flatcar.yaml \
428-
templates/cluster-template-external-cloud-provider-flatcar.yaml \
426+
templates/cluster-template-flatcar.yaml
429427

430428
templates/cluster-template.yaml: kustomize/v1alpha7/default $(KUSTOMIZE) FORCE
431429
$(KUSTOMIZE) build "$<" > "$@"

RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ It is recommended to create at least one release candidate when bumping `X` or `
7272
- `./out/infrastructure-components.yaml`
7373
- `./out/cluster-template.yaml`
7474
- `./out/cluster-template-without-lb.yaml`
75+
- `./out/cluster-template-flatcar.yaml`
7576
- `./out/metadata.yaml`
7677
1. Ensure that the release image has been promoted.
7778
1. Publish release.

docs/book/src/clusteropenstack/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Some OS like [Fedora CoreOS](https://getfedora.org/en/coreos) or [Flatcar](https
7777
To use Flatcar image:
7878
* Build the image with the [image-builder](https://image-builder.sigs.k8s.io/capi/providers/openstack.html): `make OEM_ID=openstack build-qemu-flatcar`
7979
* Export the name of the uploaded image: `export OPENSTACK_FLATCAR_IMAGE_NAME=flatcar-stable-3374.2.5-kube-v1.25.6`
80-
* When generating the cluster configuration, use one of the following Cluster API [flavor](https://cluster-api.sigs.k8s.io/clusterctl/commands/generate-cluster.html?#flavors): `--flavor flatcar` or `--flavor external-cloud-provider-flatcar` (_NOTE_: If you select `external-cloud-provider-flatcar`, don't forget to refer to the [external-cloud-provider](https://cluster-api-openstack.sigs.k8s.io/topics/external-cloud-provider.html) section)
80+
* When generating the cluster configuration, use the following Cluster API [flavor](https://cluster-api.sigs.k8s.io/clusterctl/commands/generate-cluster.html?#flavors): `--flavor flatcar` (_NOTE_: Don't forget to refer to the [external-cloud-provider](https://cluster-api-openstack.sigs.k8s.io/topics/external-cloud-provider.html) section)
8181

8282
## SSH key pair
8383

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resources:
2+
- ../default
3+
4+
patchesStrategicMerge:
5+
- patch-flatcar.yaml
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
3+
kind: OpenStackCluster
4+
metadata:
5+
name: ${CLUSTER_NAME}
6+
spec:
7+
apiServerLoadBalancer:
8+
$patch: delete
9+
---
10+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
11+
kind: KubeadmControlPlane
12+
metadata:
13+
name: "${CLUSTER_NAME}-control-plane"
14+
spec:
15+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
16+
kubeadmConfigSpec:
17+
joinConfiguration:
18+
nodeRegistration:
19+
name: $${COREOS_OPENSTACK_HOSTNAME}
20+
initConfiguration:
21+
nodeRegistration:
22+
name: $${COREOS_OPENSTACK_HOSTNAME}
23+
format: ignition
24+
ignition:
25+
containerLinuxConfig:
26+
additionalConfig: |
27+
systemd:
28+
units:
29+
30+
enabled: true
31+
- name: kubeadm.service
32+
enabled: true
33+
dropins:
34+
- name: 10-flatcar.conf
35+
contents: |
36+
[Unit]
37+
Requires=containerd.service coreos-metadata.service
38+
After=containerd.service coreos-metadata.service
39+
40+
[Service]
41+
EnvironmentFile=/run/metadata/flatcar
42+
preKubeadmCommands:
43+
- export COREOS_OPENSTACK_HOSTNAME=$${COREOS_OPENSTACK_HOSTNAME%.*}
44+
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
45+
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml
46+
---
47+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
48+
kind: KubeadmConfigTemplate
49+
metadata:
50+
name: ${CLUSTER_NAME}-md-0
51+
spec:
52+
template:
53+
spec:
54+
joinConfiguration:
55+
nodeRegistration:
56+
name: $${COREOS_OPENSTACK_HOSTNAME}
57+
preKubeadmCommands:
58+
- export COREOS_OPENSTACK_HOSTNAME=$${COREOS_OPENSTACK_HOSTNAME%.*}
59+
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
60+
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml
61+
format: ignition
62+
ignition:
63+
containerLinuxConfig:
64+
additionalConfig: |
65+
systemd:
66+
units:
67+
68+
enabled: true
69+
- name: kubeadm.service
70+
enabled: true
71+
dropins:
72+
- name: 10-flatcar.conf
73+
contents: |
74+
[Unit]
75+
Requires=containerd.service coreos-metadata.service
76+
After=containerd.service coreos-metadata.service
77+
78+
[Service]
79+
EnvironmentFile=/run/metadata/flatcar
80+
---
81+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
82+
kind: OpenStackMachineTemplate
83+
metadata:
84+
name: ${CLUSTER_NAME}-md-0
85+
spec:
86+
template:
87+
spec:
88+
image: ${OPENSTACK_FLATCAR_IMAGE_NAME}
89+
---
90+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
91+
kind: OpenStackMachineTemplate
92+
metadata:
93+
name: ${CLUSTER_NAME}-control-plane
94+
spec:
95+
template:
96+
spec:
97+
image: ${OPENSTACK_FLATCAR_IMAGE_NAME}

templates/cluster-template-flatcar.yaml

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,7 @@ metadata:
1515
spec:
1616
template:
1717
spec:
18-
files:
19-
- content: ${OPENSTACK_CLOUD_PROVIDER_CONF_B64}
20-
encoding: base64
21-
owner: root
22-
path: /etc/kubernetes/cloud.conf
23-
permissions: "0600"
24-
- content: ${OPENSTACK_CLOUD_CACERT_B64}
25-
encoding: base64
26-
owner: root
27-
path: /etc/certs/cacert
28-
permissions: "0600"
18+
files: []
2919
format: ignition
3020
ignition:
3121
containerLinuxConfig:
@@ -48,8 +38,7 @@ spec:
4838
joinConfiguration:
4939
nodeRegistration:
5040
kubeletExtraArgs:
51-
cloud-config: /etc/kubernetes/cloud.conf
52-
cloud-provider: openstack
41+
cloud-provider: external
5342
name: $${COREOS_OPENSTACK_HOSTNAME}
5443
preKubeadmCommands:
5544
- export COREOS_OPENSTACK_HOSTNAME=$${COREOS_OPENSTACK_HOSTNAME%.*}
@@ -71,7 +60,7 @@ spec:
7160
kind: KubeadmControlPlane
7261
name: ${CLUSTER_NAME}-control-plane
7362
infrastructureRef:
74-
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
63+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
7564
kind: OpenStackCluster
7665
name: ${CLUSTER_NAME}
7766
---
@@ -94,7 +83,7 @@ spec:
9483
clusterName: ${CLUSTER_NAME}
9584
failureDomain: ${OPENSTACK_FAILURE_DOMAIN}
9685
infrastructureRef:
97-
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
86+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
9887
kind: OpenStackMachineTemplate
9988
name: ${CLUSTER_NAME}-md-0
10089
version: ${KUBERNETES_VERSION}
@@ -108,37 +97,11 @@ spec:
10897
clusterConfiguration:
10998
apiServer:
11099
extraArgs:
111-
cloud-config: /etc/kubernetes/cloud.conf
112-
cloud-provider: openstack
113-
extraVolumes:
114-
- hostPath: /etc/kubernetes/cloud.conf
115-
mountPath: /etc/kubernetes/cloud.conf
116-
name: cloud
117-
readOnly: true
100+
cloud-provider: external
118101
controllerManager:
119102
extraArgs:
120-
cloud-config: /etc/kubernetes/cloud.conf
121-
cloud-provider: openstack
122-
extraVolumes:
123-
- hostPath: /etc/kubernetes/cloud.conf
124-
mountPath: /etc/kubernetes/cloud.conf
125-
name: cloud
126-
readOnly: true
127-
- hostPath: /etc/certs/cacert
128-
mountPath: /etc/certs/cacert
129-
name: cacerts
130-
readOnly: true
131-
files:
132-
- content: ${OPENSTACK_CLOUD_PROVIDER_CONF_B64}
133-
encoding: base64
134-
owner: root
135-
path: /etc/kubernetes/cloud.conf
136-
permissions: "0600"
137-
- content: ${OPENSTACK_CLOUD_CACERT_B64}
138-
encoding: base64
139-
owner: root
140-
path: /etc/certs/cacert
141-
permissions: "0600"
103+
cloud-provider: external
104+
files: []
142105
format: ignition
143106
ignition:
144107
containerLinuxConfig:
@@ -161,28 +124,26 @@ spec:
161124
initConfiguration:
162125
nodeRegistration:
163126
kubeletExtraArgs:
164-
cloud-config: /etc/kubernetes/cloud.conf
165-
cloud-provider: openstack
127+
cloud-provider: external
166128
name: $${COREOS_OPENSTACK_HOSTNAME}
167129
joinConfiguration:
168130
nodeRegistration:
169131
kubeletExtraArgs:
170-
cloud-config: /etc/kubernetes/cloud.conf
171-
cloud-provider: openstack
132+
cloud-provider: external
172133
name: $${COREOS_OPENSTACK_HOSTNAME}
173134
preKubeadmCommands:
174135
- export COREOS_OPENSTACK_HOSTNAME=$${COREOS_OPENSTACK_HOSTNAME%.*}
175136
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
176137
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml
177138
machineTemplate:
178139
infrastructureRef:
179-
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
140+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
180141
kind: OpenStackMachineTemplate
181142
name: ${CLUSTER_NAME}-control-plane
182143
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
183144
version: ${KUBERNETES_VERSION}
184145
---
185-
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
146+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
186147
kind: OpenStackCluster
187148
metadata:
188149
name: ${CLUSTER_NAME}
@@ -197,7 +158,7 @@ spec:
197158
managedSecurityGroups: true
198159
nodeCidr: 10.6.0.0/24
199160
---
200-
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
161+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
201162
kind: OpenStackMachineTemplate
202163
metadata:
203164
name: ${CLUSTER_NAME}-control-plane
@@ -212,7 +173,7 @@ spec:
212173
image: ${OPENSTACK_FLATCAR_IMAGE_NAME}
213174
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
214175
---
215-
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
176+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
216177
kind: OpenStackMachineTemplate
217178
metadata:
218179
name: ${CLUSTER_NAME}-md-0

test/e2e/data/kustomize/external-cloud-provider-flatcar/kustomization.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
22
resources:
3-
- ../../../../../kustomize/v1alpha6/flatcar
3+
- ../../../../../kustomize/v1alpha7/flatcar
4+
- ccm.yaml
5+
46
components:
57
- ../common-patches/cni
8+
- ../common-patches/ccm

test/e2e/shared/defaults.go

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,29 @@ import (
3030
)
3131

3232
const (
33-
DefaultSSHKeyPairName = "cluster-api-provider-openstack-sigs-k8s-io"
34-
KubeContext = "KUBE_CONTEXT"
35-
KubernetesVersion = "KUBERNETES_VERSION"
36-
CCMPath = "CCM"
37-
CCMResources = "CCM_RESOURCES"
38-
OpenStackCloudYAMLFile = "OPENSTACK_CLOUD_YAML_FILE"
39-
OpenStackCloud = "OPENSTACK_CLOUD"
40-
OpenStackCloudAdmin = "OPENSTACK_CLOUD_ADMIN"
41-
OpenStackFailureDomain = "OPENSTACK_FAILURE_DOMAIN"
42-
OpenStackFailureDomainAlt = "OPENSTACK_FAILURE_DOMAIN_ALT"
43-
OpenStackVolumeTypeAlt = "OPENSTACK_VOLUME_TYPE_ALT"
44-
OpenStackImageName = "OPENSTACK_IMAGE_NAME"
45-
OpenStackNodeMachineFlavor = "OPENSTACK_NODE_MACHINE_FLAVOR"
46-
SSHUserMachine = "SSH_USER_MACHINE"
47-
FlavorDefault = "ci-artifacts"
48-
FlavorWithoutLB = "without-lb-ci-artifacts"
49-
FlavorMultiNetwork = "multi-network-ci-artifacts"
50-
FlavorMultiAZ = "multi-az-ci-artifacts"
51-
FlavorV1alpha5 = "v1alpha5-ci-artifacts"
52-
FlavorV1alpha6 = "v1alpha6-ci-artifacts"
53-
FlavorMDRemediation = "md-remediation-ci-artifacts"
54-
FlavorKCPRemediation = "kcp-remediation-ci-artifacts"
55-
FlavorFlatcar = "flatcar"
56-
FlavorExternalCloudProviderFlatcar = "external-cloud-provider-flatcar"
33+
DefaultSSHKeyPairName = "cluster-api-provider-openstack-sigs-k8s-io"
34+
KubeContext = "KUBE_CONTEXT"
35+
KubernetesVersion = "KUBERNETES_VERSION"
36+
CCMPath = "CCM"
37+
CCMResources = "CCM_RESOURCES"
38+
OpenStackCloudYAMLFile = "OPENSTACK_CLOUD_YAML_FILE"
39+
OpenStackCloud = "OPENSTACK_CLOUD"
40+
OpenStackCloudAdmin = "OPENSTACK_CLOUD_ADMIN"
41+
OpenStackFailureDomain = "OPENSTACK_FAILURE_DOMAIN"
42+
OpenStackFailureDomainAlt = "OPENSTACK_FAILURE_DOMAIN_ALT"
43+
OpenStackVolumeTypeAlt = "OPENSTACK_VOLUME_TYPE_ALT"
44+
OpenStackImageName = "OPENSTACK_IMAGE_NAME"
45+
OpenStackNodeMachineFlavor = "OPENSTACK_NODE_MACHINE_FLAVOR"
46+
SSHUserMachine = "SSH_USER_MACHINE"
47+
FlavorDefault = "ci-artifacts"
48+
FlavorWithoutLB = "without-lb-ci-artifacts"
49+
FlavorMultiNetwork = "multi-network-ci-artifacts"
50+
FlavorMultiAZ = "multi-az-ci-artifacts"
51+
FlavorV1alpha5 = "v1alpha5-ci-artifacts"
52+
FlavorV1alpha6 = "v1alpha6-ci-artifacts"
53+
FlavorMDRemediation = "md-remediation-ci-artifacts"
54+
FlavorKCPRemediation = "kcp-remediation-ci-artifacts"
55+
FlavorFlatcar = "flatcar"
5756
)
5857

5958
// DefaultScheme returns the default scheme to use for testing.

test/e2e/suites/e2e/e2e_test.go

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -184,35 +184,6 @@ var _ = Describe("e2e tests [PR-Blocking]", func() {
184184
})
185185
Expect(workerMachines).To(HaveLen(1))
186186
Expect(controlPlaneMachines).To(HaveLen(3))
187-
})
188-
})
189-
190-
Describe("Workload cluster (external cloud provider with Flatcar)", func() {
191-
It("should be creatable and deletable", func() {
192-
// Flatcar default user is "core"
193-
shared.SetEnvVar(shared.SSHUserMachine, "core", false)
194-
195-
shared.Logf("Creating a cluster")
196-
clusterName := fmt.Sprintf("cluster-%s", namespace.Name)
197-
configCluster := defaultConfigCluster(clusterName, namespace.Name)
198-
configCluster.ControlPlaneMachineCount = pointer.Int64(1)
199-
configCluster.WorkerMachineCount = pointer.Int64(1)
200-
configCluster.Flavor = shared.FlavorExternalCloudProviderFlatcar
201-
md := createCluster(ctx, configCluster)
202-
203-
workerMachines := framework.GetMachinesByMachineDeployments(ctx, framework.GetMachinesByMachineDeploymentsInput{
204-
Lister: e2eCtx.Environment.BootstrapClusterProxy.GetClient(),
205-
ClusterName: clusterName,
206-
Namespace: namespace.Name,
207-
MachineDeployment: *md[0],
208-
})
209-
controlPlaneMachines := framework.GetControlPlaneMachinesByCluster(ctx, framework.GetControlPlaneMachinesByClusterInput{
210-
Lister: e2eCtx.Environment.BootstrapClusterProxy.GetClient(),
211-
ClusterName: clusterName,
212-
Namespace: namespace.Name,
213-
})
214-
Expect(workerMachines).To(HaveLen(1))
215-
Expect(controlPlaneMachines).To(HaveLen(1))
216187

217188
shared.Logf("Waiting for worker nodes to be in Running phase")
218189
statusChecks := []framework.MachineStatusCheck{framework.MachinePhaseCheck(string(clusterv1.MachinePhaseRunning))}
@@ -227,7 +198,7 @@ var _ = Describe("e2e tests [PR-Blocking]", func() {
227198

228199
waitForDaemonSetRunning(ctx, workloadCluster.GetClient(), "kube-system", "openstack-cloud-controller-manager")
229200

230-
waitForNodesReadyWithoutCCMTaint(ctx, workloadCluster.GetClient(), 2)
201+
waitForNodesReadyWithoutCCMTaint(ctx, workloadCluster.GetClient(), 4)
231202
})
232203
})
233204

0 commit comments

Comments
 (0)