-
-
Notifications
You must be signed in to change notification settings - Fork 377
/
main.go
65 lines (54 loc) · 1.32 KB
/
main.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"os"
"github.com/alexellis/k3sup/cmd"
"github.com/alexellis/k3sup/pkg"
"github.com/spf13/cobra"
)
func main() {
cmdInstall := cmd.MakeInstall()
cmdVersion := cmd.MakeVersion()
cmdJoin := cmd.MakeJoin()
cmdUpdate := cmd.MakeUpdate()
cmdReady := cmd.MakeReady()
cmdPlan := cmd.MakePlan()
cmdNodeToken := cmd.MakeNodeToken()
printk3supASCIIArt := cmd.PrintK3supASCIIArt
var rootCmd = &cobra.Command{
Use: "k3sup",
Run: func(cmd *cobra.Command, args []string) {
printk3supASCIIArt()
cmd.Help()
},
Example: ` # Install k3s on a server with embedded etcd
k3sup install \
--cluster \
--host $SERVER_1 \
--user $SERVER_1_USER \
--k3s-channel stable
# Join a second server
k3sup join \
--server \
--host $SERVER_2 \
--user $SERVER_2_USER \
--server-host $SERVER_1 \
--server-user $SERVER_1_USER \
--k3s-channel stable
# Join an agent to the cluster
k3sup join \
--host $SERVER_1 \
--user $SERVER_1_USER \
--k3s-channel stable
` + pkg.SupportMessageShort,
}
rootCmd.AddCommand(cmdInstall)
rootCmd.AddCommand(cmdVersion)
rootCmd.AddCommand(cmdJoin)
rootCmd.AddCommand(cmdUpdate)
rootCmd.AddCommand(cmdReady)
rootCmd.AddCommand(cmdPlan)
rootCmd.AddCommand(cmdNodeToken)
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}