Skip to content

Commit

Permalink
fix: runtime panic when delete rediscluster which disable persistent (#…
Browse files Browse the repository at this point in the history
…922)

Signed-off-by: drivebyer <[email protected]>
  • Loading branch information
drivebyer authored May 11, 2024
1 parent 37ac693 commit a9fa699
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions k8sutils/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
func HandleRedisFinalizer(ctrlclient client.Client, k8sClient kubernetes.Interface, logger logr.Logger, cr *redisv1beta2.Redis) error {
if cr.GetDeletionTimestamp() != nil {
if controllerutil.ContainsFinalizer(cr, RedisFinalizer) {
if !cr.Spec.Storage.KeepAfterDelete {
if cr.Spec.Storage != nil && !cr.Spec.Storage.KeepAfterDelete {
if err := finalizeRedisPVC(k8sClient, logger, cr); err != nil {
return err
}
Expand All @@ -44,7 +44,7 @@ func HandleRedisFinalizer(ctrlclient client.Client, k8sClient kubernetes.Interfa
func HandleRedisClusterFinalizer(ctrlclient client.Client, k8sClient kubernetes.Interface, logger logr.Logger, cr *redisv1beta2.RedisCluster) error {
if cr.GetDeletionTimestamp() != nil {
if controllerutil.ContainsFinalizer(cr, RedisClusterFinalizer) {
if !cr.Spec.Storage.KeepAfterDelete {
if cr.Spec.Storage != nil && !cr.Spec.Storage.KeepAfterDelete {
if err := finalizeRedisClusterPVC(k8sClient, logger, cr); err != nil {
return err
}
Expand All @@ -63,7 +63,7 @@ func HandleRedisClusterFinalizer(ctrlclient client.Client, k8sClient kubernetes.
func HandleRedisReplicationFinalizer(ctrlclient client.Client, k8sClient kubernetes.Interface, logger logr.Logger, cr *redisv1beta2.RedisReplication) error {
if cr.GetDeletionTimestamp() != nil {
if controllerutil.ContainsFinalizer(cr, RedisReplicationFinalizer) {
if !cr.Spec.Storage.KeepAfterDelete {
if cr.Spec.Storage != nil && !cr.Spec.Storage.KeepAfterDelete {
if err := finalizeRedisReplicationPVC(k8sClient, logger, cr); err != nil {
return err
}
Expand Down

0 comments on commit a9fa699

Please sign in to comment.