cass-operator icon indicating copy to clipboard operation
cass-operator copied to clipboard

Scheduled CassandraTask does not get deleted if DC is deleted

Open olim7t opened this issue 3 years ago • 0 comments

What happened? When a CassandraTask is scheduled but not yet started, if the DC gets deleted, the task is not deleted.

Did you expect to see something different? The task should be deleted regardless of its status.

How to reproduce it (as minimally and precisely as possible):

  • create a CassandraDatacenter
  • create a CassandraTask with a scheduledTime far in the future
  • delete the CassandraDatacenter

Environment

  • Cass Operator version: v1.13.1

  • Kubernetes version information:

    Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.2", GitCommit:"5835544ca568b757a8ecae5c153f317e5736700e", GitTreeState:"clean", BuildDate:"2022-09-21T14:25:45Z", GoVersion:"go1.19.1", Compiler:"gc", Platform:"darwin/amd64"}
    Kustomize Version: v4.5.7
    Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.2", GitCommit:"f66044f4361b9f1f96f0053dd46cb7dce5e990a8", GitTreeState:"clean", BuildDate:"2022-06-23T22:20:14Z", GoVersion:"go1.18.3", Compiler:"gc", Platform:"linux/amd64"}
    ```* Kubernetes cluster kind: Kind cluster from k8ssandra-operator test env.* Manifests: N/A
    
  • Cass Operator Logs: N/A

Anything else we need to know?: In cassandratask_controller.go, we handle scheduling before setting ownership:

if cassTask.Spec.ScheduledTime != nil && timeNow.Before(cassTask.Spec.ScheduledTime) {
  // requeue after delay
}
...
if err := controllerutil.SetControllerReference(dc, &cassTask, r.Scheme); err != nil {
...

┆Issue is synchronized with this Jira Story by Unito ┆Issue Number: CASS-30

olim7t avatar Nov 30 '22 17:11 olim7t