Skip to content

Commit

Permalink
Rewrites
Browse files Browse the repository at this point in the history
Rewrite pkg/util/sets
Rewrite pkg/apimachinery/registered
Rewrite pkg/client/restclient
Rewrite pkg/client/typed/discovery
Rewrite pkg/apimachinery
Rewrite pkg/apimachinery/announced
Rewrite pkg/client/unversioned/clientcmd
Rewrite pkg/api/unversioned/validation
Rewrite pkg/apiserver/request
Rewrite pkg/util/diff
Rewrite pkg/util/strategicpatch
Rewrite pkg/util/validation
Rewrite apimachinery/pkg/apis/meta/v1/unstructured
Rewrite pkg/api/errors
Rewrite pkg/fields
Rewrite apimachinery/pkg/runtime/schema
Rewrite apimachinery meta packages
Rewrite metav1.ObjectMeta
Rewrite k8s.io/{kubernetes -> apimachinery}/pkg/util/runtime
Rewrite k8s.io/{kubernetes -> apimachinery}/pkg/util/intstr
Rewrite k8s.io/{kubernetes -> apimachinery}/pkg/util/wait
Rewrite k8s.io/{kubernetes -> apimachinery}/pkg/api/resource
Rewrite k8s.io/{kubernetes -> apimachinery}/pkg/util/errors
Rewrite k8s.io/{kubernetes -> apiserver}/pkg/storage/etcd/util
Rewrite k8s.io/{kubernetes -> apimachinery}/pkg/util/net
Rewrite k8s.io/apiserver/pkg/authentication/user
Rewrite k8s.io/client-go/util/flowcontrol
Rewrite k8s.io/apiserver/pkg/storage
Rewrite k8s.io/apiserver/pkg/registry/generic/registry
Rewrite k8s.io/apiserver/pkg/registry/rest
Rewrite meta*.*Options
  • Loading branch information
