Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster: support IngoreInitConfigComps #1987

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions components/cluster/command/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func newPruneCmd() *cobra.Command {
}

cmd.Flags().BoolVar(&gOpt.Force, "force", false, "Ignore errors when deleting the instance with data from the cluster")
cmd.Flags().StringSliceVar(&gOpt.IngoreInitConfigRoles, "ignore-config-roles", nil, "ignore generate config in specified components(tidb,pd,tikv)")

return cmd
}
1 change: 1 addition & 0 deletions components/cluster/command/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func newScaleInCmd() *cobra.Command {
cmd.Flags().StringSliceVarP(&gOpt.Nodes, "node", "N", nil, "Specify the nodes (required)")
cmd.Flags().Uint64Var(&gOpt.APITimeout, "transfer-timeout", 600, "Timeout in seconds when transferring PD and TiKV store leaders, also for TiCDC drain one capture")
cmd.Flags().BoolVar(&gOpt.Force, "force", false, "Force just try stop and destroy instance before removing the instance from topo")
cmd.Flags().StringSliceVar(&gOpt.IngoreInitConfigRoles, "ignore-config-roles", nil, "ignore generate config in specified components(tidb,pd,tikv)")

_ = cmd.MarkFlagRequired("node")

Expand Down
1 change: 1 addition & 0 deletions components/cluster/command/scale_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func newScaleOutCmd() *cobra.Command {
cmd.Flags().BoolVarP(&opt.NoLabels, "no-labels", "", false, "Don't check TiKV labels")
cmd.Flags().BoolVarP(&opt.Stage1, "stage1", "", false, "Don't start the new instance after scale-out, need to manually execute cluster scale-out --stage2")
cmd.Flags().BoolVarP(&opt.Stage2, "stage2", "", false, "Start the new instance and init config after scale-out --stage1")
cmd.Flags().StringSliceVar(&gOpt.IngoreInitConfigRoles, "ignore-config-roles", nil, "ignore generate config in specified components(tidb,pd,tikv)")

return cmd
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/cluster/manager/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,13 @@ func buildInitConfigTasks(
return
}
compName := instance.ComponentName()

for _, IgnoreComp := range gOpt.IngoreInitConfigRoles {
if IgnoreComp == compName {
return
}
}

deployDir := spec.Abs(base.User, instance.DeployDir())
// data dir would be empty for components which don't need it
dataDirs := spec.MultiDirAbs(base.User, instance.DataDir())
Expand Down
2 changes: 2 additions & 0 deletions pkg/cluster/operation/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type Options struct {

DisplayMode string // the output format
Operation Operation

IngoreInitConfigRoles []string // ignore config generate in the specific roles
}

// Operation represents the type of cluster operation
Expand Down