devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.28k stars 359 forks source link

Optionally, keep helm annotations on ReplicaSets #2181

Closed emoreth closed 1 year ago

emoreth commented 2 years ago

Is your feature request related to a problem? It is not a bug, but somewhat like a problem. When devspace replaces a pod, helm annotations are not kept:

annotations:
  meta.helm.sh/release-name: app-release-name
  meta.helm.sh/release-namespace: app-deploy-namespace-name
labels:
  app.kubernetes.io/managed-by: Helm

Which causes those pods to be left behind when one does helm delete app-release-name.

Which solution do you suggest? Add an option keep_helm_annotations: true|false defaulting to false to keep current behaviour.

Which alternative solutions exist?

My current workaround is a custom command to proper cleanup resources:

commands:
 - name: clean-release
    command: |
      helm delete ${RELEASE_NAME}
      devspace run clean
    description: Deletes the helm release and all standalone pods created by DevSpace

Additional context

/kind feature

FabianKramm commented 2 years ago

@emoreth thanks for creating this issue! DevSpace should keep the annotations and labels in the latest beta version, but I agree helm will not delete the replaced deployment automatically if helm delete is executed. Rather run devspace purge which should delete the release as well as cleanup the replaced pods

emoreth commented 2 years ago

Thank you!

We try to run devspace purge as much as possible but the muscle memory on helm delete is quite strong on people. We also have some automation to delete stale helm charts that doesn't have access to devspace.

I'm still not using V6, so I'll try a workaround for V5. Thanks.