-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s.cue
126 lines (119 loc) · 2.17 KB
/
k8s.cue
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package civo
import (
"dagger.io/dagger"
"universe.dagger.io/docker"
"universe.dagger.io/bash"
)
#K8s: {
apps: {
apiKey: dagger.#Secret
docker.#Run & {
_image: #CLI & {
env: CIVO_API_KEY: apiKey
}
input: _image.output
always: true
command: {
name: "civo"
args: ["k8s", "applications", "ls"]
}
}
}
create: {
apiKey: dagger.#Secret
clusterName: string
apps: string | *"metrics-server"
cni: string | *"cilium"
size: string | *"g4s.kube.small"
nodes: int | *1
region: string | *"LON1"
docker.#Run & {
_image: #CLI & {
env: CIVO_API_KEY: apiKey
}
input: _image.output
command: {
name: "civo"
args: [
"k8s", "create", clusterName,
"--applications", apps,
"--cni-plugin", cni,
"--create-firewall",
"--size", size,
"--nodes=\(nodes)",
"--region", region,
"--wait",
"--yes",
]
}
}
}
info: {
apiKey: dagger.#Secret
clusterName: string
docker.#Run & {
_image: #CLI & {
env: CIVO_API_KEY: apiKey
}
input: _image.output
always: true
command: {
name: "civo"
args: [
"k8s", "show", clusterName,
]
}
}
}
config: {
apiKey: dagger.#Secret
clusterName: string
docker.#Run & {
_image: #CLI & {
env: CIVO_API_KEY: apiKey
}
input: _image.output
always: true
command: {
name: "civo"
args: [
"k8s", "config", clusterName,
"--save", "--overwrite",
"--local-path=/k8s.yml",
]
}
export: files: "/k8s.yml": string
}
}
ip: {
apiKey: dagger.#Secret
clusterName: string
bash.#Run & {
_image: #CLI & {
env: CIVO_API_KEY: apiKey
}
input: _image.output
always: true
env: NAME: clusterName
script: contents: "civo k8s show $NAME --output=custom --fields=MasterIP > /public_ip.txt"
export: files: "/public_ip.txt": string
}
}
destroy: {
apiKey: dagger.#Secret
clusterName: string
docker.#Run & {
_image: #CLI & {
env: CIVO_API_KEY: apiKey
}
input: _image.output
command: {
name: "civo"
args: [
"k8s", "destroy", clusterName,
"--yes",
]
}
}
}
}