Skip to content

Commit b2b2a3e

Browse files
authored
Merge pull request #1444 from tormath1/tormath1/flatcar
✨ templates: add flatcar template
2 parents 2547272 + c2637ea commit b2b2a3e

35 files changed

+979
-68
lines changed

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ test: $(SETUP_ENVTEST) ## Run tests
147147

148148
E2E_TEMPLATES_DIR=test/e2e/data/infrastructure-openstack
149149
E2E_KUSTOMIZE_DIR=test/e2e/data/kustomize
150+
# This directory holds the templates that do not require ci-artifacts script injection.
151+
E2E_NO_ARTIFACT_TEMPLATES_DIR=test/e2e/data/infrastructure-openstack-no-artifact
150152

151153
.PHONY: e2e-templates
152154
e2e-templates: ## Generate cluster templates for e2e tests
@@ -159,14 +161,20 @@ e2e-templates: $(addprefix $(E2E_TEMPLATES_DIR)/, \
159161
cluster-template-multi-az.yaml \
160162
cluster-template-multi-network.yaml \
161163
cluster-template-without-lb.yaml \
162-
cluster-template.yaml)
164+
cluster-template.yaml) \
165+
$(addprefix $(E2E_NO_ARTIFACT_TEMPLATES_DIR)/, \
166+
cluster-template-flatcar.yaml \
167+
cluster-template-external-cloud-provider-flatcar.yaml) \
163168

164169
$(E2E_TEMPLATES_DIR)/cluster-template.yaml: $(E2E_KUSTOMIZE_DIR)/with-tags $(KUSTOMIZE) FORCE
165170
$(KUSTOMIZE) build "$<" > "$@"
166171

167172
$(E2E_TEMPLATES_DIR)/cluster-template-%.yaml: $(E2E_KUSTOMIZE_DIR)/% $(KUSTOMIZE) FORCE
168173
$(KUSTOMIZE) build "$<" > "$@"
169174

175+
$(E2E_NO_ARTIFACT_TEMPLATES_DIR)/cluster-template-%.yaml: $(E2E_KUSTOMIZE_DIR)/% $(KUSTOMIZE) FORCE
176+
$(KUSTOMIZE) build "$<" > "$@"
177+
170178
e2e-prerequisites: $(GINKGO) e2e-templates e2e-image test-e2e-image-prerequisites ## Build all artifacts required by e2e tests
171179

172180
# Can be run manually, e.g. via:
@@ -417,7 +425,9 @@ release-notes: $(RELEASE_NOTES) ## Generate release notes
417425
templates: ## Generate cluster templates
418426
templates: templates/cluster-template.yaml \
419427
templates/cluster-template-without-lb.yaml \
420-
templates/cluster-template-external-cloud-provider.yaml
428+
templates/cluster-template-external-cloud-provider.yaml \
429+
templates/cluster-template-flatcar.yaml \
430+
templates/cluster-template-external-cloud-provider-flatcar.yaml \
421431

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

hack/ci/cloud-init/controller.yaml.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
# https://docs.openstack.org/glance/latest/admin/quotas.html
139139
/opt/stack/devstack/tools/upload_image.sh https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/cirros/2022-12-05/cirros-0.6.1-x86_64-disk.img
140140
/opt/stack/devstack/tools/upload_image.sh https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/ubuntu/2023-01-14/focal-server-cloudimg-amd64.img
141+
/opt/stack/devstack/tools/upload_image.sh https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/flatcar/flatcar-stable-3374.2.5-kube-v1.25.6.img
141142

142143
# Add the controller to its own host aggregate and availability zone
143144
aggregateid=$(openstack aggregate create --zone "${PRIMARY_AZ}" "${PRIMARY_AZ}" -f value -c id)
@@ -150,9 +151,9 @@
150151
openstack flavor delete m1.tiny
151152
openstack flavor create --ram 512 --disk 1 --vcpus 1 --public --id 1 m1.tiny --property hw_rng:allowed='True'
152153
openstack flavor delete m1.small
153-
openstack flavor create --ram 4192 --disk 10 --vcpus 2 --public --id 2 m1.small --property hw_rng:allowed='True'
154+
openstack flavor create --ram 4192 --disk 20 --vcpus 2 --public --id 2 m1.small --property hw_rng:allowed='True'
154155
openstack flavor delete m1.medium
155-
openstack flavor create --ram 6144 --disk 10 --vcpus 4 --public --id 3 m1.medium --property hw_rng:allowed='True'
156+
openstack flavor create --ram 6144 --disk 20 --vcpus 4 --public --id 3 m1.medium --property hw_rng:allowed='True'
156157

