Skip to content

Commit

Permalink
Fetch namespaces at time of sync (#6135)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis authored Jul 7, 2021
1 parent 5d7aaff commit 1a5fdc7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/skaffold/sync/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func NewSyncProvider(config Config, cli *kubectl.CLI) Provider {
provider = &fullProvider{
kubernetesSyncer: func(podSelector *kubernetes.ImageList) Syncer {
return &podSyncer{
kubectl: cli,
namespaces: config.GetNamespaces(),
kubectl: cli,
config: config,
}
},
noopSyncer: func() Syncer {
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,15 @@ func (s *podSyncer) Sync(ctx context.Context, item *Item) error {
if len(item.Copy) > 0 {
logrus.Infoln("Copying files:", item.Copy, "to", item.Image)

if err := Perform(ctx, item.Image, item.Copy, s.copyFileFn, s.namespaces); err != nil {
if err := Perform(ctx, item.Image, item.Copy, s.copyFileFn, s.config.GetNamespaces()); err != nil {
return fmt.Errorf("copying files: %w", err)
}
}

if len(item.Delete) > 0 {
logrus.Infoln("Deleting files:", item.Delete, "from", item.Image)

if err := Perform(ctx, item.Image, item.Delete, s.deleteFileFn, s.namespaces); err != nil {
if err := Perform(ctx, item.Image, item.Delete, s.deleteFileFn, s.config.GetNamespaces()); err != nil {
return fmt.Errorf("deleting files: %w", err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/sync/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ type Syncer interface {
}

type podSyncer struct {
kubectl *pkgkubectl.CLI
namespaces []string
kubectl *pkgkubectl.CLI
config Config
}

type Config interface {
Expand Down

0 comments on commit 1a5fdc7

Please sign in to comment.