Skip to content

How to clean up a namespace with service instance & bindings properly with helm? #623

@sim-lus

Description

@sim-lus

We are running on Kyma using github action pipelines with piper.
Our yaml chart contains sth. like this:

apiVersion: services.cloud.sap.com/v1
kind: ServiceInstance
metadata:
  name: {{ .Values.btpservice.destination.name }}-{{ .Release.Namespace }}
  namespace: {{ .Release.Namespace }}
spec:
  serviceOfferingName: {{ .Values.btpservice.destination.name }}
  servicePlanName: {{ .Values.btpservice.destination.planname }}
---
apiVersion: services.cloud.sap.com/v1
kind: ServiceBinding
metadata:
  name: {{ .Values.btpservice.destination.name }}-{{ .Release.Namespace }}
  namespace: {{ .Release.Namespace }}
spec:
  serviceInstanceName: {{ .Values.btpservice.destination.name }}-{{ .Release.Namespace }}
  serviceInstanceNamespace: {{ .Release.Namespace }}
  secretName: {{ .Values.btpservice.destination.name }}-{{ .Release.Namespace }}
---

We are uninstall it in our piper script via:

helm uninstall namespace-config --kube-context rcdev --namespace ns-test --wait --timeout 300s

Afterwards we are deleting the namespace in the script.

Sometimes one of the following two issues occur:

  1. The uninstall-command run into the 300s timeout: In the cluster everything is gone then, however in the BTP cockpit the instance (without the bindings) are still present
  2. The instance and secrets are gone, but the binding remains in the cluster, keeping the namespace in "Terminating"-state. In BTP cockpit both still exist.

How to solve this properly for both cases?

Issue 2 is I guess somehow an order problem, how can helm handle this correctly?
To get out of issue 1 I found some documentation, but how to avoid it at all?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions