Skip to content

Commit d11aacb

Browse files
committed
Add private-network template
1 parent 1146727 commit d11aacb

File tree

2 files changed

+149
-3
lines changed

2 files changed

+149
-3
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
apiVersion: cluster.x-k8s.io/v1beta1
2+
kind: Cluster
3+
metadata:
4+
name: ${CLUSTER_NAME}
5+
spec:
6+
clusterNetwork:
7+
pods:
8+
cidrBlocks:
9+
- 10.244.0.0/16
10+
controlPlaneRef:
11+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
12+
kind: KubeadmControlPlane
13+
name: ${CLUSTER_NAME}-control-plane
14+
infrastructureRef:
15+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
16+
kind: ScalewayCluster
17+
name: ${CLUSTER_NAME}
18+
---
19+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
20+
kind: KubeadmControlPlane
21+
metadata:
22+
name: ${CLUSTER_NAME}-control-plane
23+
spec:
24+
kubeadmConfigSpec:
25+
initConfiguration:
26+
localAPIEndpoint:
27+
advertiseAddress: "[[[ .NodeIP ]]]"
28+
nodeRegistration:
29+
kubeletExtraArgs:
30+
provider-id: "scaleway://instance/{{ ds.meta_data.zone }}/{{ ds.meta_data.id }}"
31+
node-ip: "[[[ .NodeIP ]]]"
32+
cloud-provider: external
33+
name: "{{ ds.meta_data.hostname }}"
34+
joinConfiguration:
35+
controlPlane:
36+
localAPIEndpoint:
37+
advertiseAddress: "[[[ .NodeIP ]]]"
38+
nodeRegistration:
39+
kubeletExtraArgs:
40+
provider-id: "scaleway://instance/{{ ds.meta_data.zone }}/{{ ds.meta_data.id }}"
41+
node-ip: "[[[ .NodeIP ]]]"
42+
cloud-provider: external
43+
name: "{{ ds.meta_data.hostname }}"
44+
machineTemplate:
45+
infrastructureRef:
46+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
47+
kind: ScalewayMachineTemplate
48+
name: ${CLUSTER_NAME}-control-plane
49+
replicas: ${CONTROL_PLANE_MACHINE_COUNT:=1}
50+
version: ${KUBERNETES_VERSION}
51+
---
52+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
53+
kind: ScalewayCluster
54+
metadata:
55+
name: ${CLUSTER_NAME}
56+
namespace: default
57+
spec:
58+
projectID: ${SCW_PROJECT_ID}
59+
region: ${SCW_REGION}
60+
scalewaySecretName: ${CLUSTER_NAME}
61+
failureDomains: ${CONTROL_PLANE_FAILURE_DOMAINS:=[${SCW_REGION}-1]}
62+
network:
63+
privateNetwork:
64+
enabled: true
65+
id: ${PRIVATE_NETWORK_ID:=null}
66+
vpcID: ${VPC_ID:=null}
67+
controlPlaneLoadBalancer:
68+
private: ${CONTROL_PLANE_LOAD_BALANCER_PRIVATE:=false}
69+
publicGateways: ${PUBLIC_GATEWAYS:=[]}
70+
---
71+
apiVersion: v1
72+
kind: Secret
73+
metadata:
74+
name: ${CLUSTER_NAME}
75+
type: Opaque
76+
stringData:
77+
SCW_ACCESS_KEY: ${SCW_ACCESS_KEY}
78+
SCW_SECRET_KEY: ${SCW_SECRET_KEY}
79+
---
80+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
81+
kind: ScalewayMachineTemplate
82+
metadata:
83+
name: ${CLUSTER_NAME}-control-plane
84+
spec:
85+
template:
86+
spec:
87+
image:
88+
name: ${CONTROL_PLANE_MACHINE_IMAGE}
89+
commercialType: ${CONTROL_PLANE_MACHINE_COMMERCIAL_TYPE:=DEV1-S}
90+
rootVolume:
91+
type: ${CONTROL_PLANE_MACHINE_ROOT_VOLUME_TYPE:=block}
92+
publicNetwork:
93+
enableIPv4: ${CONTROL_PLANE_MACHINE_IPV4:=true}
94+
---
95+
apiVersion: cluster.x-k8s.io/v1beta1
96+
kind: MachineDeployment
97+
metadata:
98+
name: ${CLUSTER_NAME}-md-0
99+
spec:
100+
clusterName: ${CLUSTER_NAME}
101+
replicas: ${WORKER_MACHINE_COUNT:=2}
102+
selector:
103+
matchLabels: null
104+
template:
105+
spec:
106+
bootstrap:
107+
configRef:
108+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
109+
kind: KubeadmConfigTemplate
110+
name: ${CLUSTER_NAME}-md-0
111+
clusterName: ${CLUSTER_NAME}
112+
failureDomain: ${WORKER_FAILURE_DOMAIN:=${SCW_REGION}-1}
113+
infrastructureRef:
114+
name: ${CLUSTER_NAME}-md-0
115+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
116+
kind: ScalewayMachineTemplate
117+
version: ${KUBERNETES_VERSION}
118+
---
119+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
120+
kind: KubeadmConfigTemplate
121+
metadata:
122+
name: ${CLUSTER_NAME}-md-0
123+
spec:
124+
template:
125+
spec:
126+
joinConfiguration:
127+
nodeRegistration:
128+
kubeletExtraArgs:
129+
provider-id: "scaleway://instance/{{ ds.meta_data.zone }}/{{ ds.meta_data.id }}"
130+
node-ip: "[[[ .NodeIP ]]]"
131+
cloud-provider: external
132+
name: "{{ ds.meta_data.hostname }}"
133+
---
134+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
135+
kind: ScalewayMachineTemplate
136+
metadata:
137+
name: ${CLUSTER_NAME}-md-0
138+
spec:
139+
template:
140+
spec:
141+
image:
142+
name: ${WORKER_MACHINE_IMAGE}
143+
commercialType: ${WORKER_MACHINE_COMMERCIAL_TYPE:=DEV1-S}
144+
rootVolume:
145+
type: ${WORKER_MACHINE_ROOT_VOLUME_TYPE:=block}
146+
publicNetwork:
147+
enableIPv4: ${WORKER_MACHINE_IPV4:=true}

templates/cluster-template.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ spec:
5151
projectID: ${SCW_PROJECT_ID}
5252
region: ${SCW_REGION}
5353
scalewaySecretName: ${CLUSTER_NAME}
54-
failureDomains:
55-
- ${SCW_REGION}-1
54+
failureDomains: ${CONTROL_PLANE_FAILURE_DOMAINS:=[${SCW_REGION}-1]}
5655
---
5756
apiVersion: v1
5857
kind: Secret
@@ -95,7 +94,7 @@ spec:
9594
kind: KubeadmConfigTemplate
9695
name: ${CLUSTER_NAME}-md-0
9796
clusterName: ${CLUSTER_NAME}
98-
failureDomain: ${SCW_REGION}-1
97+
failureDomain: ${WORKER_FAILURE_DOMAIN:=${SCW_REGION}-1}
9998
infrastructureRef:
10099
name: ${CLUSTER_NAME}-md-0
101100
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1

0 commit comments

Comments
 (0)