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