Skip to content

Commit

Permalink
Merge pull request #1838 from pixiake/multi-etcd
Browse files Browse the repository at this point in the history
fix: Add multiple etcd nodes failed
  • Loading branch information
ks-ci-bot authored May 16, 2023
2 parents 2ce24ff + a0067f3 commit 4bc171e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 0 additions & 10 deletions cmd/kk/pkg/etcd/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,6 @@ func handleExistCluster(c *ConfigureModule) []task.Interface {
Parallel: false,
}

restart := &task.RemoteTask{
Name: "RestartETCD",
Desc: "Restart etcd",
Hosts: c.Runtime.GetHostsByRole(common.ETCD),
Prepare: &NodeETCDExist{Not: true},
Action: new(RestartETCD),
Parallel: true,
}

newETCDNodeHealthCheck := &task.RemoteTask{
Name: "NewETCDNodeHealthCheck",
Desc: "Health check on new etcd",
Expand Down Expand Up @@ -360,7 +351,6 @@ func handleExistCluster(c *ConfigureModule) []task.Interface {
existETCDHealthCheck,
generateETCDConfig,
joinMember,
restart,
newETCDNodeHealthCheck,
checkMember,
allRefreshETCDConfig,
Expand Down
6 changes: 6 additions & 0 deletions cmd/kk/pkg/etcd/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ func (j *JoinMember) Execute(runtime connector.Runtime) error {
} else {
return errors.New("get etcd cluster status by pipeline cache failed")
}

// After adding a new member for etcd, it is necessary to start the new member as the etcd cluster may experience abnormal behavior.
if _, err := runtime.GetRunner().SudoCmd("systemctl daemon-reload && systemctl restart etcd && systemctl enable etcd", true); err != nil {
return errors.Wrap(errors.WithStack(err), "start etcd failed")
}

return nil
}

Expand Down

0 comments on commit 4bc171e

Please sign in to comment.