Skip to content

Commit 86bcb4b

Browse files
authored
Merge pull request #1837 from fkywong/fix-pvc-ownerReferences
Fix missing ownerReferences in pvc metadata
2 parents 5d7bf0b + 25af351 commit 86bcb4b

File tree

1 file changed

+4
-2
lines changed
  • pkg/model/common/creator

1 file changed

+4
-2
lines changed

pkg/model/common/creator/pvc.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)