2019-01-09 16:54:15 +00:00
|
|
|
package cmds
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Server struct {
|
2019-01-22 21:14:58 +00:00
|
|
|
Log string
|
|
|
|
ClusterCIDR string
|
|
|
|
ClusterSecret string
|
|
|
|
ServiceCIDR string
|
|
|
|
HTTPSPort int
|
|
|
|
HTTPPort int
|
|
|
|
DataDir string
|
|
|
|
DisableAgent bool
|
|
|
|
KubeConfigOutput string
|
|
|
|
KubeConfigMode string
|
2019-01-09 16:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var ServerConfig Server
|
|
|
|
|
|
|
|
func NewServerCommand(action func(*cli.Context) error) cli.Command {
|
|
|
|
return cli.Command{
|
|
|
|
Name: "server",
|
|
|
|
Usage: "Run management server",
|
|
|
|
UsageText: appName + " server [OPTIONS]",
|
|
|
|
Action: action,
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.IntFlag{
|
|
|
|
Name: "https-listen-port",
|
|
|
|
Usage: "HTTPS listen port",
|
|
|
|
Value: 6443,
|
|
|
|
Destination: &ServerConfig.HTTPSPort,
|
|
|
|
},
|
|
|
|
cli.IntFlag{
|
|
|
|
Name: "http-listen-port",
|
|
|
|
Usage: "HTTP listen port (for /healthz, HTTPS redirect, and port for TLS terminating LB)",
|
|
|
|
Value: 0,
|
|
|
|
Destination: &ServerConfig.HTTPPort,
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "data-dir,d",
|
|
|
|
Usage: "Folder to hold state default /var/lib/rancher/k3s or ${HOME}/.rancher/k3s if not root",
|
|
|
|
Destination: &ServerConfig.DataDir,
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "disable-agent",
|
|
|
|
Usage: "Do not run a local agent and register a local kubelet",
|
|
|
|
Destination: &ServerConfig.DisableAgent,
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "log,l",
|
|
|
|
Usage: "Log to file",
|
|
|
|
Destination: &ServerConfig.Log,
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "cluster-cidr",
|
|
|
|
Usage: "Network CIDR to use for pod IPs",
|
|
|
|
Destination: &ServerConfig.ClusterCIDR,
|
2019-03-04 05:25:02 +00:00
|
|
|
Value: "10.42.0.0/16",
|
2019-01-09 16:54:15 +00:00
|
|
|
},
|
2019-01-22 21:14:58 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "cluster-secret",
|
|
|
|
Usage: "Shared secret used to bootstrap a cluster",
|
|
|
|
Destination: &ServerConfig.ClusterSecret,
|
|
|
|
EnvVar: "K3S_CLUSTER_SECRET",
|
|
|
|
},
|
|
|
|
cli.StringSliceFlag{
|
|
|
|
Name: "no-deploy",
|
2019-03-02 00:11:10 +00:00
|
|
|
Usage: "Do not deploy packaged components (valid items: coredns, servicelb, traefik)",
|
2019-01-22 21:14:58 +00:00
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "write-kubeconfig,o",
|
|
|
|
Usage: "Write kubeconfig for admin client to this file",
|
|
|
|
Destination: &ServerConfig.KubeConfigOutput,
|
|
|
|
EnvVar: "K3S_KUBECONFIG_OUTPUT",
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "write-kubeconfig-mode",
|
|
|
|
Usage: "Write kubeconfig with this mode",
|
|
|
|
Destination: &ServerConfig.KubeConfigMode,
|
|
|
|
EnvVar: "K3S_KUBECONFIG_MODE",
|
|
|
|
},
|
2019-01-09 16:54:15 +00:00
|
|
|
NodeIPFlag,
|
|
|
|
NodeNameFlag,
|
2019-03-02 00:10:18 +00:00
|
|
|
DockerFlag,
|
|
|
|
FlannelFlag,
|
2019-03-04 06:29:06 +00:00
|
|
|
CRIEndpointFlag,
|
2019-01-09 16:54:15 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|