Skip to content

Commit 7f6f26b

Browse files
authored
Merge pull request #2717 from Nordix/lentzi90/capi-v1beta2
✨ Switch to CAPI v1beta2 for manifests
2 parents a490db3 + e6d71d6 commit 7f6f26b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+681
-343
lines changed

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,11 @@ e2e-templates: $(addprefix $(E2E_NO_ARTIFACT_TEMPLATES_DIR)/, \
184184
cluster-template-without-lb.yaml \
185185
cluster-template.yaml \
186186
cluster-template-flatcar.yaml \
187-
cluster-template-k8s-upgrade.yaml \
187+
cluster-template-k8s-upgrade.yaml \
188188
cluster-template-flatcar-sysext.yaml \
189189
cluster-template-no-bastion.yaml \
190-
cluster-template-health-monitor.yaml)
190+
cluster-template-health-monitor.yaml \
191+
cluster-template-capi-v1beta1.yaml)
191192
# Currently no templates that require CI artifacts
192193
# $(addprefix $(E2E_TEMPLATES_DIR)/, add-templates-here.yaml) \
193194
@@ -486,7 +487,8 @@ templates: ## Generate cluster templates
486487
templates: templates/cluster-template.yaml \
487488
templates/cluster-template-without-lb.yaml \
488489
templates/cluster-template-flatcar.yaml \
489-
templates/cluster-template-flatcar-sysext.yaml
490+
templates/cluster-template-flatcar-sysext.yaml \
491+
templates/cluster-template-capi-v1beta1.yaml
490492

491493
templates/cluster-template.yaml: kustomize/v1beta1/default $(KUSTOMIZE) FORCE
492494
$(KUSTOMIZE) build "$<" > "$@"
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
apiVersion: cluster.x-k8s.io/v1beta1
2+
kind: Cluster
3+
metadata:
4+
name: ${CLUSTER_NAME}
5+
spec:
6+
clusterNetwork:
7+
pods:
8+
cidrBlocks: ["192.168.0.0/16"] # CIDR block used by Calico.
9+
serviceDomain: "cluster.local"
10+
infrastructureRef:
11+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
12+
kind: OpenStackCluster
13+
name: ${CLUSTER_NAME}
14+
controlPlaneRef:
15+
kind: KubeadmControlPlane
16+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
17+
name: ${CLUSTER_NAME}-control-plane
18+
---
19+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
20+
kind: OpenStackCluster
21+
metadata:
22+
name: ${CLUSTER_NAME}
23+
spec:
24+
identityRef:
25+
name: ${CLUSTER_NAME}-cloud-config
26+
cloudName: ${OPENSTACK_CLOUD}
27+
apiServerLoadBalancer:
28+
enabled: true
29+
managedSubnets:
30+
- cidr: 10.6.0.0/24
31+
dnsNameservers:
32+
- ${OPENSTACK_DNS_NAMESERVERS}
33+
managedSecurityGroups:
34+
allNodesSecurityGroupRules:
35+
- description: Created by cluster-api-provider-openstack - BGP (calico)
36+
direction: ingress
37+
etherType: IPv4
38+
name: BGP (Calico)
39+
portRangeMax: 179
40+
portRangeMin: 179
41+
protocol: tcp
42+
remoteManagedGroups:
43+
- controlplane
44+
- worker
45+
- description: Created by cluster-api-provider-openstack - IP-in-IP (calico)
46+
direction: ingress
47+
etherType: IPv4
48+
name: IP-in-IP (calico)
49+
protocol: "4"
50+
remoteManagedGroups:
51+
- controlplane
52+
- worker
53+
externalNetwork:
54+
id: ${OPENSTACK_EXTERNAL_NETWORK_ID}
55+
---
56+
kind: KubeadmControlPlane
57+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
58+
metadata:
59+
name: "${CLUSTER_NAME}-control-plane"
60+
spec:
61+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
62+
machineTemplate:
63+
infrastructureRef:
64+
kind: OpenStackMachineTemplate
65+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
66+
name: "${CLUSTER_NAME}-control-plane"
67+
kubeadmConfigSpec:
68+
initConfiguration:
69+
nodeRegistration:
70+
name: '{{ local_hostname }}'
71+
kubeletExtraArgs:
72+
cloud-provider: external
73+
provider-id: "openstack:///'{{ instance_id }}'"
74+
clusterConfiguration:
75+
controllerManager:
76+
extraArgs:
77+
cloud-provider: external
78+
joinConfiguration:
79+
nodeRegistration:
80+
name: '{{ local_hostname }}'
81+
kubeletExtraArgs:
82+
cloud-provider: external
83+
provider-id: "openstack:///'{{ instance_id }}'"
84+
files: []
85+
version: "${KUBERNETES_VERSION}"
86+
---
87+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
88+
kind: OpenStackMachineTemplate
89+
metadata:
90+
name: ${CLUSTER_NAME}-control-plane
91+
spec:
92+
template:
93+
spec:
94+
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR}
95+
image:
96+
filter:
97+
name: ${OPENSTACK_IMAGE_NAME}
98+
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
99+
---
100+
apiVersion: cluster.x-k8s.io/v1beta1
101+
kind: MachineDeployment
102+
metadata:
103+
name: "${CLUSTER_NAME}-md-0"
104+
spec:
105+
clusterName: "${CLUSTER_NAME}"
106+
replicas: ${WORKER_MACHINE_COUNT}
107+
selector:
108+
matchLabels:
109+
template:
110+
spec:
111+
clusterName: "${CLUSTER_NAME}"
112+
version: "${KUBERNETES_VERSION}"
113+
failureDomain: ${OPENSTACK_FAILURE_DOMAIN}
114+
bootstrap:
115+
configRef:
116+
name: "${CLUSTER_NAME}-md-0"
117+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
118+
kind: KubeadmConfigTemplate
119+
infrastructureRef:
120+
name: "${CLUSTER_NAME}-md-0"
121+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
122+
kind: OpenStackMachineTemplate
123+
---
124+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
125+
kind: OpenStackMachineTemplate
126+
metadata:
127+
name: ${CLUSTER_NAME}-md-0
128+
spec:
129+
template:
130+
spec:
131+
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR}
132+
image:
133+
filter:
134+
name: ${OPENSTACK_IMAGE_NAME}
135+
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
136+
---
137+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
138+
kind: KubeadmConfigTemplate
139+
metadata:
140+
name: ${CLUSTER_NAME}-md-0
141+
spec:
142+
template:
143+
spec:
144+
files: []
145+
joinConfiguration:
146+
nodeRegistration:
147+
name: '{{ local_hostname }}'
148+
kubeletExtraArgs:
149+
cloud-provider: external
150+
provider-id: "openstack:///'{{ instance_id }}'"
151+
---
152+
apiVersion: v1
153+
kind: Secret
154+
metadata:
155+
name: ${CLUSTER_NAME}-cloud-config
156+
labels:
157+
clusterctl.cluster.x-k8s.io/move: "true"
158+
data:
159+
clouds.yaml: ${OPENSTACK_CLOUD_YAML_B64}
160+
cacert: ${OPENSTACK_CLOUD_CACERT_B64}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- cluster-template.yaml

