Skip to content

Commit

Permalink
Merge branch 'master' into comment-hint
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Apr 21, 2021
2 parents 84ce2f7 + 3099c60 commit 1ddbd0c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/cluster/manager/scale_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ set them in the specification fileds for each host.`))
if err := cliutil.PromptForConfirmOrAbortError("Do you want to continue? [y/N]: "); err != nil {
return err
}
return nil // user confirmed, skip futher checks
return nil // user confirmed, skip further checks
}
}
return nil
Expand Down
10 changes: 8 additions & 2 deletions pkg/cluster/template/scripts/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func NewPDScript(name, ip, deployDir, dataDir, logDir string) *PDScript {
}
}

func (c *PDScript) resetAdvertise() {
c.AdvertiseClientAddr = fmt.Sprintf("%s://%s:%d", c.Scheme, c.IP, c.ClientPort)
c.AdvertisePeerAddr = fmt.Sprintf("%s://%s:%d", c.Scheme, c.IP, c.PeerPort)
}

// WithListenHost set listenHost field of PDScript
func (c *PDScript) WithListenHost(listenHost string) *PDScript {
c.ListenHost = listenHost
Expand All @@ -66,20 +71,21 @@ func (c *PDScript) WithListenHost(listenHost string) *PDScript {
// WithScheme set Scheme field of PDScript
func (c *PDScript) WithScheme(scheme string) *PDScript {
c.Scheme = scheme
c.AdvertiseClientAddr = fmt.Sprintf("%s://%s:%d", c.Scheme, c.IP, c.ClientPort)
c.AdvertisePeerAddr = fmt.Sprintf("%s://%s:%d", c.Scheme, c.IP, c.PeerPort)
c.resetAdvertise()
return c
}

// WithClientPort set ClientPort field of PDScript
func (c *PDScript) WithClientPort(port int) *PDScript {
c.ClientPort = port
c.resetAdvertise()
return c
}

// WithPeerPort set PeerPort field of PDScript
func (c *PDScript) WithPeerPort(port int) *PDScript {
c.PeerPort = port
c.resetAdvertise()
return c
}

Expand Down

0 comments on commit 1ddbd0c

Please sign in to comment.