-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.k
64 lines (49 loc) · 1.55 KB
/
main.k
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import kind.v1alpha4 as kind
import kubeadm.v1beta3 as kubeadm
import yaml
_kubeadmpatches=[]
_nodes = [
]
_clusterConfiguration=kubeadm.ClusterConfiguration{
apiServer: kubeadm.ApiServer{}
}
_extraVolumes=[kubeadm.ExtraVolumeItem{
"name" = "audit-logs"
"hostPath" = "/var/log/audit"
"mountPath" = "/var/log/audit"
}]
_apiServerExtraArgs={
"runtime-config" = "api/all=true"
"storage-media-type" = option("storageMediaType",default="application/json")
"audit-log-path" = "/var/log/audit/kube-apiserver-audit.log"
"audit-policy-file" = "/etc/kubernetes/audit-policy/apiserver-audit-policy.yaml"
}
_apiServerExtraArgsEnabled=option("apiServerExtraArgsEnabled",default=False)
if _apiServerExtraArgsEnabled:
_clusterConfiguration.apiServer.extraArgs=_apiServerExtraArgs
_apiServerExtraVolumesEnabled=option("apiServerExtraVolumesEnabled",default=False)
if _apiServerExtraVolumesEnabled:
_clusterConfiguration.apiServer.extraVolumes=_extraVolumes
_server_yaml = yaml.encode(_clusterConfiguration)
_result = [(lambda x: int -> int {
_nodes+=[kind.Node{
role = "control-plane"
image = option("image",default="kindest/node:v1.30.2")
kubeadmConfigPatches = [
_server_yaml
]
}
]
x
})(x) for x in range(0,option("cpcount",default=1))]
_result = [(lambda x: int -> int {
_nodes+=[{
role = "worker"
image = option("image",default="kindest/node:v1.30.2")
}
]
x
})(x) for x in range(0,option("workercount",default=0))]
kind.Cluster{
nodes = _nodes
}