turbot / helm-charts

Helm charts for Turbot Guardrails
Apache License 2.0
0 stars 0 forks source link

Remove cluster from Guardrails inventory when uninstalling helm chart #20

Open lorengordon opened 3 months ago

lorengordon commented 3 months ago

Currently, when uninstalling the helm chart, the cluster remains in the Guardrails inventory. I'd like to propose using a helm hook, maybe pre-delete or post-delete, to remove the inventory item. Optionally, of course, understanding that folks may also prefer to leave the inventory item or handle removal differently.

cbruno10 commented 3 months ago

Hey @lorengordon , do you have any initial ideas on what how you'd want this hook to delete the Kubernetes cluster from CMDB? From my understanding, hooks are used to create additional Kubernetes resources, so for instance, you could have a hook that creates a Kubernetes job in the cluster that runs a curl command. But I'm not sure if there's a specific resource type or process to delete the clusters.

lorengordon commented 3 months ago

I know very little about Kubernetes or helm, so I'm not sure I have a great answer. But the general idea was to execute a command that "reverses" the cluster enrollment. What is it that runs on install that enrolls the cluster? Have a Kubernetes resource that does the opposite, run as a pre-delete hook.

In the doc, they have an example hook that is just running /bin/sleep, so it seems in theory possible to run arbitrary commands?

    spec:
      restartPolicy: Never
      containers:
      - name: post-install-job
        image: "alpine:3.3"
        command: ["/bin/sleep","{{ default "10" .Values.sleepyTime }}"]