Skip to content

Commit 2a6b6de

Browse files
committed
Add cluster-template for existing network with VPC
1 parent bd2c865 commit 2a6b6de

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: Cluster
4+
metadata:
5+
name: ${CLUSTER_NAME}
6+
spec:
7+
clusterNetwork:
8+
pods:
9+
cidrBlocks:
10+
- 192.168.0.0/16
11+
serviceDomain: "cluster.local"
12+
infrastructureRef:
13+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
14+
kind: CloudStackCluster
15+
name: ${CLUSTER_NAME}
16+
controlPlaneRef:
17+
kind: KubeadmControlPlane
18+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
19+
name: ${CLUSTER_NAME}-control-plane
20+
---
21+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
22+
kind: CloudStackCluster
23+
metadata:
24+
name: ${CLUSTER_NAME}
25+
spec:
26+
syncWithACS: ${CLOUDSTACK_SYNC_WITH_ACS=false}
27+
controlPlaneEndpoint:
28+
host: ${CLUSTER_ENDPOINT_IP}
29+
port: ${CLUSTER_ENDPOINT_PORT=6443}
30+
failureDomains:
31+
- name: ${CLOUDSTACK_FD1_NAME=failure-domain-1}
32+
acsEndpoint:
33+
name: ${CLOUDSTACK_FD1_SECRET_NAME=cloudstack-credentials}
34+
namespace: ${CLOUDSTACK_FD1_SECRET_NAMESPACE=default}
35+
zone:
36+
name: ${CLOUDSTACK_ZONE_NAME}
37+
network:
38+
name: ${CLOUDSTACK_NETWORK_NAME}
39+
vpc:
40+
name: ${CLOUDSTACK_VPC_NAME}
41+
---
42+
kind: KubeadmControlPlane
43+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
44+
metadata:
45+
name: "${CLUSTER_NAME}-control-plane"
46+
spec:
47+
kubeadmConfigSpec:
48+
initConfiguration:
49+
nodeRegistration:
50+
name: '{{ local_hostname }}'
51+
kubeletExtraArgs:
52+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
53+
joinConfiguration:
54+
nodeRegistration:
55+
name: '{{ local_hostname }}'
56+
kubeletExtraArgs:
57+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
58+
preKubeadmCommands:
59+
- swapoff -a
60+
machineTemplate:
61+
infrastructureRef:
62+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
63+
kind: CloudStackMachineTemplate
64+
name: "${CLUSTER_NAME}-control-plane"
65+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
66+
version: ${KUBERNETES_VERSION}
67+
---
68+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
69+
kind: CloudStackMachineTemplate
70+
metadata:
71+
name: ${CLUSTER_NAME}-control-plane
72+
spec:
73+
template:
74+
spec:
75+
offering:
76+
name: ${CLOUDSTACK_CONTROL_PLANE_MACHINE_OFFERING}
77+
template:
78+
name: ${CLOUDSTACK_TEMPLATE_NAME}
79+
---
80+
apiVersion: cluster.x-k8s.io/v1beta1
81+
kind: MachineDeployment
82+
metadata:
83+
name: "${CLUSTER_NAME}-md-0"
84+
spec:
85+
clusterName: "${CLUSTER_NAME}"
86+
replicas: ${WORKER_MACHINE_COUNT}
87+
selector:
88+
matchLabels: null
89+
template:
90+
spec:
91+
clusterName: "${CLUSTER_NAME}"
92+
version: "${KUBERNETES_VERSION}"
93+
bootstrap:
94+
configRef:
95+
name: "${CLUSTER_NAME}-md-0"
96+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
97+
kind: KubeadmConfigTemplate
98+
infrastructureRef:
99+
name: "${CLUSTER_NAME}-md-0"
100+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
101+
kind: CloudStackMachineTemplate
102+
---
103+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
104+
kind: CloudStackMachineTemplate
105+
metadata:
106+
name: ${CLUSTER_NAME}-md-0
107+
spec:
108+
template:
109+
spec:
110+
offering:
111+
name: ${CLOUDSTACK_WORKER_MACHINE_OFFERING}
112+
template:
113+
name: ${CLOUDSTACK_TEMPLATE_NAME}
114+
---
115+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
116+
kind: KubeadmConfigTemplate
117+
metadata:
118+
name: ${CLUSTER_NAME}-md-0
119+
spec:
120+
template:
121+
spec:
122+
joinConfiguration:
123+
nodeRegistration:
124+
name: '{{ local_hostname }}'
125+
kubeletExtraArgs:
126+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
127+
preKubeadmCommands:
128+
- swapoff -a

0 commit comments

Comments
 (0)