Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
soltysh committed Aug 10, 2018
1 parent 5ef0246 commit ae911b5
Show file tree
Hide file tree
Showing 48 changed files with 741 additions and 719 deletions.
4 changes: 2 additions & 2 deletions pkg/apps/metrics/prometheus/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
kcorelisters "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"

appsapi "github.com/openshift/origin/pkg/apps/apis/apps"
appsutil "github.com/openshift/origin/pkg/apps/util"
)

var (
Expand All @@ -24,7 +24,7 @@ var (

func mockRC(name string, version int, annotations map[string]string, generation int64, creationTime metav1.Time) *kapiv1.ReplicationController {
r := &kapiv1.ReplicationController{}
annotations[appsapi.DeploymentConfigAnnotation] = name
annotations[appsutil.DeploymentConfigAnnotation] = name
r.SetName(name + fmt.Sprintf("-%d", version))
r.SetNamespace("test")
r.SetCreationTimestamp(creationTime)
Expand Down
2 changes: 1 addition & 1 deletion pkg/build/controller/policy/serial_latest_only.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (s *SerialLatestOnlyPolicy) cancelPreviousBuilds(build *buildapi.Build) []e
builds, err := buildutil.BuildConfigBuilds(s.BuildLister, build.Namespace, bcName, func(b *buildapi.Build) bool {
// Do not cancel the complete builds, builds that were already cancelled, or
// running builds.
if buildutil.IsBuildComplete(b) || b.Status.Phase == buildapi.BuildPhaseRunning {
if buildutil.IsBuildCompleteInternal(b) || b.Status.Phase == buildapi.BuildPhaseRunning {
return false
}

Expand Down
23 changes: 12 additions & 11 deletions pkg/oc/cli/admin/prune/imageprune/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ import (
"github.com/docker/distribution/registry/api/errcode"
"github.com/golang/glog"

corev1 "k8s.io/api/core/v1"
kmeta "k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
kerrors "k8s.io/apimachinery/pkg/util/errors"
ref "k8s.io/client-go/tools/reference"
"k8s.io/kubernetes/pkg/api/legacyscheme"
kapiref "k8s.io/kubernetes/pkg/api/ref"
kapi "k8s.io/kubernetes/pkg/apis/core"

imagev1 "github.com/openshift/api/image/v1"
imageapi "github.com/openshift/origin/pkg/image/apis/image"
"github.com/openshift/origin/pkg/util/netutils"
)

// order younger images before older
type imgByAge []*imageapi.Image
type imgByAge []*imagev1.Image

func (ba imgByAge) Len() int { return len(ba) }
func (ba imgByAge) Swap(i, j int) { ba[i], ba[j] = ba[j], ba[i] }
Expand All @@ -31,7 +32,7 @@ func (ba imgByAge) Less(i, j int) bool {
}

// order younger image stream before older
type isByAge []imageapi.ImageStream
type isByAge []imagev1.ImageStream

func (ba isByAge) Len() int { return len(ba) }
func (ba isByAge) Swap(i, j int) { ba[i], ba[j] = ba[j], ba[i] }
Expand All @@ -41,9 +42,9 @@ func (ba isByAge) Less(i, j int) bool {

// DetermineRegistryHost returns registry host embedded in a pull-spec of the latest unmanaged image or the
// latest imagestream from the provided lists. If no such pull-spec is found, error is returned.
func DetermineRegistryHost(images *imageapi.ImageList, imageStreams *imageapi.ImageStreamList) (string, error) {
func DetermineRegistryHost(images *imagev1.ImageList, imageStreams *imagev1.ImageStreamList) (string, error) {
var pullSpec string
var managedImages []*imageapi.Image
var managedImages []*imagev1.Image

// 1st try to determine registry url from a pull spec of the youngest managed image
for i := range images.Items {
Expand Down Expand Up @@ -223,7 +224,7 @@ type ErrBadReference struct {
reason string
}

func newErrBadReferenceToImage(reference string, obj *kapi.ObjectReference, reason string) error {
func newErrBadReferenceToImage(reference string, obj *corev1.ObjectReference, reason string) error {
kind := "<UnknownType>"
namespace := ""
name := "<unknown-name>"
Expand All @@ -242,7 +243,7 @@ func newErrBadReferenceToImage(reference string, obj *kapi.ObjectReference, reas
}
}

func newErrBadReferenceTo(targetKind, reference string, obj *kapi.ObjectReference, reason string) error {
func newErrBadReferenceTo(targetKind, reference string, obj *corev1.ObjectReference, reason string) error {
return &ErrBadReference{
kind: obj.Kind,
namespace: obj.Namespace,
Expand Down Expand Up @@ -282,7 +283,7 @@ func getName(obj runtime.Object) string {
return fmt.Sprintf("%s/%s", ns, accessor.GetName())
}

func getKindName(obj *kapi.ObjectReference) string {
func getKindName(obj *corev1.ObjectReference) string {
if obj == nil {
return "unknown object"
}
Expand All @@ -293,8 +294,8 @@ func getKindName(obj *kapi.ObjectReference) string {
return fmt.Sprintf("%s[%s]", obj.Kind, name)
}

func getRef(obj runtime.Object) *kapi.ObjectReference {
ref, err := kapiref.GetReference(legacyscheme.Scheme, obj)
func getRef(obj runtime.Object) *corev1.ObjectReference {
ref, err := ref.GetReference(legacyscheme.Scheme, obj)
if err != nil {
glog.Errorf("failed to get reference to object %T: %v", obj, err)
return nil
Expand Down
Loading

0 comments on commit ae911b5

Please sign in to comment.