Skip to content

Commit

Permalink
fix labring#566, if /etc/kubernetes/manifests is exist, will never up…
Browse files Browse the repository at this point in the history
…date lvscare.yaml when delete master nodes

Signed-off-by: oldthreefeng <[email protected]>
  • Loading branch information
oldthreefeng committed Dec 25, 2020
1 parent ac0efc1 commit 64a3f38
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/ipvs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ var ipvsCmd = &cobra.Command{
},
}

var clean bool

func init() {
rootCmd.AddCommand(ipvsCmd)

// Here you will define your flags and configuration settings.
ipvsCmd.Flags().BoolVar(&install.Ipvs.RunOnce, "run-once", false, "is run once mode")
// clean Vip ipvs rule before join node, if Vip has no ipvs rule do nothing.
ipvsCmd.Flags().BoolVarP(&install.Ipvs.Clean, "clean","c", true, " clean Vip ipvs rule before join node, if Vip has no ipvs rule do nothing.")
ipvsCmd.Flags().StringVar(&install.Ipvs.VirtualServer, "vs", "", "virturl server like 10.54.0.2:6443")
ipvsCmd.Flags().StringSliceVar(&install.Ipvs.RealServer, "rs", []string{}, "virturl server like 192.168.0.2:6443")
Expand Down
3 changes: 2 additions & 1 deletion install/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ func (s *SealosClean) cleanMaster(master string) {
go func(node string) {
defer wg.Done()
_ = SSHConfig.CmdAsync(node, "rm -rf /etc/kubernetes/manifests/kube-sealyun-lvscare*")
_ = SSHConfig.CmdAsync(node, fmt.Sprintf("mkdir -p /etc/kubernetes/manifests && echo '%s' > /etc/kubernetes/manifests/kube-sealyun-lvscare.yaml", yaml))
// /etc/kubernetes/manifests 这个目录如果存在, 则永远不会更新lvscare.yaml
_ = SSHConfig.CmdAsync(node, fmt.Sprintf("(mkdir -p /etc/kubernetes/manifests || true) && echo '%s' > /etc/kubernetes/manifests/kube-sealyun-lvscare.yaml", yaml))
}(node)
}
wg.Wait()
Expand Down
1 change: 0 additions & 1 deletion install/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func (s *SealosInstaller) JoinNodes() {
addRouteCmd := fmt.Sprintf("sealos route add --host %s --gateway %s", VIP, IpFormat(node))
SSHConfig.CmdToString(node, addRouteCmd, "")
}


_ = SSHConfig.CmdAsync(node, ipvsCmd) // create ipvs rules before we join node
cmd := s.Command(Version, JoinNode)
Expand Down

0 comments on commit 64a3f38

Please sign in to comment.