This seems incorrect, and indeed the business logic in the main controller seems to deem that this code can never be hit due it !IsSubmitted being the only way this code can get hit.
Suggest removing the code that deletes the cluster as this seems extremely dangerous. The last thing we would want is a cluster to be deleted if it is running a job/jobs etc.
Looking at the code for creation of Clusters using the databricks operator there seems to be logic that could potentially delete a Cluster: https://github.com/microsoft/azure-databricks-operator/blob/master/controllers/dcluster_controller_databricks.go#L32
This seems incorrect, and indeed the business logic in the main controller seems to deem that this code can never be hit due it
!IsSubmitted
being the only way this code can get hit.Suggest removing the code that deletes the cluster as this seems extremely dangerous. The last thing we would want is a cluster to be deleted if it is running a job/jobs etc.