Merge pull request #1693 from ibuildthecloud/disableditem

Move disabled items to a const to keep more consistency
pull/1752/head
Erik Wilson 2020-05-04 20:16:42 -07:00 committed by GitHub
commit 21eabd902b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -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",

View File

@ -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
} }