mirror of https://github.com/k3s-io/k3s
Merge pull request #1693 from ibuildthecloud/disableditem
Move disabled items to a const to keep more consistencypull/1752/head
commit
21eabd902b
|
@ -6,6 +6,10 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DisableItems = "coredns, servicelb, traefik, local-storage, metrics-server"
|
||||||
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
ClusterCIDR string
|
ClusterCIDR string
|
||||||
AgentToken string
|
AgentToken string
|
||||||
|
@ -194,7 +198,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
|
||||||
},
|
},
|
||||||
cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "disable",
|
Name: "disable",
|
||||||
Usage: "(components) Do not deploy packaged components and delete any deployed components (valid items: coredns, servicelb, traefik, local-storage, metrics-server)",
|
Usage: "(components) Do not deploy packaged components and delete any deployed components (valid items: " + DisableItems + ")",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "disable-scheduler",
|
Name: "disable-scheduler",
|
||||||
|
@ -275,7 +279,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
|
||||||
FlannelFlag,
|
FlannelFlag,
|
||||||
cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "no-deploy",
|
Name: "no-deploy",
|
||||||
Usage: "(deprecated) Do not deploy packaged components (valid items: coredns, servicelb, traefik, local-storage, metrics-server)",
|
Usage: "(deprecated) Do not deploy packaged components (valid items: " + DisableItems + ")",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "cluster-secret",
|
Name: "cluster-secret",
|
||||||
|
|
|
@ -154,12 +154,14 @@ func run(app *cli.Context, cfg *cmds.Server) error {
|
||||||
serverConfig.ControlConfig.Skips = map[string]bool{}
|
serverConfig.ControlConfig.Skips = map[string]bool{}
|
||||||
for _, noDeploy := range app.StringSlice("no-deploy") {
|
for _, noDeploy := range app.StringSlice("no-deploy") {
|
||||||
for _, v := range strings.Split(noDeploy, ",") {
|
for _, v := range strings.Split(noDeploy, ",") {
|
||||||
|
v = strings.TrimSpace(v)
|
||||||
serverConfig.ControlConfig.Skips[v] = true
|
serverConfig.ControlConfig.Skips[v] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
serverConfig.ControlConfig.Disables = map[string]bool{}
|
serverConfig.ControlConfig.Disables = map[string]bool{}
|
||||||
for _, disable := range app.StringSlice("disable") {
|
for _, disable := range app.StringSlice("disable") {
|
||||||
for _, v := range strings.Split(disable, ",") {
|
for _, v := range strings.Split(disable, ",") {
|
||||||
|
v = strings.TrimSpace(v)
|
||||||
serverConfig.ControlConfig.Skips[v] = true
|
serverConfig.ControlConfig.Skips[v] = true
|
||||||
serverConfig.ControlConfig.Disables[v] = true
|
serverConfig.ControlConfig.Disables[v] = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue