Skip to content

Commit

Permalink
fix: sync sealos work dir (labring#3987)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostloda committed Sep 25, 2023
1 parent 344296e commit fa091a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/apply/applydrivers/apply_drivers_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/labring/sealos/pkg/client-go/kubernetes"
"github.com/labring/sealos/pkg/clusterfile"
"github.com/labring/sealos/pkg/constants"
"github.com/labring/sealos/pkg/exec"
"github.com/labring/sealos/pkg/ssh"
v2 "github.com/labring/sealos/pkg/types/v1beta1"
"github.com/labring/sealos/pkg/utils/confirm"
Expand Down Expand Up @@ -275,13 +276,15 @@ func (c *Applier) syncWorkdir() {
workDir := constants.ClusterDir(c.ClusterDesired.Name)
logger.Debug("sync workdir: %s", workDir)
ipList := c.ClusterDesired.GetMasterIPAndPortList()
sshClient := ssh.NewCacheClientFromCluster(c.ClusterDesired, true)

execer, err := exec.New(ssh.NewCacheClientFromCluster(c.ClusterDesired, true))
if err != nil {
logger.Error("failed to create ssh client: %v", err)
}
eg, _ := errgroup.WithContext(context.Background())
for _, ipAddr := range ipList {
ip := ipAddr
eg.Go(func() error {
return sshClient.Copy(ip, workDir, workDir)
return execer.Copy(ip, workDir, workDir)
})
}
if err := eg.Wait(); err != nil {
Expand Down

0 comments on commit fa091a8

Please sign in to comment.