restoreOrphanPVCs sets the owner metadata and re-actives the orphan pvcs
( ctx context.Context, c client.Client, cluster *apiv1.Cluster, pvcs []corev1.PersistentVolumeClaim, )
| 328 | |
| 329 | // restoreOrphanPVCs sets the owner metadata and re-actives the orphan pvcs |
| 330 | func restoreOrphanPVCs( |
| 331 | ctx context.Context, |
| 332 | c client.Client, |
| 333 | cluster *apiv1.Cluster, |
| 334 | pvcs []corev1.PersistentVolumeClaim, |
| 335 | ) error { |
| 336 | for i := range pvcs { |
| 337 | pvc := &pvcs[i] |
| 338 | if pvc.Annotations == nil { |
| 339 | pvc.Annotations = map[string]string{} |
| 340 | } |
| 341 | |
| 342 | pvcOrig := pvc.DeepCopy() |
| 343 | cluster.SetInheritedDataAndOwnership(&pvc.ObjectMeta) |
| 344 | pvc.Annotations[utils.PVCStatusAnnotationName] = persistentvolumeclaim.StatusReady |
| 345 | // we clean hibernation metadata if it exists |
| 346 | delete(pvc.Annotations, utils.HibernateClusterManifestAnnotationName) |
| 347 | delete(pvc.Annotations, utils.HibernatePgControlDataAnnotationName) |
| 348 | delete(pvc.Annotations, utils.ClusterManifestAnnotationName) |
| 349 | delete(pvc.Annotations, utils.PgControldataAnnotationName) |
| 350 | |
| 351 | if err := c.Patch(ctx, pvc, client.MergeFrom(pvcOrig)); err != nil { |
| 352 | return err |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | return nil |
| 357 | } |
| 358 | |
| 359 | func ensureInitContainersAreCompleted( |
| 360 | ctx context.Context, |
no test coverage detected