From 9957fef8f13c751e0afa7d21a382c5c37f8589b3 Mon Sep 17 00:00:00 2001 From: Richard Kovacs Date: Tue, 1 Feb 2022 16:02:22 +0100 Subject: [PATCH] Cleanup old/previous replicas during volume sync (#120) --- internal/controllers/sync-volume/utils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/controllers/sync-volume/utils.go b/internal/controllers/sync-volume/utils.go index 153ec92f..6f9abbd5 100644 --- a/internal/controllers/sync-volume/utils.go +++ b/internal/controllers/sync-volume/utils.go @@ -104,6 +104,7 @@ func getConverter(vol *stosv1.Volume, obj storageos.Object, log logr.Logger) fun ConfigLabels: obj.GetLabels(), } + vol.Spec.NFS = stosv1.NFSConfig{} if stosVol.Nfs.Exports != nil { vol.Spec.NFS = stosv1.NFSConfig{ Exports: make([]stosv1.NFSExportConfig, 0, len(*stosVol.Nfs.Exports)), @@ -159,6 +160,7 @@ func getConverter(vol *stosv1.Volume, obj storageos.Object, log logr.Logger) fun AttachedOnHost: stosVol.AttachedOnHost, } + vol.Status.Replicas = nil if stosVol.Replicas != nil { vol.Status.Replicas = make([]stosv1.ReplicaDeploymentInfo, 0, len(*stosVol.Replicas)) for _, stosReplica := range *stosVol.Replicas {