Propagate namespaces to syncer.
@@ -97,6 +97,11 @@ func NewForConfig(opts *config.SkaffoldOptions, cfg *latest.SkaffoldPipeline) (*
return nil, errors.Wrap(err, "parsing deploy config")
}
+ syncer, err := getSyncer(namespaces)
+ if err != nil {
+ return nil, errors.Wrap(err, "creating syncer")
+ }
+
labellers := []deploy.Labeller{opts, builder, deployer, tagger}
builder, tester, deployer = WithTimings(builder, tester, deployer)
@@ -114,7 +119,7 @@ func NewForConfig(opts *config.SkaffoldOptions, cfg *latest.SkaffoldPipeline) (*
Tester: tester,
Deployer: deployer,
Tagger: tagger,
- Syncer: &kubectl.Syncer{},
+ Syncer: syncer,
Watcher: watch.NewWatcher(trigger),
opts: opts,
labellers: labellers,
@@ -156,6 +161,10 @@ func getTester(cfg *latest.TestConfig, opts *config.SkaffoldOptions) (test.Teste
}
}
+func getSyncer(namespaces []string) (sync.Syncer, error) {
+ return kubectl.NewSyncer(namespaces), nil
+}
+
func getDeployer(cfg *latest.DeployConfig, kubeContext string, namespace string, defaultRepo string) (deploy.Deployer, error) {
// TODO(dgageot): this should be the folder containing skaffold.yaml. Should also be moved elsewhere.
cwd, err := os.Getwd()
