Skip to content

Commit 73243b5

Browse files
Added template with multuple networks configuration
1 parent 5fe0666 commit 73243b5

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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+
---
40+
kind: KubeadmControlPlane
41+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
42+
metadata:
43+
name: "${CLUSTER_NAME}-control-plane"
44+
spec:
45+
kubeadmConfigSpec:
46+
initConfiguration:
47+
nodeRegistration:
48+
name: '{{ local_hostname }}'
49+
kubeletExtraArgs:
50+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
51+
joinConfiguration:
52+
nodeRegistration:
53+
name: '{{ local_hostname }}'
54+
kubeletExtraArgs:
55+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
56+
preKubeadmCommands:
57+
- swapoff -a
58+
machineTemplate:
59+
infrastructureRef:
60+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
61+
kind: CloudStackMachineTemplate
62+
name: "${CLUSTER_NAME}-control-plane"
63+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
64+
version: ${KUBERNETES_VERSION}
65+
---
66+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
67+
kind: CloudStackMachineTemplate
68+
metadata:
69+
name: ${CLUSTER_NAME}-control-plane
70+
spec:
71+
template:
72+
spec:
73+
sshKey: ${CLOUDSTACK_SSH_KEY_NAME}
74+
offering:
75+
name: ${CLOUDSTACK_CONTROL_PLANE_MACHINE_OFFERING}
76+
networks:
77+
- name: ${CLOUDSTACK_NETWORK_NAME} # default primary network and should match with failureDomains.zone.network.name
78+
ip: 10.1.1.21 # optional ip address in the network
79+
- name: # extra network, it can be network name or ID
80+
ip: 10.1.1.31 # optional ip address in the network
81+
- id: # extra network, it can be network name or ID
82+
template:
83+
name: ${CLOUDSTACK_TEMPLATE_NAME}
84+
---
85+
apiVersion: cluster.x-k8s.io/v1beta1
86+
kind: MachineDeployment
87+
metadata:
88+
name: "${CLUSTER_NAME}-md-0"
89+
spec:
90+
clusterName: "${CLUSTER_NAME}"
91+
replicas: ${WORKER_MACHINE_COUNT}
92+
selector:
93+
matchLabels: null
94+
template:
95+
spec:
96+
clusterName: "${CLUSTER_NAME}"
97+
version: "${KUBERNETES_VERSION}"
98+
bootstrap:
99+
configRef:
100+
name: "${CLUSTER_NAME}-md-0"
101+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
102+
kind: KubeadmConfigTemplate
103+
infrastructureRef:
104+
name: "${CLUSTER_NAME}-md-0"
105+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
106+
kind: CloudStackMachineTemplate
107+
---
108+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta3
109+
kind: CloudStackMachineTemplate
110+
metadata:
111+
name: ${CLUSTER_NAME}-md-0
112+
spec:
113+
template:
114+
spec:
115+
sshKey: ${CLOUDSTACK_SSH_KEY_NAME}
116+
offering:
117+
name: ${CLOUDSTACK_WORKER_MACHINE_OFFERING}
118+
template:
119+
name: ${CLOUDSTACK_TEMPLATE_NAME}
120+
networks:
121+
- name: ${CLOUDSTACK_NETWORK_NAME} # default primary network and should match with failureDomains.zone.network.name
122+
ip: 10.1.1.41 # optional ip address in the network
123+
- name: # extra network, it can be network name or ID
124+
ip: 10.1.1.51 # optional ip address in the network
125+
- id: # extra network, it can be network name or ID
126+
---
127+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
128+
kind: KubeadmConfigTemplate
129+
metadata:
130+
name: ${CLUSTER_NAME}-md-0
131+
spec:
132+
template:
133+
spec:
134+
joinConfiguration:
135+
nodeRegistration:
136+
name: '{{ local_hostname }}'
137+
kubeletExtraArgs:
138+
provider-id: "cloudstack:///'{{ ds.meta_data.instance_id }}'"
139+
preKubeadmCommands:
140+
- swapoff -a

0 commit comments

Comments
 (0)