skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

[FR] Redeploy resources that get changed.

Open tejal29 opened this issue 4 years ago • 6 comments

I was following up this stackoverflow thead https://stackoverflow.com/questions/66601242/development-lifecycle-for-fast-starting-pods-with-dependency-on-slow-starting-p

Skaffold right now redeploys the whole application when we detect changes. It would be worth looking into limiting this to redeploy on the affected resources or mark some resources as static and not under development

tejal29 avatar Mar 12 '21 17:03 tejal29

I was discussing this idea before with @briandealwis about making auto-(build/sync/debug) setting per artifact. So we could have hot reloading on one service while debugging another service. Seems a bit complicated conceptually for the end user but I think it's doable from a code POV. But I didn't think about the deploy doing all application deployments. Maybe we could group build/sync/debug/deploy more easily at a module level and support that first?

gsquared94 avatar Mar 12 '21 20:03 gsquared94

One thing, i mentioned in the internal chat and forgot to capture here is, modules is a good way to distinguish different services however, if they are being used to differentiate between "slow startup pods" vs "quick start up pods", we should look into supporting it without users needing to define multiple skaffold.yaml.

tejal29 avatar Mar 12 '21 20:03 tejal29

we should look into supporting it without users needing to define multiple skaffold.yaml.

They can define multiple configs in the same skaffold.yaml file which would be identical to defining them in separate files. Are you suggesting further granularity in a single config?

gsquared94 avatar Mar 12 '21 21:03 gsquared94

we should look into supporting it without users needing to define multiple skaffold.yaml.

They can define multiple configs in the same skaffold.yaml file which would be identical to defining them in separate files. Are you suggesting further granularity in a single config?

I meant the mutiple configs. doesn't mater if its single file ( with --- yaml separator ) or multiple files.

tejal29 avatar Mar 17 '21 19:03 tejal29

I'm facing this issue as well.

My scenario is that I have a main skaffold.yml which requires skaffold.yamls from many services, the structure is a monorepo like

apiVersion: skaffold/v4beta9
kind: Config
requires: 
  - path: infrastructure/traefik/skaffold.yaml
  - path: infrastructure/postgresql/skaffold.yaml
  - path: infrastructure/redis/skaffold.yaml
  - path: apps/search/skaffold.yaml

a change to apps/search/somefile will cause a redeployment of infrastructure/mysql which is not expected

right now I'm thinking of abandoning using requires: in favor of a shell script which runs each skaffold dev independently to avoid this issue and but it would be awesome if there were some better way to do this natively within skaffold

I can't use skaffold dev --port-forward -m search-app as I actually need all the services to be running, I just don't expect that changing a file within one service triggers a redeployment of all services

Example of issue:

Generating tags...

 - search-app: Not found. Building
Starting build...
Found [colima] context, using local docker daemon.
Building [search-app]...
Target platforms: [linux/amd64]
...
Build [search-app] succeeded
Starting test...
Testing images...
Command finished successfully.
Tags used in deployment:
Starting deploy...
Starting pre-deploy hooks...
Completed pre-deploy hooks
Waiting for deployments to stabilize...
 - deployment/traefik is ready. [7/8 deployment(s) still pending]
 - deployment/monad-site is ready. [6/8 deployment(s) still pending]
 - deployment/volatile-redis is ready. [5/8 deployment(s) still pending]
 - deployment/mysql is ready. [4/8 deployment(s) still pending]
 - deployment/minio is ready. [3/8 deployment(s) still pending]
 - deployment/search-app is ready. [2/8 deployment(s) still pending]
 - deployment/postgres is ready. [1/8 deployment(s) still pending]
 - deployment/website-management-panel is ready.

mattbucci avatar Jan 30 '24 03:01 mattbucci

Something like the following does work:

skaffold dev -m "postgres" &
skaffold dev -m "website-management-panel" &
skaffold dev -m "search-app"

you have to make sure to define local ports though for everything or you will get port conflicts like

failed to port forward deployment-search-app-default-80, port 4503 is taken, retrying...

mattbucci avatar Jan 30 '24 04:01 mattbucci