refactor: generated

This commit is contained in:
Clayton Coleman
2016-12-09 13:16:33 -05:00
parent 596d9de8fa
commit c52d510a24
83 changed files with 11705 additions and 27639 deletions

View File

@@ -32,6 +32,7 @@ go_test(
deps = [
"//pkg/admission:go_default_library",
"//pkg/api:go_default_library",
"//pkg/apis/meta/v1:go_default_library",
"//pkg/auth/authorizer:go_default_library",
"//pkg/auth/user:go_default_library",
"//pkg/runtime:go_default_library",

View File

@@ -71,7 +71,7 @@ func TestGCAdmission(t *testing.T) {
name: "super-user, create, objectref change",
username: "super",
resource: api.SchemeGroupVersion.WithResource("pods"),
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: true,
},
{
@@ -85,7 +85,7 @@ func TestGCAdmission(t *testing.T) {
name: "non-deleter, create, objectref change",
username: "non-deleter",
resource: api.SchemeGroupVersion.WithResource("pods"),
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: false,
},
{
@@ -99,14 +99,14 @@ func TestGCAdmission(t *testing.T) {
name: "non-pod-deleter, create, objectref change",
username: "non-pod-deleter",
resource: api.SchemeGroupVersion.WithResource("pods"),
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: false,
},
{
name: "non-pod-deleter, create, objectref change, but not a pod",
username: "non-pod-deleter",
resource: api.SchemeGroupVersion.WithResource("not-pods"),
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: true,
},
@@ -122,8 +122,8 @@ func TestGCAdmission(t *testing.T) {
name: "super-user, update, no objectref change two",
username: "super",
resource: api.SchemeGroupVersion.WithResource("pods"),
oldObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
oldObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: true,
},
{
@@ -131,7 +131,7 @@ func TestGCAdmission(t *testing.T) {
username: "super",
resource: api.SchemeGroupVersion.WithResource("pods"),
oldObj: &api.Pod{},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: true,
},
{
@@ -146,8 +146,8 @@ func TestGCAdmission(t *testing.T) {
name: "non-deleter, update, no objectref change two",
username: "non-deleter",
resource: api.SchemeGroupVersion.WithResource("pods"),
oldObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
oldObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: true,
},
{
@@ -155,15 +155,15 @@ func TestGCAdmission(t *testing.T) {
username: "non-deleter",
resource: api.SchemeGroupVersion.WithResource("pods"),
oldObj: &api.Pod{},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: false,
},
{
name: "non-deleter, update, objectref change two",
username: "non-deleter",
resource: api.SchemeGroupVersion.WithResource("pods"),
oldObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}, {Name: "second"}}}},
oldObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}, {Name: "second"}}}},
expectedAllowed: false,
},
{
@@ -179,7 +179,7 @@ func TestGCAdmission(t *testing.T) {
username: "non-pod-deleter",
resource: api.SchemeGroupVersion.WithResource("pods"),
oldObj: &api.Pod{},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: false,
},
{
@@ -187,7 +187,7 @@ func TestGCAdmission(t *testing.T) {
username: "non-pod-deleter",
resource: api.SchemeGroupVersion.WithResource("not-pods"),
oldObj: &api.Pod{},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []api.OwnerReference{{Name: "first"}}}},
newObj: &api.Pod{ObjectMeta: api.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "first"}}}},
expectedAllowed: true,
},
}

View File

@@ -90,7 +90,7 @@ func TestNodePreferAvoidPriority(t *testing.T) {
pod: &v1.Pod{
ObjectMeta: v1.ObjectMeta{
Namespace: "default",
OwnerReferences: []v1.OwnerReference{
OwnerReferences: []metav1.OwnerReference{
{Kind: "ReplicationController", Name: "foo", UID: "abcdef123456", Controller: &trueVar},
},
},
@@ -103,7 +103,7 @@ func TestNodePreferAvoidPriority(t *testing.T) {
pod: &v1.Pod{
ObjectMeta: v1.ObjectMeta{
Namespace: "default",
OwnerReferences: []v1.OwnerReference{
OwnerReferences: []metav1.OwnerReference{
{Kind: "RandomController", Name: "foo", UID: "abcdef123456", Controller: &trueVar},
},
},
@@ -116,7 +116,7 @@ func TestNodePreferAvoidPriority(t *testing.T) {
pod: &v1.Pod{
ObjectMeta: v1.ObjectMeta{
Namespace: "default",
OwnerReferences: []v1.OwnerReference{
OwnerReferences: []metav1.OwnerReference{
{Kind: "ReplicationController", Name: "foo", UID: "abcdef123456"},
},
},
@@ -129,7 +129,7 @@ func TestNodePreferAvoidPriority(t *testing.T) {
pod: &v1.Pod{
ObjectMeta: v1.ObjectMeta{
Namespace: "default",
OwnerReferences: []v1.OwnerReference{
OwnerReferences: []metav1.OwnerReference{
{Kind: "ReplicaSet", Name: "foo", UID: "qwert12345", Controller: &trueVar},
},
},

View File

@@ -29,11 +29,11 @@ import (
"k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache"
)
func controllerRef(kind, name, uid string) []v1.OwnerReference {
func controllerRef(kind, name, uid string) []metav1.OwnerReference {
// TODO: When ControllerRef will be implemented uncomment code below.
return nil
//trueVar := true
//return []v1.OwnerReference{
//return []metav1.OwnerReference{
// {Kind: kind, Name: name, UID: types.UID(uid), Controller: &trueVar},
//}
}
@@ -300,7 +300,7 @@ func TestSelectorSpreadPriority(t *testing.T) {
}
}
func buildPod(nodeName string, labels map[string]string, ownerRefs []v1.OwnerReference) *v1.Pod {
func buildPod(nodeName string, labels map[string]string, ownerRefs []metav1.OwnerReference) *v1.Pod {
return &v1.Pod{
ObjectMeta: v1.ObjectMeta{Labels: labels, OwnerReferences: ownerRefs},
Spec: v1.PodSpec{NodeName: nodeName},

View File

@@ -20,6 +20,7 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/apis/meta/v1:go_default_library",
"//pkg/labels:go_default_library",
"//pkg/util/sets:go_default_library",
],

View File

@@ -21,7 +21,7 @@ import (
metav1 "k8s.io/kubernetes/pkg/apis/meta/v1"
)
func GetControllerRef(pod *v1.Pod) *v1.OwnerReference {
func GetControllerRef(pod *v1.Pod) *metav1.OwnerReference {
if len(pod.OwnerReferences) == 0 {
return nil
}

View File

@@ -16,6 +16,7 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api/v1:go_default_library",
"//pkg/apis/meta/v1:go_default_library",
"//pkg/cloudprovider/providers/aws:go_default_library",
"//pkg/util/sets:go_default_library",
"//plugin/pkg/scheduler:go_default_library",

View File

@@ -261,5 +261,5 @@ func isValidControllerKind(kind string) bool {
// EquivalencePod is a group of pod attributes which can be reused as equivalence to schedule other pods.
type EquivalencePod struct {
ControllerRef v1.OwnerReference
ControllerRef metav1.OwnerReference
}