@@ -43,8 +43,9 @@ func (c *Creator) CreatePVC(
4343 // we are close to proper disk inheritance
4444 // Right now we hit the following error:
4545 // "Forbidden: updates to StatefulSet spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden"
46- Labels : c .macro .Scope (host ).Map (c .tagger .Label (interfaces .LabelNewPVC , host , false )),
47- Annotations : c .macro .Scope (host ).Map (c .tagger .Annotate (interfaces .AnnotateNewPVC , host )),
46+ Labels : c .macro .Scope (host ).Map (c .tagger .Label (interfaces .LabelNewPVC , host , false )),
47+ Annotations : c .macro .Scope (host ).Map (c .tagger .Annotate (interfaces .AnnotateNewPVC , host )),
48+ OwnerReferences : c .or .CreateOwnerReferences (c .cr ),
4849 },
4950 // Append copy of PersistentVolumeClaimSpec
5051 Spec : * spec .DeepCopy (),
@@ -65,6 +66,7 @@ func (c *Creator) TagPVC(
6566) * core.PersistentVolumeClaim {
6667 pvc .SetLabels (c .macro .Scope (host ).Map (c .tagger .Label (interfaces .LabelExistingPVC , pvc , host , template )))
6768 pvc .SetAnnotations (c .macro .Scope (host ).Map (c .tagger .Annotate (interfaces .AnnotateExistingPVC , pvc , host , template )))
69+ pvc .SetOwnerReferences (c .or .CreateOwnerReferences (c .cr ))
6870 // And after the object is ready we can put version label
6971 c .labeler .MakeObjectVersion (& pvc .ObjectMeta , pvc )
7072 return pvc
0 commit comments