157158
# Adjust the CPU quota
158159
openstack quota set --cores 32 demo
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
resources:
2+
- ../default
3+
4+
patchesStrategicMerge:
5+
- patch-ccm.yaml
6+
- patch-flatcar.yaml
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
3+
kind: KubeadmControlPlane
4+
metadata:
5+
name: "${CLUSTER_NAME}-control-plane"
6+
spec:
7+
kubeadmConfigSpec:
8+
initConfiguration:
9+
nodeRegistration:
10+
kubeletExtraArgs:
11+
cloud-provider: external
12+
cloud-config:
13+
clusterConfiguration:
14+
apiServer:
15+
extraArgs:
16+
cloud-provider: external
17+
cloud-config:
18+
extraVolumes:
19+
controllerManager:
20+
extraArgs:
21+
cloud-provider: external
22+
cloud-config:
23+
extraVolumes:
24+
joinConfiguration:
25+
nodeRegistration:
26+
kubeletExtraArgs:
27+
cloud-provider: external
28+
cloud-config:
29+
files: []
30+
---
31+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
32+
kind: KubeadmConfigTemplate
33+
metadata:
34+
name: ${CLUSTER_NAME}-md-0
35+
spec:
36+
template:
37+
spec:
38+
files: []
39+
joinConfiguration:
40+
nodeRegistration:
41+
kubeletExtraArgs:
42+
cloud-provider: external
43+
cloud-config:
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/v1alpha6
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/v1alpha6
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/v1alpha6
91+
kind: OpenStackMachineTemplate
92+
metadata:
93+
name: ${CLUSTER_NAME}-control-plane
94+
spec:
95+
template:
96+
spec:
97+
image: ${OPENSTACK_FLATCAR_IMAGE_NAME}
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: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
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+
kubeletExtraArgs:
21+
cloud-config: /etc/kubernetes/cloud.conf
22+
cloud-provider: openstack
23+
initConfiguration:
24+
nodeRegistration:
25+
name: $${COREOS_OPENSTACK_HOSTNAME}
26+
kubeletExtraArgs:
27+
cloud-provider: openstack
28+
cloud-config: /etc/kubernetes/cloud.conf
29+
format: ignition
30+
ignition:
31+
containerLinuxConfig:
32+
additionalConfig: |
33+
systemd:
34+
units:
35+
36+
enabled: true
37+
- name: kubeadm.service
38+
enabled: true
39+
dropins:
40+
- name: 10-flatcar.conf
41+
contents: |
42+
[Unit]
43+
Requires=containerd.service coreos-metadata.service
44+
After=containerd.service coreos-metadata.service
45+
46+
[Service]
47+
EnvironmentFile=/run/metadata/flatcar
48+
preKubeadmCommands:
49+
- export COREOS_OPENSTACK_HOSTNAME=$${COREOS_OPENSTACK_HOSTNAME%.*}
50+
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
51+
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml
52+
---
53+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
54+
kind: KubeadmConfigTemplate
55+
metadata:
56+
name: ${CLUSTER_NAME}-md-0
57+
spec:
58+
template:
59+
spec:
60+
files:
61+
- content: ${OPENSTACK_CLOUD_PROVIDER_CONF_B64}
62+
encoding: base64
63+
owner: root
64+
path: /etc/kubernetes/cloud.conf
65+
permissions: "0600"
66+
- content: ${OPENSTACK_CLOUD_CACERT_B64}
67+
encoding: base64
68+
owner: root
69+
path: /etc/certs/cacert
70+
permissions: "0600"
71+
joinConfiguration:
72+
nodeRegistration:
73+
name: $${COREOS_OPENSTACK_HOSTNAME}
74+
kubeletExtraArgs:
75+
cloud-config: /etc/kubernetes/cloud.conf
76+
cloud-provider: openstack
77+
preKubeadmCommands:
78+
- export COREOS_OPENSTACK_HOSTNAME=$${COREOS_OPENSTACK_HOSTNAME%.*}
79+
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
80+
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml
81+
format: ignition
82+
ignition:
83+
containerLinuxConfig:
84+
additionalConfig: |
85+
systemd:
86+
units:
87+
88+
enabled: true
89+
- name: kubeadm.service
90+
enabled: true
91+
dropins:
92+
- name: 10-flatcar.conf
93+
contents: |
94+
[Unit]
95+
Requires=containerd.service coreos-metadata.service
96+
After=containerd.service coreos-metadata.service
97+
98+
[Service]
99+
EnvironmentFile=/run/metadata/flatcar
100+
---
101+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
102+
kind: OpenStackMachineTemplate
103+
metadata:
104+
name: ${CLUSTER_NAME}-md-0
105+
spec:
106+
template:
107+
spec:
108+
image: ${OPENSTACK_FLATCAR_IMAGE_NAME}
109+
---
110+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
111+
kind: OpenStackMachineTemplate
112+
metadata:
113+
name: ${CLUSTER_NAME}-control-plane
114+
spec:
115+
template:
116+
spec:
117+
image: ${OPENSTACK_FLATCAR_IMAGE_NAME}

0 commit comments

Comments
 (0)