Skip to content

Commit dd7f636

Browse files
Add capk template (#501)
Signed-off-by: RejwankabirHamim <hamim@appscode.com>
1 parent e6c6156 commit dd7f636

File tree

3 files changed

+281
-0
lines changed

3 files changed

+281
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: Cluster
4+
metadata:
5+
name: "${CLUSTER_NAME}"
6+
namespace: "${NAMESPACE}"
7+
spec:
8+
clusterNetwork:
9+
pods:
10+
cidrBlocks:
11+
- 10.243.0.0/16
12+
services:
13+
cidrBlocks:
14+
- 10.95.0.0/16
15+
controlPlaneRef:
16+
apiVersion: controlplane.cluster.x-k8s.io/v1alpha1
17+
kind: KamajiControlPlane
18+
name: '${CLUSTER_NAME}-control-plane'
19+
namespace: "${NAMESPACE}"
20+
infrastructureRef:
21+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
22+
kind: KubevirtCluster
23+
name: '${CLUSTER_NAME}'
24+
namespace: "${NAMESPACE}"
25+
---
26+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
27+
kind: KubevirtCluster
28+
metadata:
29+
annotations:
30+
cluster.x-k8s.io/managed-by: kamaji
31+
name: "${CLUSTER_NAME}"
32+
namespace: "${NAMESPACE}"
33+
spec: {}
34+
---
35+
apiVersion: controlplane.cluster.x-k8s.io/v1alpha1
36+
kind: KamajiControlPlane
37+
metadata:
38+
name: '${CLUSTER_NAME}-control-plane'
39+
namespace: "${NAMESPACE}"
40+
spec:
41+
dataStoreName: default
42+
addons:
43+
coreDNS:
44+
dnsServiceIPs:
45+
- 10.95.0.10
46+
kubeProxy: {}
47+
konnectivity: {}
48+
kubelet:
49+
cgroupfs: systemd
50+
preferredAddressTypes:
51+
- InternalIP
52+
- ExternalIP
53+
network:
54+
serviceType: LoadBalancer
55+
serviceAnnotations:
56+
kube-vip.io/loadbalancerIPs: 0.0.0.0
57+
deployment:
58+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
59+
version: "${KUBERNETES_VERSION}"
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: Cluster
4+
metadata:
5+
name: "${CLUSTER_NAME}"
6+
namespace: "${NAMESPACE}"
7+
spec:
8+
clusterNetwork:
9+
pods:
10+
cidrBlocks:
11+
- 10.243.0.0/16
12+
services:
13+
cidrBlocks:
14+
- 10.95.0.0/16
15+
infrastructureRef:
16+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
17+
kind: KubevirtCluster
18+
name: '${CLUSTER_NAME}'
19+
namespace: "${NAMESPACE}"
20+
controlPlaneRef:
21+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
22+
kind: KubeadmControlPlane
23+
name: '${CLUSTER_NAME}-control-plane'
24+
namespace: "${NAMESPACE}"
25+
---
26+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
27+
kind: KubevirtCluster
28+
metadata:
29+
name: "${CLUSTER_NAME}"
30+
namespace: "${NAMESPACE}"
31+
spec:
32+
controlPlaneServiceTemplate:
33+
metadata:
34+
annotations:
35+
kube-vip.io/loadbalancerIPs: 0.0.0.0
36+
spec:
37+
type: LoadBalancer
38+
---
39+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
40+
kind: KubevirtMachineTemplate
41+
metadata:
42+
name: "${CLUSTER_NAME}-control-plane"
43+
namespace: "${NAMESPACE}"
44+
spec:
45+
template:
46+
spec:
47+
virtualMachineBootstrapCheck:
48+
checkStrategy: none
49+
virtualMachineTemplate:
50+
metadata:
51+
namespace: "${NAMESPACE}"
52+
spec:
53+
runStrategy: Always
54+
template:
55+
spec:
56+
domain:
57+
cpu:
58+
cores: ${CONTROL_PLANE_MACHINE_CPU}
59+
sockets: ${SOCKETS}
60+
threads: ${THREADS}
61+
devices:
62+
disks:
63+
- disk:
64+
bus: virtio
65+
name: containervolume
66+
interfaces:
67+
- bridge: {}
68+
model: virtio
69+
name: default
70+
- bridge: {}
71+
model: virtio
72+
name: secondary
73+
networkInterfaceMultiqueue: true
74+
resources:
75+
limits:
76+
cpu: ${CONTROL_PLANE_MACHINE_CPU}
77+
memory: "${CONTROL_PLANE_MACHINE_MEMORY}Gi"
78+
requests:
79+
cpu: ${CONTROL_PLANE_MACHINE_CPU}
80+
memory: "${CONTROL_PLANE_MACHINE_MEMORY}Gi"
81+
evictionStrategy: External
82+
networks:
83+
- name: default
84+
multus:
85+
networkName: default/vmnet
86+
- name: secondary
87+
pod: {}
88+
volumes:
89+
- containerDisk:
90+
image: "${NODE_VM_IMAGE_TEMPLATE}"
91+
name: containervolume
92+
---
93+
kind: KubeadmControlPlane
94+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
95+
metadata:
96+
name: "${CLUSTER_NAME}-control-plane"
97+
namespace: "${NAMESPACE}"
98+
spec:
99+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
100+
machineTemplate:
101+
infrastructureRef:
102+
kind: KubevirtMachineTemplate
103+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
104+
name: "${CLUSTER_NAME}-control-plane"
105+
namespace: "${NAMESPACE}"
106+
kubeadmConfigSpec:
107+
clusterConfiguration:
108+
networking:
109+
dnsDomain: "${CLUSTER_NAME}.${NAMESPACE}.local"
110+
podSubnet: 10.243.0.0/16
111+
serviceSubnet: 10.95.0.0/16
112+
initConfiguration:
113+
nodeRegistration:
114+
criSocket: "${CRI_PATH}"
115+
joinConfiguration:
116+
nodeRegistration:
117+
criSocket: "${CRI_PATH}"
118+
version: "${KUBERNETES_VERSION}"
119+
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
3+
kind: KubevirtMachineTemplate
4+
metadata:
5+
name: "${CLUSTER_NAME}-md"
6+
namespace: "${NAMESPACE}"
7+
spec:
8+
template:
9+
spec:
10+
virtualMachineBootstrapCheck:
11+
checkStrategy: none
12+
virtualMachineTemplate:
13+
spec:
14+
dataVolumeTemplates:
15+
- metadata:
16+
name: "${CLUSTER_NAME}-md-boot-volume"
17+
spec:
18+
pvc:
19+
accessModes:
20+
- ReadWriteOnce
21+
resources:
22+
requests:
23+
storage: 20Gi
24+
storageClassName: "${INFRA_CLUSTER_STORAGE_CLASS_NAME}"
25+
source:
26+
registry:
27+
url: "docker://${NODE_VM_IMAGE_TEMPLATE}"
28+
runStrategy: Always
29+
template:
30+
spec:
31+
domain:
32+
cpu:
33+
cores: ${WORKER_POOL_CPU}
34+
sockets: ${SOCKETS}
35+
threads: ${THREADS}
36+
devices:
37+
interfaces:
38+
- bridge: {}
39+
model: virtio
40+
name: default
41+
- bridge: {}
42+
model: virtio
43+
name: secondary
44+
disks:
45+
- disk:
46+
bus: virtio
47+
name: dv-volume
48+
resources:
49+
limits:
50+
cpu: ${WORKER_POOL_CPU}
51+
memory: "${WORKER_POOL_MEMORY}Gi"
52+
requests:
53+
cpu: ${WORKER_POOL_CPU}
54+
memory: "${WORKER_POOL_MEMORY}Gi"
55+
evictionStrategy: External
56+
networks:
57+
- name: default
58+
pod: {}
59+
- multus:
60+
networkName: default/vmnet
61+
name: secondary
62+
volumes:
63+
- dataVolume:
64+
name: "${CLUSTER_NAME}-md-boot-volume"
65+
name: dv-volume
66+
---
67+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
68+
kind: KubeadmConfigTemplate
69+
metadata:
70+
name: "${CLUSTER_NAME}-md"
71+
namespace: "${NAMESPACE}"
72+
spec:
73+
template:
74+
spec:
75+
joinConfiguration:
76+
nodeRegistration:
77+
kubeletExtraArgs: {}
78+
---
79+
apiVersion: cluster.x-k8s.io/v1beta1
80+
kind: MachineDeployment
81+
metadata:
82+
name: "${CLUSTER_NAME}-md"
83+
namespace: "${NAMESPACE}"
84+
spec:
85+
clusterName: "${CLUSTER_NAME}"
86+
replicas: ${WORKER_POOL_NODES}
87+
selector:
88+
matchLabels: null
89+
template:
90+
spec:
91+
clusterName: "${CLUSTER_NAME}"
92+
version: "${KUBERNETES_VERSION}"
93+
bootstrap:
94+
configRef:
95+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
96+
kind: KubeadmConfigTemplate
97+
name: "${CLUSTER_NAME}-md"
98+
namespace: "${NAMESPACE}"
99+
infrastructureRef:
100+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
101+
kind: KubevirtMachineTemplate
102+
name: "${CLUSTER_NAME}-md"
103+
namespace: "${NAMESPACE}"

0 commit comments

Comments
 (0)