-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
When running skaffold dev with the sync feature enable, in a project with N different configs (different skaffold.yaml files), every time skaffold syncs a file, it will try to do it N times: it will look for the corresponding image to sync the file N times.
Expected behavior
A file sync, in a multi config project, running skaffold dev, should look for the image to sync the file only once, independently of how many configs we have in the project.
Actual behavior
Instead, when a file sync is triggered, skaffold will try to find the corresponding image more than once, running the logic more times than needed.
Information
- Skaffold version: v1.38.0-63-ga1f4e4b85-dirty
- Operating system: MacOS Monterey
- Installed via: Local build using the
mainbranch - Contents of skaffold.yaml:
We can use the example project multi-config-microservices, enabling the sync feature:
leeroy-app skaffold.yaml file with sync:
apiVersion: skaffold/v2beta28
kind: Config
metadata:
name: app-config
requires:
- path: ../base
build:
artifacts:
- image: leeroy-app
sync:
infer:
- "**/*.go"
requires:
- image: base
alias: BASE
deploy:
kubectl:
manifests:
- kubernetes/*
portForward:
- resourceType: deployment
resourceName: leeroy-app
port: http
localPort: 9001leeroy-web skaffold.yaml file with sync:
apiVersion: skaffold/v2beta28
kind: Config
metadata:
name: web-config
requires:
- path: ../base
build:
artifacts:
- image: leeroy-web
sync:
infer:
- "**/*.go"
requires:
- image: base
alias: BASE
deploy:
kubectl:
manifests:
- kubernetes/*
portForward:
- resourceType: deployment
resourceName: leeroy-web
port: 8080
localPort: 9000The other yaml files in the example don't need a change.
Steps to reproduce the behavior
- Open the multi-config-microservices example
- Modify the
skaffold.yamlfiles listed above to enable the sync feature - Check the
forloop in:
skaffold/pkg/skaffold/sync/syncer_mux.go
Lines 28 to 34 in 34f48f7
func (s SyncerMux) Sync(ctx context.Context, out io.Writer, item *Item) error { var errs []error for _, syncer := range s { if err := syncer.Sync(ctx, out, item); err != nil { errs = append(errs, err) } } - Run
skaffold devin the project - The
forloop will try to find the proper image two times, even when it is not necessary