Vendor: Update k8s version

Signed-off-by: Michał Żyłowski <michal.zylowski@intel.com>
This commit is contained in:
Michał Żyłowski 2017-02-03 14:41:32 +01:00
parent dfa93414c5
commit 52baf68d50
3756 changed files with 113013 additions and 92675 deletions

View file

@ -16,6 +16,7 @@ go_library(
"//pkg/api:go_default_library",
"//pkg/api/v1:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/api/meta",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/watch",
@ -30,6 +31,7 @@ go_test(
deps = [
"//pkg/api:go_default_library",
"//pkg/api/v1:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/watch",
],
)

View file

@ -23,6 +23,7 @@ import (
"sync"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
@ -114,7 +115,7 @@ func (f *FakeControllerSource) DeleteDropWatch(lastValue runtime.Object) {
f.Change(watch.Event{Type: watch.Deleted, Object: lastValue}, 0)
}
func (f *FakeControllerSource) key(accessor meta.Object) nnu {
func (f *FakeControllerSource) key(accessor metav1.Object) nnu {
return nnu{accessor.GetNamespace(), accessor.GetName(), accessor.GetUID()}
}
@ -162,7 +163,7 @@ func (f *FakeControllerSource) getListItemsLocked() ([]runtime.Object, error) {
}
// List returns a list object, with its resource version set.
func (f *FakeControllerSource) List(options v1.ListOptions) (runtime.Object, error) {
func (f *FakeControllerSource) List(options metav1.ListOptions) (runtime.Object, error) {
f.lock.RLock()
defer f.lock.RUnlock()
list, err := f.getListItemsLocked()
@ -173,7 +174,7 @@ func (f *FakeControllerSource) List(options v1.ListOptions) (runtime.Object, err
if err := meta.SetList(listObj, list); err != nil {
return nil, err
}
objMeta, err := api.ListMetaFor(listObj)
objMeta, err := metav1.ListMetaFor(listObj)
if err != nil {
return nil, err
}
@ -183,7 +184,7 @@ func (f *FakeControllerSource) List(options v1.ListOptions) (runtime.Object, err
}
// List returns a list object, with its resource version set.
func (f *FakePVControllerSource) List(options v1.ListOptions) (runtime.Object, error) {
func (f *FakePVControllerSource) List(options metav1.ListOptions) (runtime.Object, error) {
f.lock.RLock()
defer f.lock.RUnlock()
list, err := f.FakeControllerSource.getListItemsLocked()
@ -194,7 +195,7 @@ func (f *FakePVControllerSource) List(options v1.ListOptions) (runtime.Object, e
if err := meta.SetList(listObj, list); err != nil {
return nil, err
}
objMeta, err := api.ListMetaFor(listObj)
objMeta, err := metav1.ListMetaFor(listObj)
if err != nil {
return nil, err
}
@ -204,7 +205,7 @@ func (f *FakePVControllerSource) List(options v1.ListOptions) (runtime.Object, e
}
// List returns a list object, with its resource version set.
func (f *FakePVCControllerSource) List(options v1.ListOptions) (runtime.Object, error) {
func (f *FakePVCControllerSource) List(options metav1.ListOptions) (runtime.Object, error) {
f.lock.RLock()
defer f.lock.RUnlock()
list, err := f.FakeControllerSource.getListItemsLocked()
@ -215,7 +216,7 @@ func (f *FakePVCControllerSource) List(options v1.ListOptions) (runtime.Object,
if err := meta.SetList(listObj, list); err != nil {
return nil, err
}
objMeta, err := api.ListMetaFor(listObj)
objMeta, err := metav1.ListMetaFor(listObj)
if err != nil {
return nil, err
}
@ -226,7 +227,7 @@ func (f *FakePVCControllerSource) List(options v1.ListOptions) (runtime.Object,
// Watch returns a watch, which will be pre-populated with all changes
// after resourceVersion.
func (f *FakeControllerSource) Watch(options v1.ListOptions) (watch.Interface, error) {
func (f *FakeControllerSource) Watch(options metav1.ListOptions) (watch.Interface, error) {
f.lock.RLock()
defer f.lock.RUnlock()
rc, err := strconv.Atoi(options.ResourceVersion)

View file

@ -20,6 +20,7 @@ import (
"sync"
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"
@ -51,7 +52,7 @@ func consume(t *testing.T, w watch.Interface, rvs []string, done *sync.WaitGroup
func TestRCNumber(t *testing.T) {
pod := func(name string) *v1.Pod {
return &v1.Pod{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
}
@ -65,13 +66,13 @@ func TestRCNumber(t *testing.T) {
source.Modify(pod("foo"))
source.Modify(pod("foo"))
w, err := source.Watch(v1.ListOptions{ResourceVersion: "1"})
w, err := source.Watch(metav1.ListOptions{ResourceVersion: "1"})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
go consume(t, w, []string{"2", "3"}, wg)
list, err := source.List(v1.ListOptions{})
list, err := source.List(metav1.ListOptions{})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
@ -79,13 +80,13 @@ func TestRCNumber(t *testing.T) {
t.Errorf("wanted %v, got %v", e, a)
}
w2, err := source.Watch(v1.ListOptions{ResourceVersion: "2"})
w2, err := source.Watch(metav1.ListOptions{ResourceVersion: "2"})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
go consume(t, w2, []string{"3"}, wg)
w3, err := source.Watch(v1.ListOptions{ResourceVersion: "3"})
w3, err := source.Watch(metav1.ListOptions{ResourceVersion: "3"})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}

View file

@ -18,17 +18,17 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/fields:go_default_library",
"//pkg/version:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/api/errors",
"//vendor:k8s.io/apimachinery/pkg/api/meta",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/fields",
"//vendor:k8s.io/apimachinery/pkg/labels",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime/schema",
"//vendor:k8s.io/apimachinery/pkg/version",
"//vendor:k8s.io/apimachinery/pkg/watch",
"//vendor:k8s.io/client-go/rest",
],
)

View file

@ -21,12 +21,11 @@ import (
"path"
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/fields"
)
func NewRootGetAction(resource schema.GroupVersionResource, name string) GetActionImpl {
@ -224,22 +223,18 @@ func NewRootWatchAction(resource schema.GroupVersionResource, opts interface{})
func ExtractFromListOptions(opts interface{}) (labelSelector labels.Selector, fieldSelector fields.Selector, resourceVersion string) {
var err error
switch t := opts.(type) {
case api.ListOptions:
labelSelector = t.LabelSelector
fieldSelector = t.FieldSelector
resourceVersion = t.ResourceVersion
case v1.ListOptions:
case metav1.ListOptions:
labelSelector, err = labels.Parse(t.LabelSelector)
if err != nil {
panic(err)
panic(fmt.Errorf("invalid selector %q: %v", t.LabelSelector, err))
}
fieldSelector, err = fields.ParseSelector(t.FieldSelector)
if err != nil {
panic(err)
panic(fmt.Errorf("invalid selector %q: %v", t.FieldSelector, err))
}
resourceVersion = t.ResourceVersion
default:
panic(fmt.Errorf("expect a ListOptions"))
panic(fmt.Errorf("expect a ListOptions %T", opts))
}
if labelSelector == nil {
labelSelector = labels.Everything()

View file

@ -23,9 +23,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/version"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/version"
restclient "k8s.io/client-go/rest"
kubeversion "k8s.io/kubernetes/pkg/version"
)
// Fake implements client.Interface. Meant to be embedded into a struct to get
@ -253,6 +254,6 @@ func (c *FakeDiscovery) ServerVersion() (*version.Info, error) {
action.Resource = schema.GroupVersionResource{Resource: "version"}
c.Invokes(action, nil)
versionInfo := version.Get()
versionInfo := kubeversion.Get()
return &versionInfo, nil
}

View file

@ -35,7 +35,7 @@ func TestFakeClientSetFiltering(t *testing.T) {
testSA("nsB", "sa-3"),
)
saList1, err := tc.Core().ServiceAccounts("nsA").List(api.ListOptions{})
saList1, err := tc.Core().ServiceAccounts("nsA").List(metav1.ListOptions{})
if err != nil {
t.Fatalf("ServiceAccounts.List: %s", err)
}
@ -48,7 +48,7 @@ func TestFakeClientSetFiltering(t *testing.T) {
}
}
saList2, err := tc.Core().ServiceAccounts("nsB").List(api.ListOptions{})
saList2, err := tc.Core().ServiceAccounts("nsB").List(metav1.ListOptions{})
if err != nil {
t.Fatalf("ServiceAccounts.List: %s", err)
}
@ -77,7 +77,7 @@ func TestFakeClientSetFiltering(t *testing.T) {
t.Fatalf("Pods.Get: expected nsB/pod-1 not to match, but it matched %s/%s", wrongPod.Namespace, wrongPod.Name)
}
allPods, err := tc.Core().Pods(api.NamespaceAll).List(api.ListOptions{})
allPods, err := tc.Core().Pods(metav1.NamespaceAll).List(metav1.ListOptions{})
if err != nil {
t.Fatalf("Pods.List: %s", err)
}
@ -85,7 +85,7 @@ func TestFakeClientSetFiltering(t *testing.T) {
t.Fatalf("Expected %d pods to match, got %d", expected, actual)
}
allSAs, err := tc.Core().ServiceAccounts(api.NamespaceAll).List(api.ListOptions{})
allSAs, err := tc.Core().ServiceAccounts(metav1.NamespaceAll).List(metav1.ListOptions{})
if err != nil {
t.Fatalf("ServiceAccounts.List: %s", err)
}
@ -105,7 +105,7 @@ func TestFakeClientsetInheritsNamespace(t *testing.T) {
t.Fatalf("Namespaces.Create: %s", err)
}
allNS, err := tc.Core().Namespaces().List(api.ListOptions{})
allNS, err := tc.Core().Namespaces().List(metav1.ListOptions{})
if err != nil {
t.Fatalf("Namespaces.List: %s", err)
}
@ -155,7 +155,7 @@ func TestFakeClientsetInheritsNamespace(t *testing.T) {
func testSA(ns, name string) *api.ServiceAccount {
return &api.ServiceAccount{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: ns,
Name: name,
},
@ -164,7 +164,7 @@ func testSA(ns, name string) *api.ServiceAccount {
func testPod(ns, name string) *api.Pod {
return &api.Pod{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: ns,
Name: name,
},
@ -173,7 +173,7 @@ func testPod(ns, name string) *api.Pod {
func testNamespace(ns string) *api.Namespace {
return &api.Namespace{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: ns,
},
}

View file

@ -26,8 +26,8 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
restclient "k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
)
// ObjectTracker keeps track of objects. It is intended to be used to