Browse Source

Add agent command to server command

pull/111/head^2
Darren Shepherd 6 years ago
parent
commit
3d113ceb2d
  1. 26
      pkg/cli/cmds/agent.go
  2. 2
      pkg/cli/cmds/server.go

26
pkg/cli/cmds/agent.go

@ -29,15 +29,25 @@ var (
AgentConfig Agent AgentConfig Agent
NodeIPFlag = cli.StringFlag{ NodeIPFlag = cli.StringFlag{
Name: "node-ip,i", Name: "node-ip,i",
Usage: "IP address to advertise for node", Usage: "(agent) IP address to advertise for node",
Destination: &AgentConfig.NodeIP, Destination: &AgentConfig.NodeIP,
} }
NodeNameFlag = cli.StringFlag{ NodeNameFlag = cli.StringFlag{
Name: "node-name", Name: "node-name",
Usage: "Node name", Usage: "(agent) Node name",
EnvVar: "K3S_NODE_NAME", EnvVar: "K3S_NODE_NAME",
Destination: &AgentConfig.NodeName, Destination: &AgentConfig.NodeName,
} }
DockerFlag = cli.BoolFlag{
Name: "docker",
Usage: "(agent) Use docker instead of containerd",
Destination: &AgentConfig.Docker,
}
FlannelFlag = cli.BoolFlag{
Name: "no-flannel",
Usage: "(agent) Disable embedded flannel",
Destination: &AgentConfig.NoFlannel,
}
) )
func NewAgentCommand(action func(ctx *cli.Context) error) cli.Command { func NewAgentCommand(action func(ctx *cli.Context) error) cli.Command {
@ -65,22 +75,14 @@ func NewAgentCommand(action func(ctx *cli.Context) error) cli.Command {
Destination: &AgentConfig.DataDir, Destination: &AgentConfig.DataDir,
Value: "/var/lib/rancher/k3s", Value: "/var/lib/rancher/k3s",
}, },
cli.BoolFlag{
Name: "docker",
Usage: "Use docker instead of containerd",
Destination: &AgentConfig.Docker,
},
cli.BoolFlag{
Name: "no-flannel",
Usage: "Disable embedded flannel",
Destination: &AgentConfig.NoFlannel,
},
cli.StringFlag{ cli.StringFlag{
Name: "cluster-secret", Name: "cluster-secret",
Usage: "Shared secret used to bootstrap a cluster", Usage: "Shared secret used to bootstrap a cluster",
Destination: &AgentConfig.ClusterSecret, Destination: &AgentConfig.ClusterSecret,
EnvVar: "K3S_CLUSTER_SECRET", EnvVar: "K3S_CLUSTER_SECRET",
}, },
DockerFlag,
FlannelFlag,
NodeNameFlag, NodeNameFlag,
NodeIPFlag, NodeIPFlag,
}, },

2
pkg/cli/cmds/server.go

@ -83,6 +83,8 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
}, },
NodeIPFlag, NodeIPFlag,
NodeNameFlag, NodeNameFlag,
DockerFlag,
FlannelFlag,
}, },
} }
} }

Loading…
Cancel
Save