@@ -10,19 +10,20 @@ import (
10
10
"github.com/docker/distribution/registry/api/errcode"
11
11
"github.com/golang/glog"
12
12
13
+ corev1 "k8s.io/api/core/v1"
13
14
kmeta "k8s.io/apimachinery/pkg/api/meta"
14
15
"k8s.io/apimachinery/pkg/runtime"
15
16
kerrors "k8s.io/apimachinery/pkg/util/errors"
17
+ ref "k8s.io/client-go/tools/reference"
16
18
"k8s.io/kubernetes/pkg/api/legacyscheme"
17
- kapiref "k8s.io/kubernetes/pkg/api/ref"
18
- kapi "k8s.io/kubernetes/pkg/apis/core"
19
19
20
+ imagev1 "github.com/openshift/api/image/v1"
20
21
imageapi "github.com/openshift/origin/pkg/image/apis/image"
21
22
"github.com/openshift/origin/pkg/util/netutils"
22
23
)
23
24
24
25
// order younger images before older
25
- type imgByAge []* imageapi .Image
26
+ type imgByAge []* imagev1 .Image
26
27
27
28
func (ba imgByAge ) Len () int { return len (ba ) }
28
29
func (ba imgByAge ) Swap (i , j int ) { ba [i ], ba [j ] = ba [j ], ba [i ] }
@@ -31,7 +32,7 @@ func (ba imgByAge) Less(i, j int) bool {
31
32
}
32
33
33
34
// order younger image stream before older
34
- type isByAge []imageapi .ImageStream
35
+ type isByAge []imagev1 .ImageStream
35
36
36
37
func (ba isByAge ) Len () int { return len (ba ) }
37
38
func (ba isByAge ) Swap (i , j int ) { ba [i ], ba [j ] = ba [j ], ba [i ] }
@@ -41,9 +42,9 @@ func (ba isByAge) Less(i, j int) bool {
41
42
42
43
// DetermineRegistryHost returns registry host embedded in a pull-spec of the latest unmanaged image or the
43
44
// latest imagestream from the provided lists. If no such pull-spec is found, error is returned.
44
- func DetermineRegistryHost (images * imageapi .ImageList , imageStreams * imageapi .ImageStreamList ) (string , error ) {
45
+ func DetermineRegistryHost (images * imagev1 .ImageList , imageStreams * imagev1 .ImageStreamList ) (string , error ) {
45
46
var pullSpec string
46
- var managedImages []* imageapi .Image
47
+ var managedImages []* imagev1 .Image
47
48
48
49
// 1st try to determine registry url from a pull spec of the youngest managed image
49
50
for i := range images .Items {
@@ -223,7 +224,7 @@ type ErrBadReference struct {
223
224
reason string
224
225
}
225
226
226
- func newErrBadReferenceToImage (reference string , obj * kapi .ObjectReference , reason string ) error {
227
+ func newErrBadReferenceToImage (reference string , obj * corev1 .ObjectReference , reason string ) error {
227
228
kind := "<UnknownType>"
228
229
namespace := ""
229
230
name := "<unknown-name>"
@@ -242,7 +243,7 @@ func newErrBadReferenceToImage(reference string, obj *kapi.ObjectReference, reas
242
243
}
243
244
}
244
245
245
- func newErrBadReferenceTo (targetKind , reference string , obj * kapi .ObjectReference , reason string ) error {
246
+ func newErrBadReferenceTo (targetKind , reference string , obj * corev1 .ObjectReference , reason string ) error {
246
247
return & ErrBadReference {
247
248
kind : obj .Kind ,
248
249
namespace : obj .Namespace ,
@@ -282,7 +283,7 @@ func getName(obj runtime.Object) string {
282
283
return fmt .Sprintf ("%s/%s" , ns , accessor .GetName ())
283
284
}
284
285
285
- func getKindName (obj * kapi .ObjectReference ) string {
286
+ func getKindName (obj * corev1 .ObjectReference ) string {
286
287
if obj == nil {
287
288
return "unknown object"
288
289
}
@@ -293,8 +294,8 @@ func getKindName(obj *kapi.ObjectReference) string {
293
294
return fmt .Sprintf ("%s[%s]" , obj .Kind , name )
294
295
}
295
296
296
- func getRef (obj runtime.Object ) * kapi .ObjectReference {
297
- ref , err := kapiref .GetReference (legacyscheme .Scheme , obj )
297
+ func getRef (obj runtime.Object ) * corev1 .ObjectReference {
298
+ ref , err := ref .GetReference (legacyscheme .Scheme , obj )
298
299
if err != nil {
299
300
glog .Errorf ("failed to get reference to object %T: %v" , obj , err )
300
301
return nil
0 commit comments