Andy Goldstein authored and deads2k committed Apr 27, 2017
1 parent 5cac278 commit a71e6f1
Show file tree
Hide file tree
Showing 1,671 changed files with 14,294 additions and 13,044 deletions.
14 changes: 8 additions & 6 deletions examples/examples_test.go
Expand Up @@ -8,12 +8,14 @@ import (
"testing"

"github.com/golang/glog"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/yaml"
apirequest "k8s.io/apiserver/pkg/endpoints/request"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
kvalidation "k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/yaml"

"github.com/openshift/origin/pkg/api/validation"
buildapi "github.com/openshift/origin/pkg/build/api"
Expand All @@ -32,7 +34,7 @@ import (

type mockService struct{}

func (mockService) ListServices(kapi.Context) (*kapi.ServiceList, error) {
func (mockService) ListServices(apirequest.Context) (*kapi.ServiceList, error) {
return &kapi.ServiceList{}, nil
}

Expand Down Expand Up @@ -177,13 +179,13 @@ func validateObject(path string, obj runtime.Object, t *testing.T) {
}

if namespaceRequired {
objectMeta, objectMetaErr := kapi.ObjectMetaFor(obj)
objectMeta, objectMetaErr := metav1.ObjectMetaFor(obj)
if objectMetaErr != nil {
t.Errorf("Expected no error, Got %v", objectMetaErr)
return
}

objectMeta.Namespace = kapi.NamespaceDefault
objectMeta.Namespace = metav1.NamespaceDefault
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/statefulsets/peer-finder/peer-finder.go
Expand Up @@ -28,7 +28,7 @@ import (
"strings"
"time"

"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
)

const (
Expand Down
12 changes: 6 additions & 6 deletions pkg/api/compatibility_test.go
Expand Up @@ -9,11 +9,11 @@ import (
"strings"
"testing"

"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/validation/field"
)

func TestCompatibility_v1_Pod(t *testing.T) {
Expand Down Expand Up @@ -136,7 +136,7 @@ func testCompatibility(
}

// Encode
output := runtime.EncodeOrDie(api.Codecs.LegacyCodec(unversioned.GroupVersion{Group: "", Version: version}), obj)
output := runtime.EncodeOrDie(api.Codecs.LegacyCodec(schema.GroupVersion{Group: "", Version: version}), obj)

// Validate old and new fields are encoded
generic := map[string]interface{}{}
Expand All @@ -154,14 +154,14 @@ func testCompatibility(
}

func TestAllowedGrouplessVersion(t *testing.T) {
versions := map[string]unversioned.GroupVersion{
versions := map[string]schema.GroupVersion{
"v1": {Group: "", Version: "v1"},
"v1beta3": {Group: "", Version: "v1beta3"},
"1.0": {Group: "", Version: "1.0"},
"pre012": {Group: "", Version: "pre012"},
}
for apiVersion, expectedGroupVersion := range versions {
groupVersion, err := unversioned.ParseGroupVersion(apiVersion)
groupVersion, err := schema.ParseGroupVersion(apiVersion)
if err != nil {
t.Errorf("%s: unexpected error parsing: %v", apiVersion, err)
continue
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/conversion.go
@@ -1,9 +1,9 @@
package api

import (
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"

"github.com/openshift/origin/pkg/api/extension"
)
Expand Down
9 changes: 5 additions & 4 deletions pkg/api/extension/extension.go
Expand Up @@ -3,8 +3,9 @@ package extension
import (
"fmt"

"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
)

// Convert_runtime_Object_To_runtime_RawExtension attempts to convert runtime.Objects to the appropriate target, returning an error
Expand All @@ -16,7 +17,7 @@ func Convert_runtime_Object_To_runtime_RawExtension(c runtime.ObjectConvertor, i
obj := *in

switch obj.(type) {
case *runtime.Unknown, *runtime.Unstructured:
case *runtime.Unknown, *unstructured.Unstructured:
out.Raw = nil
out.Object = obj
return nil
Expand Down Expand Up @@ -44,7 +45,7 @@ func Convert_runtime_RawExtension_To_runtime_Object(c runtime.ObjectConvertor, i
}

switch in.Object.(type) {
case *runtime.Unknown, *runtime.Unstructured:
case *runtime.Unknown, *unstructured.Unstructured:
*out = in.Object
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/graph/graph.go
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/gonum/graph/concrete"
"github.com/gonum/graph/encoding/dot"

"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/util/sets"
)

type Node struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/graph/graphview/intset.go
Expand Up @@ -3,7 +3,7 @@ package graphview
import (
"sort"

"k8s.io/kubernetes/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
)

type IntSet map[int]sets.Empty
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/graph/graphview/rc.go
@@ -1,7 +1,7 @@
package graphview

import (
"k8s.io/kubernetes/pkg/api/unversioned"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

osgraph "github.com/openshift/origin/pkg/api/graph"
kubeedges "github.com/openshift/origin/pkg/api/kubegraph"
Expand Down Expand Up @@ -43,7 +43,7 @@ func (rc *ReplicationController) MaxRecentContainerRestarts() int32 {
var maxRestarts int32
for _, pod := range rc.OwnedPods {
for _, status := range pod.Status.ContainerStatuses {
if status.RestartCount > maxRestarts && analysis.ContainerRestartedRecently(status, unversioned.Now()) {
if status.RestartCount > maxRestarts && analysis.ContainerRestartedRecently(status, metav1.Now()) {
maxRestarts = status.RestartCount
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/graph/graphview/service_group.go
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"sort"

kapi "k8s.io/kubernetes/pkg/api"
utilruntime "k8s.io/kubernetes/pkg/util/runtime"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"

osgraph "github.com/openshift/origin/pkg/api/graph"
kubeedges "github.com/openshift/origin/pkg/api/kubegraph"
Expand Down Expand Up @@ -126,7 +126,7 @@ func (m ServiceGroupByObjectMeta) Less(i, j int) bool {
return CompareObjectMeta(&a.Service.Service.ObjectMeta, &b.Service.Service.ObjectMeta)
}

func CompareObjectMeta(a, b *kapi.ObjectMeta) bool {
func CompareObjectMeta(a, b *metav1.ObjectMeta) bool {
if a.Namespace == b.Namespace {
return a.Name < b.Name
}
Expand Down
34 changes: 17 additions & 17 deletions pkg/api/graph/graphview/veneering_test.go
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/gonum/graph"
"github.com/gonum/graph/concrete"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"

osgraph "github.com/openshift/origin/pkg/api/graph"
osgraphtest "github.com/openshift/origin/pkg/api/graph/test"
Expand Down Expand Up @@ -189,30 +189,30 @@ func TestGraph(t *testing.T) {
now := time.Now()
builds := []buildapi.Build{
{
ObjectMeta: kapi.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "build1-1-abc",
Labels: map[string]string{buildapi.BuildConfigLabelDeprecated: "build1"},
CreationTimestamp: unversioned.NewTime(now.Add(-10 * time.Second)),
CreationTimestamp: metav1.NewTime(now.Add(-10 * time.Second)),
},
Status: buildapi.BuildStatus{
Phase: buildapi.BuildPhaseFailed,
},
},
{
ObjectMeta: kapi.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "build1-2-abc",
Labels: map[string]string{buildapi.BuildConfigLabelDeprecated: "build1"},
CreationTimestamp: unversioned.NewTime(now.Add(-5 * time.Second)),
CreationTimestamp: metav1.NewTime(now.Add(-5 * time.Second)),
},
Status: buildapi.BuildStatus{
Phase: buildapi.BuildPhaseComplete,
},
},
{
ObjectMeta: kapi.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "build1-3-abc",
Labels: map[string]string{buildapi.BuildConfigLabelDeprecated: "build1"},
CreationTimestamp: unversioned.NewTime(now.Add(-15 * time.Second)),
CreationTimestamp: metav1.NewTime(now.Add(-15 * time.Second)),
},
Status: buildapi.BuildStatus{
Phase: buildapi.BuildPhasePending,
Expand All @@ -224,7 +224,7 @@ func TestGraph(t *testing.T) {
}

buildgraph.EnsureBuildConfigNode(g, &buildapi.BuildConfig{
ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "build1"},
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "build1"},
Spec: buildapi.BuildConfigSpec{
Triggers: []buildapi.BuildTriggerPolicy{
{
Expand All @@ -244,7 +244,7 @@ func TestGraph(t *testing.T) {
},
})
bcTestNode := buildgraph.EnsureBuildConfigNode(g, &buildapi.BuildConfig{
ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "test"},
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "test"},
Spec: buildapi.BuildConfigSpec{
CommonSpec: buildapi.CommonSpec{
Output: buildapi.BuildOutput{
Expand All @@ -254,7 +254,7 @@ func TestGraph(t *testing.T) {
},
})
buildgraph.EnsureBuildConfigNode(g, &buildapi.BuildConfig{
ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "build2"},
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "build2"},
Spec: buildapi.BuildConfigSpec{
CommonSpec: buildapi.CommonSpec{
Output: buildapi.BuildOutput{
Expand All @@ -264,21 +264,21 @@ func TestGraph(t *testing.T) {
},
})
kubegraph.EnsureServiceNode(g, &kapi.Service{
ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "svc-is-ignored"},
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "svc-is-ignored"},
Spec: kapi.ServiceSpec{
Selector: nil,
},
})
kubegraph.EnsureServiceNode(g, &kapi.Service{
ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "svc1"},
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "svc1"},
Spec: kapi.ServiceSpec{
Selector: map[string]string{
"deploymentconfig": "deploy1",
},
},
})
kubegraph.EnsureServiceNode(g, &kapi.Service{
ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "svc2"},
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "svc2"},
Spec: kapi.ServiceSpec{
Selector: map[string]string{
"deploymentconfig": "deploy1",
Expand All @@ -287,7 +287,7 @@ func TestGraph(t *testing.T) {
},
})
deploygraph.EnsureDeploymentConfigNode(g, &deployapi.DeploymentConfig{
ObjectMeta: kapi.ObjectMeta{Namespace: "other", Name: "deploy1"},
ObjectMeta: metav1.ObjectMeta{Namespace: "other", Name: "deploy1"},
Spec: deployapi.DeploymentConfigSpec{
Triggers: []deployapi.DeploymentTriggerPolicy{
{
Expand All @@ -298,7 +298,7 @@ func TestGraph(t *testing.T) {
},
},
Template: &kapi.PodTemplateSpec{
ObjectMeta: kapi.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"deploymentconfig": "deploy1",
"env": "prod",
Expand All @@ -324,10 +324,10 @@ func TestGraph(t *testing.T) {
},
})
deploygraph.EnsureDeploymentConfigNode(g, &deployapi.DeploymentConfig{
ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "deploy2"},
ObjectMeta: metav1.ObjectMeta{Namespace: "default", Name: "deploy2"},
Spec: deployapi.DeploymentConfigSpec{
Template: &kapi.PodTemplateSpec{
ObjectMeta: kapi.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"deploymentconfig": "deploy2",
"env": "dev",
Expand Down
7 changes: 3 additions & 4 deletions pkg/api/graph/test/runtimeobject_nodebuilder.go
Expand Up @@ -5,12 +5,11 @@ import (
"path/filepath"
"reflect"

"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/apis/autoscaling"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/kubernetes/pkg/runtime"

osgraph "github.com/openshift/origin/pkg/api/graph"
_ "github.com/openshift/origin/pkg/api/install"
Expand Down Expand Up @@ -130,7 +129,7 @@ func BuildGraph(path string) (osgraph.Graph, []runtime.Object, error) {
return g, objs, err
}

mapper := registered.RESTMapper()
mapper := kapi.Registry.RESTMapper()
typer := kapi.Scheme
clientMapper := resource.ClientMapperFunc(func(mapping *meta.RESTMapping) (resource.RESTClient, error) {
return nil, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/graph/types.go
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/gonum/graph"

kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/runtime"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)

const (
Expand All @@ -24,7 +24,7 @@ const (
)

func GetUniqueRuntimeObjectNodeName(nodeKind string, obj runtime.Object) UniqueName {
meta, err := kapi.ObjectMetaFor(obj)
meta, err := metav1.ObjectMetaFor(obj)
if err != nil {
panic(err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/helpers.go
Expand Up @@ -3,9 +3,9 @@ package api
import (
"fmt"

kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/apimachinery/pkg/api/validation/path"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/api/validation/path"
)

// GetNameValidationFunc returns a name validation function that includes the standard restrictions we want for all types
Expand Down Expand Up @@ -38,6 +38,6 @@ func GetFieldLabelConversionFunc(supportedLabels map[string]string, overrideLabe
// GetResourceKey returns a string of the form [namespace]/[name] for
// the given resource. This is a common way of ensuring a key for a
// resource that is unique across the cluster.
func GetResourceKey(obj kapi.ObjectMeta) string {
func GetResourceKey(obj metav1.ObjectMeta) string {
return fmt.Sprintf("%s/%s", obj.Namespace, obj.Name)
}

0 comments on commit a71e6f1

Please sign in to comment.