Skip to content

Commit 5597afa

Browse files
authored
fix(observer): fixed unexpected deletion of pvcs in other k8s when it has independent lifecycle (#592)
1 parent d394281 commit 5597afa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/resource/observer/utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,11 @@ func (m *OBServerManager) cleanWorkerK8sResource() error {
663663
}
664664
}
665665

666+
if val, exist := resourceutils.GetAnnotationField(m.OBServer, oceanbaseconst.AnnotationsIndependentPVCLifecycle); exist && val == "true" {
667+
m.Logger.Info("Independent PVC lifecycle, skip deleting pvc")
668+
return errs
669+
}
670+
666671
// delete pvc
667672
pvc := &corev1.PersistentVolumeClaim{}
668673
if err := m.K8sResClient.DeleteAllOf(m.Ctx, pvc,

0 commit comments

Comments
 (0)