How to delete only a specific version of an app/kubernetes_resources with the Harness Kubernetes delete Step.
If you want to delete only a specific version of an app using the harness k8s delete a step, then as part of this article, we will be answering how to achieve this in Harness CD.
- Let’s say we have a below usecase.
Currently, you use the release name option in the existing Delete step. Still, the issue with this approach is the fact that if you deploy multiple versions of an app (say, A and B, which are determined from the values injected in the values file dynamically), the Delete step will delete all versions (A and B) if you want to delete only a specific version then how to do that?
A simple solution to support This requirement is to dynamically set the release name and use the delete by release name option in k8s delete.
For example, when deploying version “A”, the release name should be set as release---A (something unique and easily constructed using input/expression).
For deleting, pass in the version and delete by release.
There is no downside to this. You need to dynamically set the release name so that each can be uniquely identified, and by this, we can take advantage of already available methods of the delete step.
You can find more information on How to Delete Kubernetes Resources with the Kubernetes Delete Step here in our documentation: Delete Kubernetes Resources with the Kubernetes Delete Step - Harness.io Docs
So this is how you can use Kubernetes Delete Step in Harness to delete only a specific version of an app/kubernetes_resources.