Skip to content

Commit 5445475

Browse files
committed
Add the cluster templates back
These templates are now generated from kustomize, but can still be useful to have in the repo. For example, there are links pointing to them. This also adds a test to make sure that the repo is clean after running make generate and make template so we don't miss any changes.
1 parent 18226ed commit 5445475

File tree

5 files changed

+517
-2
lines changed

5 files changed

+517
-2
lines changed

scripts/ci-test.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222
# shellcheck source=../hack/ensure-go.sh
2323
source "${REPO_ROOT}/hack/ensure-go.sh"
2424

25-
cd "${REPO_ROOT}" && make generate lint verify test
25+
cd "${REPO_ROOT}" && make generate templates lint verify test
26+
27+
# Fail if the repo is dirty after generate/templates
28+
if [[ -n $(git status --short) ]]; then
29+
echo "There are modified and/or untracked files."
30+
echo "Did you remember to run 'make generate' and/or 'make templates'"
31+
echo "$(git status)"
32+
fi

templates/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
apiVersion: v1
2+
data:
3+
cacert: ${OPENSTACK_CLOUD_CACERT_B64}
4+
clouds.yaml: ${OPENSTACK_CLOUD_YAML_B64}
5+
kind: Secret
6+
metadata:
7+
labels:
8+
clusterctl.cluster.x-k8s.io/move: "true"
9+
name: ${CLUSTER_NAME}-cloud-config
10+
---
11+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
12+
kind: KubeadmConfigTemplate
13+
metadata:
14+
name: ${CLUSTER_NAME}-md-0
15+
spec:
16+
template:
17+
spec:
18+
joinConfiguration:
19+
nodeRegistration:
20+
kubeletExtraArgs:
21+
cloud-provider: external
22+
name: '{{ local_hostname }}'
23+
---
24+
apiVersion: cluster.x-k8s.io/v1beta1
25+
kind: Cluster
26+
metadata:
27+
name: ${CLUSTER_NAME}
28+
spec:
29+
clusterNetwork:
30+
pods:
31+
cidrBlocks:
32+
- 192.168.0.0/16
33+
serviceDomain: cluster.local
34+
controlPlaneRef:
35+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
36+
kind: KubeadmControlPlane
37+
name: ${CLUSTER_NAME}-control-plane
38+
infrastructureRef:
39+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
40+
kind: OpenStackCluster
41+
name: ${CLUSTER_NAME}
42+
---
43+
apiVersion: cluster.x-k8s.io/v1beta1
44+
kind: MachineDeployment
45+
metadata:
46+
name: ${CLUSTER_NAME}-md-0
47+
spec:
48+
clusterName: ${CLUSTER_NAME}
49+
replicas: ${WORKER_MACHINE_COUNT}
50+
selector:
51+
matchLabels: null
52+
template:
53+
spec:
54+
bootstrap:
55+
configRef:
56+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
57+
kind: KubeadmConfigTemplate
58+
name: ${CLUSTER_NAME}-md-0
59+
clusterName: ${CLUSTER_NAME}
60+
failureDomain: ${OPENSTACK_FAILURE_DOMAIN}
61+
infrastructureRef:
62+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
63+
kind: OpenStackMachineTemplate
64+
name: ${CLUSTER_NAME}-md-0
65+
version: ${KUBERNETES_VERSION}
66+
---
67+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
68+
kind: KubeadmControlPlane
69+
metadata:
70+
name: ${CLUSTER_NAME}-control-plane
71+
spec:
72+
kubeadmConfigSpec:
73+
clusterConfiguration:
74+
apiServer:
75+
extraArgs:
76+
cloud-provider: external
77+
controllerManager:
78+
extraArgs:
79+
cloud-provider: external
80+
initConfiguration:
81+
nodeRegistration:
82+
kubeletExtraArgs:
83+
cloud-provider: external
84+
name: '{{ local_hostname }}'
85+
joinConfiguration:
86+
nodeRegistration:
87+
kubeletExtraArgs:
88+
cloud-provider: external
89+
name: '{{ local_hostname }}'
90+
machineTemplate:
91+
infrastructureRef:
92+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
93+
kind: OpenStackMachineTemplate
94+
name: ${CLUSTER_NAME}-control-plane
95+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
96+
version: ${KUBERNETES_VERSION}
97+
---
98+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
99+
kind: OpenStackCluster
100+
metadata:
101+
name: ${CLUSTER_NAME}
102+
spec:
103+
apiServerLoadBalancer:
104+
enabled: true
105+
cloudName: ${OPENSTACK_CLOUD}
106+
dnsNameservers:
107+
- ${OPENSTACK_DNS_NAMESERVERS}
108+
externalNetworkId: ${OPENSTACK_EXTERNAL_NETWORK_ID}
109+
identityRef:
110+
kind: Secret
111+
name: ${CLUSTER_NAME}-cloud-config
112+
managedSecurityGroups: true
113+
nodeCidr: 10.6.0.0/24
114+
---
115+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
116+
kind: OpenStackMachineTemplate
117+
metadata:
118+
name: ${CLUSTER_NAME}-control-plane
119+
spec:
120+
template:
121+
spec:
122+
cloudName: ${OPENSTACK_CLOUD}
123+
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR}
124+
identityRef:
125+
kind: Secret
126+
name: ${CLUSTER_NAME}-cloud-config
127+
image: ${OPENSTACK_IMAGE_NAME}
128+
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
129+
---
130+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
131+
kind: OpenStackMachineTemplate
132+
metadata:
133+
name: ${CLUSTER_NAME}-md-0
134+
spec:
135+
template:
136+
spec:
137+
cloudName: ${OPENSTACK_CLOUD}
138+
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR}
139+
identityRef:
140+
kind: Secret
141+
name: ${CLUSTER_NAME}-cloud-config
142+
image: ${OPENSTACK_IMAGE_NAME}
143+
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
apiVersion: v1
2+
data:
3+
cacert: ${OPENSTACK_CLOUD_CACERT_B64}
4+
clouds.yaml: ${OPENSTACK_CLOUD_YAML_B64}
5+
kind: Secret
6+
metadata:
7+
labels:
8+
clusterctl.cluster.x-k8s.io/move: "true"
9+
name: ${CLUSTER_NAME}-cloud-config
10+
---
11+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
12+
kind: KubeadmConfigTemplate
13+
metadata:
14+
name: ${CLUSTER_NAME}-md-0
15+
spec:
16+
template:
17+
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"
29+
joinConfiguration:
30+
nodeRegistration:
31+
kubeletExtraArgs:
32+
cloud-config: /etc/kubernetes/cloud.conf
33+
cloud-provider: openstack
34+
name: '{{ local_hostname }}'
35+
---
36+
apiVersion: cluster.x-k8s.io/v1beta1
37+
kind: Cluster
38+
metadata:
39+
name: ${CLUSTER_NAME}
40+
spec:
41+
clusterNetwork:
42+
pods:
43+
cidrBlocks:
44+
- 192.168.0.0/16
45+
serviceDomain: cluster.local
46+
controlPlaneRef:
47+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
48+
kind: KubeadmControlPlane
49+
name: ${CLUSTER_NAME}-control-plane
50+
infrastructureRef:
51+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
52+
kind: OpenStackCluster
53+
name: ${CLUSTER_NAME}
54+
---
55+
apiVersion: cluster.x-k8s.io/v1beta1
56+
kind: MachineDeployment
57+
metadata:
58+
name: ${CLUSTER_NAME}-md-0
59+
spec:
60+
clusterName: ${CLUSTER_NAME}
61+
replicas: ${WORKER_MACHINE_COUNT}
62+
selector:
63+
matchLabels: null
64+
template:
65+
spec:
66+
bootstrap:
67+
configRef:
68+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
69+
kind: KubeadmConfigTemplate
70+
name: ${CLUSTER_NAME}-md-0
71+
clusterName: ${CLUSTER_NAME}
72+
failureDomain: ${OPENSTACK_FAILURE_DOMAIN}
73+
infrastructureRef:
74+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
75+
kind: OpenStackMachineTemplate
76+
name: ${CLUSTER_NAME}-md-0
77+
version: ${KUBERNETES_VERSION}
78+
---
79+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
80+
kind: KubeadmControlPlane
81+
metadata:
82+
name: ${CLUSTER_NAME}-control-plane
83+
spec:
84+
kubeadmConfigSpec:
85+
clusterConfiguration:
86+
apiServer:
87+
extraArgs:
88+
cloud-config: /etc/kubernetes/cloud.conf
89+
cloud-provider: openstack
90+
extraVolumes:
91+
- hostPath: /etc/kubernetes/cloud.conf
92+
mountPath: /etc/kubernetes/cloud.conf
93+
name: cloud
94+
readOnly: true
95+
controllerManager:
96+
extraArgs:
97+
cloud-config: /etc/kubernetes/cloud.conf
98+
cloud-provider: openstack
99+
extraVolumes:
100+
- hostPath: /etc/kubernetes/cloud.conf
101+
mountPath: /etc/kubernetes/cloud.conf
102+
name: cloud
103+
readOnly: true
104+
- hostPath: /etc/certs/cacert
105+
mountPath: /etc/certs/cacert
106+
name: cacerts
107+
readOnly: true
108+
files:
109+
- content: ${OPENSTACK_CLOUD_PROVIDER_CONF_B64}
110+
encoding: base64
111+
owner: root
112+
path: /etc/kubernetes/cloud.conf
113+
permissions: "0600"
114+
- content: ${OPENSTACK_CLOUD_CACERT_B64}
115+
encoding: base64
116+
owner: root
117+
path: /etc/certs/cacert
118+
permissions: "0600"
119+
initConfiguration:
120+
nodeRegistration:
121+
kubeletExtraArgs:
122+
cloud-config: /etc/kubernetes/cloud.conf
123+
cloud-provider: openstack
124+
name: '{{ local_hostname }}'
125+
joinConfiguration:
126+
nodeRegistration:
127+
kubeletExtraArgs:
128+
cloud-config: /etc/kubernetes/cloud.conf
129+
cloud-provider: openstack
130+
name: '{{ local_hostname }}'
131+
machineTemplate:
132+
infrastructureRef:
133+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
134+
kind: OpenStackMachineTemplate
135+
name: ${CLUSTER_NAME}-control-plane
136+
replicas: 1
137+
version: ${KUBERNETES_VERSION}
138+
---
139+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
140+
kind: OpenStackCluster
141+
metadata:
142+
name: ${CLUSTER_NAME}
143+
spec:
144+
cloudName: ${OPENSTACK_CLOUD}
145+
dnsNameservers:
146+
- ${OPENSTACK_DNS_NAMESERVERS}
147+
externalNetworkId: ${OPENSTACK_EXTERNAL_NETWORK_ID}
148+
identityRef:
149+
kind: Secret
150+
name: ${CLUSTER_NAME}-cloud-config
151+
managedSecurityGroups: true
152+
nodeCidr: 10.6.0.0/24
153+
---
154+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
155+
kind: OpenStackMachineTemplate
156+
metadata:
157+
name: ${CLUSTER_NAME}-control-plane
158+
spec:
159+
template:
160+
spec:
161+
cloudName: ${OPENSTACK_CLOUD}
162+
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR}
163+
identityRef:
164+
kind: Secret
165+
name: ${CLUSTER_NAME}-cloud-config
166+
image: ${OPENSTACK_IMAGE_NAME}
167+
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
168+
---
169+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha6
170+
kind: OpenStackMachineTemplate
171+
metadata:
172+
name: ${CLUSTER_NAME}-md-0
173+
spec:
174+
template:
175+
spec:
176+
cloudName: ${OPENSTACK_CLOUD}
177+
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR}
178+
identityRef:
179+
kind: Secret
180+
name: ${CLUSTER_NAME}-cloud-config
181+
image: ${OPENSTACK_IMAGE_NAME}
182+
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}

0 commit comments

Comments
 (0)