kustomize/v1beta1/default/cluster-template.yaml

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
---
2-
apiVersion: cluster.x-k8s.io/v1beta1
1+
apiVersion: cluster.x-k8s.io/v1beta2
32
kind: Cluster
43
metadata:
54
name: ${CLUSTER_NAME}
@@ -9,12 +8,12 @@ spec:
98
cidrBlocks: ["192.168.0.0/16"] # CIDR block used by Calico.
109
serviceDomain: "cluster.local"
1110
infrastructureRef:
12-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
11+
apiGroup: infrastructure.cluster.x-k8s.io
1312
kind: OpenStackCluster
1413
name: ${CLUSTER_NAME}
1514
controlPlaneRef:
15+
apiGroup: controlplane.cluster.x-k8s.io
1616
kind: KubeadmControlPlane
17-
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
1817
name: ${CLUSTER_NAME}-control-plane
1918
---
2019
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
@@ -54,35 +53,40 @@ spec:
5453
externalNetwork:
5554
id: ${OPENSTACK_EXTERNAL_NETWORK_ID}
5655
---
56+
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
5757
kind: KubeadmControlPlane
58-
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
5958
metadata:
6059
name: "${CLUSTER_NAME}-control-plane"
6160
spec:
6261
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
6362
machineTemplate:
64-
infrastructureRef:
65-
kind: OpenStackMachineTemplate
66-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
67-
name: "${CLUSTER_NAME}-control-plane"
63+
spec:
64+
infrastructureRef:
65+
kind: OpenStackMachineTemplate
66+
apiGroup: infrastructure.cluster.x-k8s.io
67+
name: "${CLUSTER_NAME}-control-plane"
6868
kubeadmConfigSpec:
6969
initConfiguration:
7070
nodeRegistration:
7171
name: '{{ local_hostname }}'
7272
kubeletExtraArgs:
73-
cloud-provider: external
74-
provider-id: "openstack:///'{{ instance_id }}'"
73+
- name: cloud-provider
74+
value: external
75+
- name: provider-id
76+
value: "openstack:///'{{ instance_id }}'"
7577
clusterConfiguration:
7678
controllerManager:
7779
extraArgs:
78-
cloud-provider: external
80+
- name: cloud-provider
81+
value: external
7982
joinConfiguration:
8083
nodeRegistration:
8184
name: '{{ local_hostname }}'
8285
kubeletExtraArgs:
83-
cloud-provider: external
84-
provider-id: "openstack:///'{{ instance_id }}'"
85-
files: []
86+
- name: cloud-provider
87+
value: external
88+
- name: provider-id
89+
value: "openstack:///'{{ instance_id }}'"
8690
version: "${KUBERNETES_VERSION}"
8791
---
8892
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
@@ -98,7 +102,7 @@ spec:
98102
name: ${OPENSTACK_IMAGE_NAME}
99103
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
100104
---
101-
apiVersion: cluster.x-k8s.io/v1beta1
105+
apiVersion: cluster.x-k8s.io/v1beta2
102106
kind: MachineDeployment
103107
metadata:
104108
name: "${CLUSTER_NAME}-md-0"
@@ -115,11 +119,11 @@ spec:
115119
bootstrap:
116120
configRef:
117121
name: "${CLUSTER_NAME}-md-0"
118-
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
122+
apiGroup: bootstrap.cluster.x-k8s.io
119123
kind: KubeadmConfigTemplate
120124
infrastructureRef:
121125
name: "${CLUSTER_NAME}-md-0"
122-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
126+
apiGroup: infrastructure.cluster.x-k8s.io
123127
kind: OpenStackMachineTemplate
124128
---
125129
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
@@ -135,20 +139,21 @@ spec:
135139
name: ${OPENSTACK_IMAGE_NAME}
136140
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
137141
---
138-
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
142+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
139143
kind: KubeadmConfigTemplate
140144
metadata:
141145
name: ${CLUSTER_NAME}-md-0
142146
spec:
143147
template:
144148
spec:
145-
files: []
146149
joinConfiguration:
147150
nodeRegistration:
148151
name: '{{ local_hostname }}'
149152
kubeletExtraArgs:
150-
cloud-provider: external
151-
provider-id: "openstack:///'{{ instance_id }}'"
153+
- name: cloud-provider
154+
value: external
155+
- name: provider-id
156+
value: "openstack:///'{{ instance_id }}'"
152157
---
153158
apiVersion: v1
154159
kind: Secret

