-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli.go
45 lines (36 loc) · 830 Bytes
/
cli.go
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
package main
import client "k8s.io/kubernetes/pkg/client/unversioned"
func cli(kubeClient *client.Client, params map[string]string) {
switch params["subCommand"] {
case "get":
pods := getPods(kubeClient, params["namespace"])
services := getServices(kubeClient, params["namespace"])
printPodsTable(pods)
printServicesTable(services)
case "replace":
if params["image"] != "" && params["pod"] != "" {
replace(kubeClient, params)
} else {
help()
}
case "deploy-bg":
if params["service"] != "" {
bgDeploy(kubeClient, params)
} else {
help()
}
case "deploy-one":
if params["service"] != "" {
oneDeploy(kubeClient, params)
}
case "list":
if params["image"] != "" {
tagList := getTagList(params["image"])
printTagList(tagList)
} else {
help()
}
default:
help()
}
}