Closed devdattakulkarni closed 1 year ago
The changes will be at the following locations:
1) helmer: https://github.com/cloud-ark/kubeplus/blob/master/platform-operator/helm-pod/main.go#L328 Here check if the objData has a status field. If it is and its value is nil, return an error string "Error: Custom Resource instance cannot be deleted. It is not ready yet.". Currently, there is no else clause for the if statement in line 330. This will need to be added.
2) mutating-webhook: https://github.com/cloud-ark/kubeplus/blob/master/mutating-webhook/webhook.go#L377 Here get the return value (byte array), convert it to String, and check if it matches the above error string. If so, return AdmissionResponse with a message (similar to lines 368 - 372).
Supabase Helm chart is a good candidate for testing this as it takes a couple of minutes for all the application Pods to start-up. The status field gets updated only after helm returns from the 'helm install' command.
KubePlus updates the status of the Custom Resource instance with the namespace and release name of the underlying Helm chart's release after completion of the "helm install" command by helmer. KubePlus should deny the 'delete' request for the CR instance if this information is not available in the CR instance's status field.
cc: @eminalparslan