kustomize/v1beta1/flatcar-sysext/patch-flatcar.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
32
kind: OpenStackCluster
43
metadata:
@@ -7,7 +6,7 @@ spec:
76
apiServerLoadBalancer:
87
$patch: delete
98
---
10-
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
9+
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
1110
kind: KubeadmControlPlane
1211
metadata:
1312
name: "${CLUSTER_NAME}-control-plane"
@@ -18,12 +17,18 @@ spec:
1817
nodeRegistration:
1918
name: $${COREOS_OPENSTACK_HOSTNAME}
2019
kubeletExtraArgs:
21-
provider-id: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
20+
- name: cloud-provider
21+
value: external
22+
- name: provider-id
23+
value: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
2224
initConfiguration:
2325
nodeRegistration:
2426
name: $${COREOS_OPENSTACK_HOSTNAME}
2527
kubeletExtraArgs:
26-
provider-id: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
28+
- name: cloud-provider
29+
value: external
30+
- name: provider-id
31+
value: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
2732
format: ignition
2833
ignition:
2934
containerLinuxConfig:
@@ -87,7 +92,7 @@ spec:
8792
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
8893
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml
8994
---
90-
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
95+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta2
9196
kind: KubeadmConfigTemplate
9297
metadata:
9398
name: ${CLUSTER_NAME}-md-0
@@ -98,7 +103,10 @@ spec:
98103
nodeRegistration:
99104
name: $${COREOS_OPENSTACK_HOSTNAME}
100105
kubeletExtraArgs:
101-
provider-id: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
106+
- name: cloud-provider
107+
value: external
108+
- name: provider-id
109+
value: openstack:///$${COREOS_OPENSTACK_INSTANCE_UUID}
102110
preKubeadmCommands:
103111
- export COREOS_OPENSTACK_HOSTNAME=$${COREOS_OPENSTACK_HOSTNAME%.*}
104112
- export COREOS_OPENSTACK_INSTANCE_UUID=$${COREOS_OPENSTACK_INSTANCE_UUID}

0 commit comments

Comments
 (0)