-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathkind.ts
341 lines (338 loc) · 8.97 KB
/
kind.ts
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
const ClusterGenerator: Fig.Generator = {
script: ["kind", "get", "clusters"],
postProcess: (out) => {
return out.split("\n").map((cluster) => ({
name: cluster,
description: "Cluster",
}));
},
};
const NodeGenerator: Fig.Generator = {
script: ["kind", "get", "nodes", "-A"],
postProcess: (out) => {
return out.split("\n").map((node) => ({
name: node,
description: "Node",
}));
},
};
const completionSpec: Fig.Spec = {
name: "kind",
description: "Kubernetes IN Docker - local clusters for testing Kubernetes",
subcommands: [
{
name: "Build",
description: "Build one of [node-image]",
subcommands: [
{
name: "node-image",
description: "Builds a node image",
options: [
{
name: "--arch",
description:
"Architecture to build for, defaults to the host architecture",
args: {
name: "architecture",
description:
"Architecture to build for, defaults to the host architecture",
},
},
{
name: "--base-image",
description: "Base image to use for the node image",
args: {
name: "base image",
description: "Name:tag of the base image to use for the build",
},
},
{
name: "--image",
description: "Name:tag of the resulting image to be built",
args: {
name: "name:tag",
description: "Name:tag of the resulting image to be built",
},
},
{
name: "--kube-root",
description: "Path to the Kubernetes source directory",
args: {
name: "path",
description: "Path to the Kubernetes source directory",
},
deprecated: true,
},
{
name: "--type",
description: "Type of node image to build",
args: {
name: "type",
description: "Build type, default is docker",
},
},
],
},
],
},
{
name: "create",
description: "Creates a cluster",
subcommands: [
{
name: "cluster",
description: "Creates a cluster",
options: [
{
name: "--config",
description: "Path to a kind config file",
},
{
name: "--image",
description: "Node docker image to use for booting the cluster",
},
{
name: "--kubeconfig",
description:
"Sets kubeconfig path instead of $KUBECONFIG or $HOME/.kube/config",
},
{
name: "--name",
description: "Cluster name",
},
{
name: "--retain",
description:
"Retain nodes for debugging when cluster creation fails",
},
{
name: "--wait",
description: "Wait for control-plane node to be ready",
},
],
},
],
},
{
name: "completion",
description: "Generates shell completion scripts",
subcommands: [
{
name: "bash",
description: "Output shell completions for bash",
},
{
name: "fish",
description: "Output shell completions for fish",
},
{
name: "zsh",
description: "Output shell completions for zsh",
},
],
},
{
name: "delete",
description: "Deletes one or more clusters",
subcommands: [
{
name: "cluster",
description: "Delete Cluster",
options: [
{
name: "--name",
description: "Cluster name",
args: {
name: "cluster name",
generators: ClusterGenerator,
},
priority: 100,
},
],
},
{
name: "clusters",
description: "Delete Clusters",
options: [
{
name: ["-A", "--all"],
description: "Delete all clusters",
priority: 100,
},
{
name: "--kubeconfig",
description:
"Sets kubeconfig path instead of $KUBECONFIG or $HOME/.kube/config",
},
],
},
],
},
{
name: "export",
description: "Exports a cluster's kubeconfig",
subcommands: [
{
name: "kubeconfig",
description: "Exports a cluster's kubeconfig",
options: [
{
name: "--name",
description: "Cluster name",
},
{
name: "--internal",
description: "Use internal address instead of externalt",
},
{
name: "--kubeconfig",
description:
"Sets kubeconfig path instead of $KUBECONFIG or $HOME/.kube/config",
},
],
},
{
name: "logs",
description: "Exports logs to a tempdir or [output-dir] if specified",
options: [
{
name: "--name",
description: "Cluster name",
args: {
name: "cluster name",
generators: ClusterGenerator,
},
priority: 100,
},
],
},
],
},
{
name: "get",
description: "Gets one of [clusters, nodes, kubeconfig]",
subcommands: [
{
name: "clusters",
description: "Lists existing kind clusters by their name",
},
{
name: "kubeconfig",
description: "Prints cluster kubeconfig",
options: [
{
name: "--name",
description: "Cluster name",
args: {
name: "cluster name",
generators: ClusterGenerator,
},
priority: 100,
},
{
name: "--internal",
description: "Use internal address instead of external",
},
],
},
{
name: "nodes",
description: "Lists existing kind nodes by their name",
options: [
{
name: ["-A", "--all"],
description: "List all nodes",
priority: 50,
},
{
name: "--name",
description: "Cluster name",
args: {
name: "cluster name",
generators: ClusterGenerator,
},
priority: 50,
},
],
},
],
},
{
name: "load",
description: "Loads images into node from an archive or image on host",
subcommands: [
{
name: "docker-image",
description:
"Loads docker images from host into all or specified nodes by name",
options: [
{
name: "--name",
description: "Cluster name",
args: {
name: "cluster name",
generators: ClusterGenerator,
},
},
{
name: "--nodes",
description: "Comma separated list of nodes to load images into",
args: {
name: "nodes",
generators: NodeGenerator,
},
},
],
},
{
name: "image-archive",
description:
"Loads docker images from archive into all or specified nodes by name",
options: [
{
name: "--name",
description: "Cluster name",
args: {
name: "cluster name",
generators: ClusterGenerator,
},
},
{
name: "--nodes",
description: "Comma separated list of nodes to load images into",
args: {
name: "nodes",
generators: NodeGenerator,
},
},
],
},
],
},
{
name: "version",
description: "Prints the kind CLI version",
},
],
options: [
{
name: ["-h", "--help"],
description: "Help for kind",
isPersistent: true,
},
{
name: ["-q", "--quiet"],
description: "Silence all stderr output",
isPersistent: true,
},
{
name: ["-v", "--verbosity"],
description: "Info log verbosity, higher value produces more output",
isPersistent: true,
args: {
name: "int",
},
},
],
};
export default completionSpec;