Skip to content

Commit

Permalink
Pass DV labels to PVC
Browse files Browse the repository at this point in the history
Signed-off-by: Ido Aharon <iaharon@redhat.com>
  • Loading branch information
ido106 committed Jan 19, 2023
1 parent 0114d19 commit b875775
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions pkg/controller/datavolume/controller-base.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,21 +735,6 @@ func buildHTTPClient() *http.Client {
return httpClient
}

func passDataVolumeInstancetypeLabelstoPVC(dataVolumeLabels, pvcLabels map[string]string) map[string]string {
instancetypeLabels := []string{
cc.LabelDefaultInstancetype,
cc.LabelDefaultInstancetypeKind,
cc.LabelDefaultPreference,
cc.LabelDefaultPreferenceKind,
}
for _, label := range instancetypeLabels {
if dvLabel, hasLabel := dataVolumeLabels[label]; hasLabel {
pvcLabels[label] = dvLabel
}
}
return pvcLabels
}

// newPersistentVolumeClaim creates a new PVC for the DataVolume resource.
// It also sets the appropriate OwnerReferences on the resource
// which allows handleObject to discover the DataVolume resource
Expand All @@ -761,7 +746,9 @@ func (r *ReconcilerBase) newPersistentVolumeClaim(dataVolume *cdiv1.DataVolume,
if util.ResolveVolumeMode(targetPvcSpec.VolumeMode) == corev1.PersistentVolumeFilesystem {
labels[common.KubePersistentVolumeFillingUpSuppressLabelKey] = common.KubePersistentVolumeFillingUpSuppressLabelValue
}
labels = passDataVolumeInstancetypeLabelstoPVC(dataVolume.GetLabels(), labels)
for k, v := range dataVolume.Labels {
labels[k] = v
}

annotations := make(map[string]string)
for k, v := range dataVolume.ObjectMeta.Annotations {
Expand Down

0 comments on commit b875775

Please sign in to comment.