Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 554dacd

Browse files
authored
Merge pull request #5 from d2iq-labs/nutanix-examples
feat: Add examples for Nutanix provider
2 parents b17718a + c1695ce commit 554dacd

File tree

15 files changed

+2083
-1
lines changed

15 files changed

+2083
-1
lines changed
Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
2+
kind: KubeadmConfigTemplate
3+
metadata:
4+
labels:
5+
cluster.x-k8s.io/provider: nutanix
6+
name: nutanix-quick-start-kcfg-0
7+
spec:
8+
template:
9+
spec:
10+
joinConfiguration:
11+
nodeRegistration:
12+
kubeletExtraArgs:
13+
cloud-provider: external
14+
eviction-hard: nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%,memory.available<100Mi,imagefs.inodesFree<10%
15+
tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
16+
postKubeadmCommands:
17+
- echo "after kubeadm call" > /var/log/postkubeadm.log
18+
preKubeadmCommands:
19+
- echo "before kubeadm call" > /var/log/prekubeadm.log
20+
- hostnamectl set-hostname "{{ ds.meta_data.hostname }}"
21+
verbosity: 10
22+
---
23+
apiVersion: cluster.x-k8s.io/v1beta1
24+
kind: ClusterClass
25+
metadata:
26+
labels:
27+
cluster.x-k8s.io/provider: nutanix
28+
name: nutanix-quick-start
29+
spec:
30+
controlPlane:
31+
machineHealthCheck:
32+
maxUnhealthy: 40%
33+
nodeStartupTimeout: 10m
34+
unhealthyConditions:
35+
- status: "False"
36+
timeout: 300s
37+
type: Ready
38+
- status: Unknown
39+
timeout: 300s
40+
type: Ready
41+
- status: "True"
42+
timeout: 300s
43+
type: MemoryPressure
44+
- status: "True"
45+
timeout: 300s
46+
type: DiskPressure
47+
- status: "True"
48+
timeout: 300s
49+
type: PIDPressure
50+
- status: "True"
51+
timeout: 300s
52+
type: NetworkUnavailable
53+
machineInfrastructure:
54+
ref:
55+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
56+
kind: NutanixMachineTemplate
57+
name: nutanix-quick-start-cp-nmt
58+
ref:
59+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
60+
kind: KubeadmControlPlaneTemplate
61+
name: nutanix-quick-start-kcpt
62+
infrastructure:
63+
ref:
64+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
65+
kind: NutanixClusterTemplate
66+
name: nutanix-quick-start-nct
67+
patches:
68+
- external:
69+
discoverVariablesExtension: nutanixclusterconfigvars.cluster-api-runtime-extensions-nutanix
70+
generateExtension: nutanixclusterconfigpatch.cluster-api-runtime-extensions-nutanix
71+
name: cluster-config
72+
- external:
73+
discoverVariablesExtension: nutanixworkerconfigvars.cluster-api-runtime-extensions-nutanix
74+
generateExtension: nutanixworkerconfigpatch.cluster-api-runtime-extensions-nutanix
75+
name: worker-config
76+
workers:
77+
machineDeployments:
78+
- class: nutanix-quick-start-worker
79+
machineHealthCheck:
80+
maxUnhealthy: 40%
81+
nodeStartupTimeout: 10m
82+
unhealthyConditions:
83+
- status: "False"
84+
timeout: 300s
85+
type: Ready
86+
- status: Unknown
87+
timeout: 300s
88+
type: Ready
89+
- status: "True"
90+
timeout: 300s
91+
type: MemoryPressure
92+
- status: "True"
93+
timeout: 300s
94+
type: DiskPressure
95+
- status: "True"
96+
timeout: 300s
97+
type: PIDPressure
98+
- status: "True"
99+
timeout: 300s
100+
type: NetworkUnavailable
101+
template:
102+
bootstrap:
103+
ref:
104+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
105+
kind: KubeadmConfigTemplate
106+
name: nutanix-quick-start-kcfg-0
107+
infrastructure:
108+
ref:
109+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
110+
kind: NutanixMachineTemplate
111+
name: nutanix-quick-start-md-nmt
112+
---
113+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
114+
kind: KubeadmControlPlaneTemplate
115+
metadata:
116+
labels:
117+
cluster.x-k8s.io/provider: nutanix
118+
name: nutanix-quick-start-kcpt
119+
spec:
120+
template:
121+
spec:
122+
kubeadmConfigSpec:
123+
clusterConfiguration:
124+
apiServer:
125+
certSANs:
126+
- localhost
127+
- 127.0.0.1
128+
- 0.0.0.0
129+
extraArgs:
130+
cloud-provider: external
131+
tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
132+
controllerManager:
133+
extraArgs:
134+
cloud-provider: external
135+
tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
136+
scheduler:
137+
extraArgs:
138+
tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
139+
files:
140+
- content: |
141+
apiVersion: v1
142+
kind: Pod
143+
metadata:
144+
name: kube-vip
145+
namespace: kube-system
146+
spec:
147+
containers:
148+
- name: kube-vip
149+
image: ghcr.io/kube-vip/kube-vip:v0.6.4
150+
imagePullPolicy: IfNotPresent
151+
args:
152+
- manager
153+
env:
154+
- name: vip_arp
155+
value: "true"
156+
- name: address
157+
value: "${CONTROL_PLANE_ENDPOINT_IP}"
158+
- name: port
159+
value: "${CONTROL_PLANE_ENDPOINT_PORT=6443}"
160+
- name: vip_cidr
161+
value: "32"
162+
- name: cp_enable
163+
value: "true"
164+
- name: cp_namespace
165+
value: kube-system
166+
- name: vip_ddns
167+
value: "false"
168+
- name: vip_leaderelection
169+
value: "true"
170+
- name: vip_leaseduration
171+
value: "15"
172+
- name: vip_renewdeadline
173+
value: "10"
174+
- name: vip_retryperiod
175+
value: "2"
176+
- name: svc_enable
177+
value: "${KUBEVIP_SVC_ENABLE=false}"
178+
- name: lb_enable
179+
value: "${KUBEVIP_LB_ENABLE=false}"
180+
- name: enableServicesElection
181+
value: "${KUBEVIP_SVC_ELECTION=false}"
182+
securityContext:
183+
capabilities:
184+
add:
185+
- NET_ADMIN
186+
- SYS_TIME
187+
- NET_RAW
188+
volumeMounts:
189+
- mountPath: /etc/kubernetes/admin.conf
190+
name: kubeconfig
191+
resources: {}
192+
hostNetwork: true
193+
hostAliases:
194+
- hostnames:
195+
- kubernetes
196+
ip: 127.0.0.1
197+
volumes:
198+
- name: kubeconfig
199+
hostPath:
200+
type: FileOrCreate
201+
path: /etc/kubernetes/admin.conf
202+
status: {}
203+
owner: root:root
204+
path: /etc/kubernetes/manifests/kube-vip.yaml
205+
initConfiguration:
206+
nodeRegistration:
207+
kubeletExtraArgs:
208+
cloud-provider: external
209+
eviction-hard: nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%,memory.available<100Mi,imagefs.inodesFree<10%
210+
tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
211+
joinConfiguration:
212+
nodeRegistration:
213+
kubeletExtraArgs:
214+
cloud-provider: external
215+
eviction-hard: nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%,memory.available<100Mi,imagefs.inodesFree<10%
216+
tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
217+
postKubeadmCommands:
218+
- echo export KUBECONFIG=/etc/kubernetes/admin.conf >> /root/.bashrc
219+
- |
220+
KUBERNETES_VERSION_NO_V=${KUBERNETES_VERSION#v}
221+
VERSION_TO_COMPARE=1.29.0
222+
if [ "$(printf '%s\n' "$KUBERNETES_VERSION_NO_V" "$VERSION_TO_COMPARE" | sort -V | head -n1)" != "$KUBERNETES_VERSION_NO_V" ]; then
223+
if [ -f /run/kubeadm/kubeadm.yaml ]; then
224+
sed -i 's#path: /etc/kubernetes/super-admin.conf#path: /etc/kubernetes/admin.conf#' /etc/kubernetes/manifests/kube-vip.yaml;
225+
fi
226+
fi
227+
- echo "after kubeadm call" > /var/log/postkubeadm.log
228+
preKubeadmCommands:
229+
- echo "before kubeadm call" > /var/log/prekubeadm.log
230+
- hostnamectl set-hostname "{{ ds.meta_data.hostname }}"
231+
- echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts
232+
- echo "127.0.0.1 localhost" >>/etc/hosts
233+
- echo "127.0.0.1 kubernetes" >>/etc/hosts
234+
- echo "127.0.0.1 {{ ds.meta_data.hostname }}" >> /etc/hosts
235+
- |
236+
KUBERNETES_VERSION_NO_V=${KUBERNETES_VERSION#v}
237+
VERSION_TO_COMPARE=1.29.0
238+
if [ "$(printf '%s\n' "$KUBERNETES_VERSION_NO_V" "$VERSION_TO_COMPARE" | sort -V | head -n1)" != "$KUBERNETES_VERSION_NO_V" ]; then
239+
if [ -f /run/kubeadm/kubeadm.yaml ]; then
240+
sed -i 's#path: /etc/kubernetes/admin.conf#path: /etc/kubernetes/super-admin.conf#' /etc/kubernetes/manifests/kube-vip.yaml;
241+
fi
242+
fi
243+
useExperimentalRetryJoin: true
244+
verbosity: 10
245+
---
246+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
247+
kind: NutanixClusterTemplate
248+
metadata:
249+
labels:
250+
cluster.x-k8s.io/provider: nutanix
251+
name: nutanix-quick-start-nct
252+
spec:
253+
template:
254+
spec:
255+
failureDomains: []
256+
---
257+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
258+
kind: NutanixMachineTemplate
259+
metadata:
260+
labels:
261+
cluster.x-k8s.io/provider: nutanix
262+
name: nutanix-quick-start-cp-nmt
263+
spec:
264+
template:
265+
spec:
266+
bootType: legacy
267+
cluster:
268+
name: ""
269+
type: name
270+
image:
271+
name: ""
272+
type: name
273+
memorySize: 4Gi
274+
providerID: nutanix://vm-uuid
275+
subnet:
276+
- name: ""
277+
type: name
278+
systemDiskSize: 40Gi
279+
vcpuSockets: 2
280+
vcpusPerSocket: 1
281+
---
282+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
283+
kind: NutanixMachineTemplate
284+
metadata:
285+
labels:
286+
cluster.x-k8s.io/provider: nutanix
287+
name: nutanix-quick-start-md-nmt
288+
spec:
289+
template:
290+
spec:
291+
bootType: legacy
292+
cluster:
293+
name: ""
294+
type: name
295+
image:
296+
name: ""
297+
type: name
298+
memorySize: 4Gi
299+
providerID: nutanix://vm-uuid
300+
subnet:
301+
- name: ""
302+
type: name
303+
systemDiskSize: 40Gi
304+
vcpuSockets: 2
305+
vcpusPerSocket: 1

0 commit comments

Comments
 (0)