Skip to content

Commit

Permalink
cluster: restart prometheus after scale-in the cluster (#717)
Browse files Browse the repository at this point in the history
Co-authored-by: ti-srebot <[email protected]>
Co-authored-by: Lonng <[email protected]>
  • Loading branch information
3 people authored Aug 27, 2020
1 parent e8a7b45 commit 4978e39
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions components/cluster/command/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func newScaleInCmd() *cobra.Command {
return manager.ScaleIn(
clusterName,
skipConfirm,
gOpt.OptTimeout,
gOpt.SSHTimeout,
gOpt.NativeSSH,
gOpt.Force,
Expand Down
1 change: 1 addition & 0 deletions components/dm/command/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func newScaleInCmd() *cobra.Command {
return manager.ScaleIn(
clusterName,
skipConfirm,
gOpt.OptTimeout,
gOpt.SSHTimeout,
gOpt.NativeSSH,
gOpt.Force,
Expand Down
12 changes: 10 additions & 2 deletions pkg/cluster/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,7 @@ func (m *Manager) Deploy(
func (m *Manager) ScaleIn(
clusterName string,
skipConfirm bool,
optTimeout int64,
sshTimeout int64,
nativeSSH bool,
force bool,
Expand Down Expand Up @@ -1241,7 +1242,14 @@ func (m *Manager) ScaleIn(
// TODO: support command scale in operation.
scale(b, metadata)

t := b.Parallel(regenConfigTasks...).Build()
t := b.Parallel(regenConfigTasks...).
Func("RestartMonitor", func(ctx *task.Context) error {
return operator.Restart(ctx, metadata.GetTopology(), operator.Options{
Roles: []string{spec.ComponentPrometheus},
OptTimeout: optTimeout,
})
}).
Build()

if err := t.Execute(task.NewContext()); err != nil {
if errorx.Cast(err) != nil {
Expand Down Expand Up @@ -1865,7 +1873,7 @@ func buildScaleOutTask(
return operator.Start(ctx, newPart, operator.Options{OptTimeout: optTimeout})
}).
Parallel(refreshConfigTasks...).
Func("RestartCluster", func(ctx *task.Context) error {
Func("RestartMonitor", func(ctx *task.Context) error {
return operator.Restart(ctx, metadata.GetTopology(), operator.Options{
Roles: []string{spec.ComponentPrometheus},
OptTimeout: optTimeout,
Expand Down

0 comments on commit 4978e39

Please sign in to comment.