@@ -17,6 +17,7 @@ import (
17
17
imagev1 "github.com/openshift/api/image/v1"
18
18
imagev1lister "github.com/openshift/client-go/image/listers/image/v1"
19
19
imageapi "github.com/openshift/origin/pkg/image/apis/image"
20
+ imagev1conversions "github.com/openshift/origin/pkg/image/apis/image/v1"
20
21
)
21
22
22
23
var imageStreamImportResources = []kapi.ResourceName {
@@ -38,7 +39,9 @@ func NewImageStreamImportEvaluator(store imagev1lister.ImageStreamLister) kquota
38
39
39
40
// Constraints checks that given object is an image stream import.
40
41
func (i * imageStreamImportEvaluator ) Constraints (required []kapi.ResourceName , object runtime.Object ) error {
41
- if _ , ok := object .(* imagev1.ImageStreamImport ); ! ok {
42
+ _ , okInt := object .(* imageapi.ImageStreamImport )
43
+ _ , okExt := object .(* imagev1.ImageStreamImport )
44
+ if ! okInt && ! okExt {
42
45
return fmt .Errorf ("unexpected input object %v" , object )
43
46
}
44
47
return nil
@@ -70,6 +73,13 @@ func (i *imageStreamImportEvaluator) MatchingResources(input []kapi.ResourceName
70
73
}
71
74
72
75
func (i * imageStreamImportEvaluator ) Usage (item runtime.Object ) (kapi.ResourceList , error ) {
76
+ if isiInternal , ok := item .(* imageapi.ImageStreamImport ); ok {
77
+ out := & imagev1.ImageStreamImport {}
78
+ if err := imagev1conversions .Convert_image_ImageStreamImport_To_v1_ImageStreamImport (isiInternal , out , nil ); err != nil {
79
+ return kapi.ResourceList {}, fmt .Errorf ("error converting ImageStreamImport: %v" , err )
80
+ }
81
+ item = out
82
+ }
73
83
isi , ok := item .(* imagev1.ImageStreamImport )
74
84
if ! ok {
75
85
return kapi.ResourceList {}, fmt .Errorf ("item is not an ImageStreamImport: %T" , item )
0 commit comments