Delete secrets on tenant deletion (#253)

This commit is contained in:
Cesar N
2020-08-20 18:57:34 -07:00
committed by GitHub
parent 4b42308484
commit 545a890c45
2 changed files with 10 additions and 1 deletions

View File

@@ -189,7 +189,12 @@ func deleteTenantAction(
opts := metav1.ListOptions{
LabelSelector: fmt.Sprintf("%s=%s", operator.TenantLabel, tenantName),
}
return clientset.PersistentVolumeClaims(namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, opts)
err = clientset.PersistentVolumeClaims(namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, opts)
if err != nil {
return err
}
// delete all tenant's secrets only if deletePvcs = true
return clientset.Secrets(namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, opts)
}
return nil
}