Skip to content

Commit

Permalink
Pass provisionOnNode annotation to PVC if on data volume.
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Wels <awels@redhat.com>
  • Loading branch information
awels committed Jul 30, 2019
1 parent e85a66c commit d2d92a4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/datavolume-controller.go
Expand Up @@ -939,6 +939,10 @@ func newPersistentVolumeClaim(dataVolume *cdiv1.DataVolume) (*corev1.PersistentV

annotations := make(map[string]string)

for k, v := range dataVolume.ObjectMeta.Annotations {
annotations[k] = v
}

if dataVolume.Spec.Source.HTTP != nil {
annotations[AnnEndpoint] = dataVolume.Spec.Source.HTTP.URL
annotations[AnnSource] = SourceHTTP
Expand Down
14 changes: 14 additions & 0 deletions pkg/controller/datavolume-controller_test.go
Expand Up @@ -810,6 +810,20 @@ func TestBlankImageClaimLost(t *testing.T) {

}

func TestAnnotationPassThrough(t *testing.T) {
dataVolume := newBlankImageDataVolume("blank-image-datavolume")
dataVolume.ObjectMeta.Annotations = make(map[string]string)
dataVolume.ObjectMeta.Annotations["testannotation"] = "testvalue"
pvc, _ := newPersistentVolumeClaim(dataVolume)
if val, ok := pvc.ObjectMeta.Annotations["testannotation"]; ok {
if val != "testvalue" {
t.Errorf("Annotation value %s doesn't match [testvalue]", val)
}
} else {
t.Errorf("Test annotation not found in PVC spec")
}
}

// Smart-clone test
func TestSmartCloneNoPVCSource(t *testing.T) {
f := newFixtureCsiCrds(t)
Expand Down

0 comments on commit d2d92a4

Please sign in to comment.