skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

Feature: Skaffold config field to disable cleanup after dev/debug (vs just the flag `--cleanup=false`)

Open brumhard opened this issue 2 years ago • 4 comments

It would be nice if there would be an option to disable the cleanup actions that delete everything that was created.

Context

So I have a dev kubernetes cluster setup that out of the box has all the required helm charts configured with the appropriate values. I'm not using skaffold to deploy the helm charts but terraform instead.

Now, I want to use skaffold to transparently overwrite specific helm charts in the cluster during development reusing everything that is already present in the cluster. FOr that I added (replacing real names with "test"):

#...
deploy:
  helm:
    releases:
      - name: test
        namespace: default
        chartPath: charts/test
        wait: true
        setValueTemplates:
          image.repository: "{{.IMAGE_REPO_test}}"
          image.tag: "{{.IMAGE_TAG_test}}@{{.IMAGE_DIGEST_test}}"
    flags:
      install: ["--you-should-not-do-this"] # install should never be used
      upgrade: ["--reuse-values"]

Here I'm using the helm flags to fail on installs and reuse existing values from the cluster during upgrades. This works like a charm if I'm simply running skaffold run.

Currently

When running skaffold dev or skaffold debug instead it also works fine but in the end every helm release that was just upgraded in the beginning is just uninstalled.

Therefore, I basically have to rerun my terraform code containing all the values every time I quit debug or dev mode.

Potentially

So it would be nice if I could just disable the cleanup at the end of a dev cycle. Maybe it could be even further improved by just rolling back a helm release instead of deleting it at the end of a dev cycle in case the dev cycle started with an upgrade and not an install (probably could be implemented by looking at the revision number also).

skaffold version

v2.0.4

brumhard avatar Dec 29 '22 12:12 brumhard

Hi @brumhard you can use --cleanup=false to disable cleanup in dev or debug

ericzzzzzzz avatar Dec 29 '22 14:12 ericzzzzzzz

@ericzzzzzzz ah damn I guess I missed that in the docs. Any chance to get a config variable instead to not destroy anything by mistake?

brumhard avatar Dec 29 '22 16:12 brumhard

Updated the issue text to describe this issue is around adding a config field to allow toggling cleanup for Skaffold. Currently this is not something the team has in the near term in our upcoming milestones but we are happy to help an external contributor add this functionality

aaron-prindle avatar Feb 27 '23 19:02 aaron-prindle

This might help my case as well, where I can control the skaffold.yaml, but want many devs to use it and I'd prefer not to require them all to remember to use a CLI argument. I'd be happy to contribute but don't know go very well yet. Happy to test, review, etc.

ctrahey avatar Jun 07 '25 02:06 ctrahey