mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-21 09:34:40 +00:00
Changes to be more consistent about import aliases and group/kind
This commit is contained in:
parent
49852289de
commit
4e8e2705b0
@ -19,35 +19,20 @@ package polymorphichelpers
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
appsv1 "k8s.io/kubernetes/pkg/apis/apps"
|
|
||||||
extensionsv1 "k8s.io/kubernetes/pkg/apis/extensions"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func canBeAutoscaled(kind schema.GroupKind) error {
|
func canBeAutoscaled(kind schema.GroupKind) error {
|
||||||
switch kind {
|
switch kind {
|
||||||
case
|
case
|
||||||
schema.GroupKind{
|
corev1.SchemeGroupVersion.WithKind("ReplicationController").GroupKind(),
|
||||||
Group: corev1.GroupName,
|
appsv1.SchemeGroupVersion.WithKind("Deployment").GroupKind(),
|
||||||
Kind: "ReplicationController",
|
appsv1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(),
|
||||||
},
|
extensionsv1beta1.SchemeGroupVersion.WithKind("Deployment").GroupKind(),
|
||||||
schema.GroupKind{
|
extensionsv1beta1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind():
|
||||||
Group: appsv1.GroupName,
|
|
||||||
Kind: "Deployment",
|
|
||||||
},
|
|
||||||
schema.GroupKind{
|
|
||||||
Group: appsv1.GroupName,
|
|
||||||
Kind: "ReplicaSet",
|
|
||||||
},
|
|
||||||
schema.GroupKind{
|
|
||||||
Group: extensionsv1.GroupName,
|
|
||||||
Kind: "Deployment",
|
|
||||||
},
|
|
||||||
schema.GroupKind{
|
|
||||||
Group: extensionsv1.GroupName,
|
|
||||||
Kind: "ReplicaSet",
|
|
||||||
}:
|
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("cannot autoscale a %v", kind)
|
return fmt.Errorf("cannot autoscale a %v", kind)
|
||||||
|
@ -19,6 +19,9 @@ package polymorphichelpers
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,17 +31,27 @@ func TestCanBeAutoscaled(t *testing.T) {
|
|||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
kind: schema.GroupKind{
|
kind: corev1.SchemeGroupVersion.WithKind("ReplicationController").GroupKind(),
|
||||||
Group: "",
|
|
||||||
Kind: "ReplicationController",
|
|
||||||
},
|
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
kind: schema.GroupKind{
|
kind: appsv1.SchemeGroupVersion.WithKind("Deployment").GroupKind(),
|
||||||
Group: "",
|
expectErr: false,
|
||||||
Kind: "Node",
|
},
|
||||||
},
|
{
|
||||||
|
kind: extensionsv1beta1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(),
|
||||||
|
expectErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: corev1.SchemeGroupVersion.WithKind("Node").GroupKind(),
|
||||||
|
expectErr: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: corev1.SchemeGroupVersion.WithKind("Service").GroupKind(),
|
||||||
|
expectErr: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: corev1.SchemeGroupVersion.WithKind("Pod").GroupKind(),
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
extensionsv1 "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,34 +29,13 @@ import (
|
|||||||
func canBeExposed(kind schema.GroupKind) error {
|
func canBeExposed(kind schema.GroupKind) error {
|
||||||
switch kind {
|
switch kind {
|
||||||
case
|
case
|
||||||
schema.GroupKind{
|
corev1.SchemeGroupVersion.WithKind("ReplicationController").GroupKind(),
|
||||||
Group: corev1.GroupName,
|
corev1.SchemeGroupVersion.WithKind("Service").GroupKind(),
|
||||||
Kind: "ReplicationController",
|
corev1.SchemeGroupVersion.WithKind("Pod").GroupKind(),
|
||||||
},
|
appsv1.SchemeGroupVersion.WithKind("Deployment").GroupKind(),
|
||||||
schema.GroupKind{
|
appsv1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(),
|
||||||
Group: corev1.GroupName,
|
extensionsv1beta1.SchemeGroupVersion.WithKind("Deployment").GroupKind(),
|
||||||
Kind: "Service",
|
extensionsv1beta1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind():
|
||||||
},
|
|
||||||
schema.GroupKind{
|
|
||||||
Group: corev1.GroupName,
|
|
||||||
Kind: "Pod",
|
|
||||||
},
|
|
||||||
schema.GroupKind{
|
|
||||||
Group: appsv1.GroupName,
|
|
||||||
Kind: "Deployment",
|
|
||||||
},
|
|
||||||
schema.GroupKind{
|
|
||||||
Group: appsv1.GroupName,
|
|
||||||
Kind: "ReplicaSet",
|
|
||||||
},
|
|
||||||
schema.GroupKind{
|
|
||||||
Group: extensionsv1.GroupName,
|
|
||||||
Kind: "Deployment",
|
|
||||||
},
|
|
||||||
schema.GroupKind{
|
|
||||||
Group: extensionsv1.GroupName,
|
|
||||||
Kind: "ReplicaSet",
|
|
||||||
}:
|
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("cannot expose a %s", kind)
|
return fmt.Errorf("cannot expose a %s", kind)
|
||||||
|
@ -19,6 +19,9 @@ package polymorphichelpers
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,17 +31,27 @@ func TestCanBeExposed(t *testing.T) {
|
|||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
kind: schema.GroupKind{
|
kind: corev1.SchemeGroupVersion.WithKind("ReplicationController").GroupKind(),
|
||||||
Group: "",
|
|
||||||
Kind: "ReplicationController",
|
|
||||||
},
|
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
kind: schema.GroupKind{
|
kind: corev1.SchemeGroupVersion.WithKind("Service").GroupKind(),
|
||||||
Group: "",
|
expectErr: false,
|
||||||
Kind: "Node",
|
},
|
||||||
},
|
{
|
||||||
|
kind: corev1.SchemeGroupVersion.WithKind("Pod").GroupKind(),
|
||||||
|
expectErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: appsv1.SchemeGroupVersion.WithKind("Deployment").GroupKind(),
|
||||||
|
expectErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: extensionsv1beta1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(),
|
||||||
|
expectErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
kind: corev1.SchemeGroupVersion.WithKind("Node").GroupKind(),
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
apps "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
batch "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
extensions "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
@ -151,9 +151,9 @@ func TestLogsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "replica set logs",
|
name: "replica set logs",
|
||||||
obj: &extensions.ReplicaSet{
|
obj: &extensionsv1beta1.ReplicaSet{
|
||||||
ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "test"},
|
ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "test"},
|
||||||
Spec: extensions.ReplicaSetSpec{
|
Spec: extensionsv1beta1.ReplicaSetSpec{
|
||||||
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -165,9 +165,9 @@ func TestLogsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "deployment logs",
|
name: "deployment logs",
|
||||||
obj: &extensions.Deployment{
|
obj: &extensionsv1beta1.Deployment{
|
||||||
ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "test"},
|
ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "test"},
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -179,9 +179,9 @@ func TestLogsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "job logs",
|
name: "job logs",
|
||||||
obj: &batch.Job{
|
obj: &batchv1.Job{
|
||||||
ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "test"},
|
ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "test"},
|
||||||
Spec: batch.JobSpec{
|
Spec: batchv1.JobSpec{
|
||||||
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -193,9 +193,9 @@ func TestLogsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "stateful set logs",
|
name: "stateful set logs",
|
||||||
obj: &apps.StatefulSet{
|
obj: &appsv1.StatefulSet{
|
||||||
ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "test"},
|
ObjectMeta: metav1.ObjectMeta{Name: "hello", Namespace: "test"},
|
||||||
Spec: apps.StatefulSetSpec{
|
Spec: appsv1.StatefulSetSpec{
|
||||||
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -19,8 +19,8 @@ package polymorphichelpers
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
api "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
extensions "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
@ -32,8 +32,8 @@ func TestMapBasedSelectorForObject(t *testing.T) {
|
|||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
object: &api.ReplicationController{
|
object: &corev1.ReplicationController{
|
||||||
Spec: api.ReplicationControllerSpec{
|
Spec: corev1.ReplicationControllerSpec{
|
||||||
Selector: map[string]string{
|
Selector: map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
},
|
},
|
||||||
@ -42,11 +42,11 @@ func TestMapBasedSelectorForObject(t *testing.T) {
|
|||||||
expectSelector: "foo=bar",
|
expectSelector: "foo=bar",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Pod{},
|
object: &corev1.Pod{},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Pod{
|
object: &corev1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
@ -56,8 +56,8 @@ func TestMapBasedSelectorForObject(t *testing.T) {
|
|||||||
expectSelector: "foo=bar",
|
expectSelector: "foo=bar",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Service{
|
object: &corev1.Service{
|
||||||
Spec: api.ServiceSpec{
|
Spec: corev1.ServiceSpec{
|
||||||
Selector: map[string]string{
|
Selector: map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
},
|
},
|
||||||
@ -66,12 +66,12 @@ func TestMapBasedSelectorForObject(t *testing.T) {
|
|||||||
expectSelector: "foo=bar",
|
expectSelector: "foo=bar",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Service{},
|
object: &corev1.Service{},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.Deployment{
|
object: &extensionsv1beta1.Deployment{
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Selector: &metav1.LabelSelector{
|
Selector: &metav1.LabelSelector{
|
||||||
MatchLabels: map[string]string{
|
MatchLabels: map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
@ -82,8 +82,8 @@ func TestMapBasedSelectorForObject(t *testing.T) {
|
|||||||
expectSelector: "foo=bar",
|
expectSelector: "foo=bar",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.Deployment{
|
object: &extensionsv1beta1.Deployment{
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Selector: &metav1.LabelSelector{
|
Selector: &metav1.LabelSelector{
|
||||||
MatchExpressions: []metav1.LabelSelectorRequirement{
|
MatchExpressions: []metav1.LabelSelectorRequirement{
|
||||||
{
|
{
|
||||||
@ -96,8 +96,8 @@ func TestMapBasedSelectorForObject(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.ReplicaSet{
|
object: &extensionsv1beta1.ReplicaSet{
|
||||||
Spec: extensions.ReplicaSetSpec{
|
Spec: extensionsv1beta1.ReplicaSetSpec{
|
||||||
Selector: &metav1.LabelSelector{
|
Selector: &metav1.LabelSelector{
|
||||||
MatchLabels: map[string]string{
|
MatchLabels: map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
@ -108,8 +108,8 @@ func TestMapBasedSelectorForObject(t *testing.T) {
|
|||||||
expectSelector: "foo=bar",
|
expectSelector: "foo=bar",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.ReplicaSet{
|
object: &extensionsv1beta1.ReplicaSet{
|
||||||
Spec: extensions.ReplicaSetSpec{
|
Spec: extensionsv1beta1.ReplicaSetSpec{
|
||||||
Selector: &metav1.LabelSelector{
|
Selector: &metav1.LabelSelector{
|
||||||
MatchExpressions: []metav1.LabelSelectorRequirement{
|
MatchExpressions: []metav1.LabelSelectorRequirement{
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@ func TestMapBasedSelectorForObject(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Node{},
|
object: &corev1.Node{},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
extensions "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,8 +31,8 @@ func TestDefaultObjectPauser(t *testing.T) {
|
|||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
object: &extensions.Deployment{
|
object: &extensionsv1beta1.Deployment{
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Paused: false,
|
Paused: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -40,15 +40,15 @@ func TestDefaultObjectPauser(t *testing.T) {
|
|||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.Deployment{
|
object: &extensionsv1beta1.Deployment{
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Paused: true,
|
Paused: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.ReplicaSet{},
|
object: &extensionsv1beta1.ReplicaSet{},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
extensions "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,8 +31,8 @@ func TestDefaultObjectResumer(t *testing.T) {
|
|||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
object: &extensions.Deployment{
|
object: &extensionsv1beta1.Deployment{
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Paused: true,
|
Paused: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -40,15 +40,15 @@ func TestDefaultObjectResumer(t *testing.T) {
|
|||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.Deployment{
|
object: &extensionsv1beta1.Deployment{
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Paused: false,
|
Paused: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.ReplicaSet{},
|
object: &extensionsv1beta1.ReplicaSet{},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ import (
|
|||||||
|
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
api "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
extensions "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,11 +32,11 @@ func TestPortsForObject(t *testing.T) {
|
|||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
object: &api.Pod{
|
object: &corev1.Pod{
|
||||||
Spec: api.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []api.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
Ports: []api.ContainerPort{
|
Ports: []corev1.ContainerPort{
|
||||||
{
|
{
|
||||||
ContainerPort: 101,
|
ContainerPort: 101,
|
||||||
},
|
},
|
||||||
@ -47,9 +47,9 @@ func TestPortsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Service{
|
object: &corev1.Service{
|
||||||
Spec: api.ServiceSpec{
|
Spec: corev1.ServiceSpec{
|
||||||
Ports: []api.ServicePort{
|
Ports: []corev1.ServicePort{
|
||||||
{
|
{
|
||||||
Port: 101,
|
Port: 101,
|
||||||
},
|
},
|
||||||
@ -58,13 +58,13 @@ func TestPortsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.ReplicationController{
|
object: &corev1.ReplicationController{
|
||||||
Spec: api.ReplicationControllerSpec{
|
Spec: corev1.ReplicationControllerSpec{
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &corev1.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []api.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
Ports: []api.ContainerPort{
|
Ports: []corev1.ContainerPort{
|
||||||
{
|
{
|
||||||
ContainerPort: 101,
|
ContainerPort: 101,
|
||||||
},
|
},
|
||||||
@ -77,13 +77,13 @@ func TestPortsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.Deployment{
|
object: &extensionsv1beta1.Deployment{
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Template: api.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []api.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
Ports: []api.ContainerPort{
|
Ports: []corev1.ContainerPort{
|
||||||
{
|
{
|
||||||
ContainerPort: 101,
|
ContainerPort: 101,
|
||||||
},
|
},
|
||||||
@ -96,13 +96,13 @@ func TestPortsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.ReplicaSet{
|
object: &extensionsv1beta1.ReplicaSet{
|
||||||
Spec: extensions.ReplicaSetSpec{
|
Spec: extensionsv1beta1.ReplicaSetSpec{
|
||||||
Template: api.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []api.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
Ports: []api.ContainerPort{
|
Ports: []corev1.ContainerPort{
|
||||||
{
|
{
|
||||||
ContainerPort: 101,
|
ContainerPort: 101,
|
||||||
},
|
},
|
||||||
@ -115,7 +115,7 @@ func TestPortsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Node{},
|
object: &corev1.Node{},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ import (
|
|||||||
|
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
api "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
extensions "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,11 +32,11 @@ func TestProtocolsForObject(t *testing.T) {
|
|||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
object: &api.Pod{
|
object: &corev1.Pod{
|
||||||
Spec: api.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []api.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
Ports: []api.ContainerPort{
|
Ports: []corev1.ContainerPort{
|
||||||
{
|
{
|
||||||
ContainerPort: 101,
|
ContainerPort: 101,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
@ -48,9 +48,9 @@ func TestProtocolsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Service{
|
object: &corev1.Service{
|
||||||
Spec: api.ServiceSpec{
|
Spec: corev1.ServiceSpec{
|
||||||
Ports: []api.ServicePort{
|
Ports: []corev1.ServicePort{
|
||||||
{
|
{
|
||||||
Port: 101,
|
Port: 101,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
@ -60,13 +60,13 @@ func TestProtocolsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.ReplicationController{
|
object: &corev1.ReplicationController{
|
||||||
Spec: api.ReplicationControllerSpec{
|
Spec: corev1.ReplicationControllerSpec{
|
||||||
Template: &api.PodTemplateSpec{
|
Template: &corev1.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []api.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
Ports: []api.ContainerPort{
|
Ports: []corev1.ContainerPort{
|
||||||
{
|
{
|
||||||
ContainerPort: 101,
|
ContainerPort: 101,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
@ -80,13 +80,13 @@ func TestProtocolsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.Deployment{
|
object: &extensionsv1beta1.Deployment{
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensionsv1beta1.DeploymentSpec{
|
||||||
Template: api.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []api.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
Ports: []api.ContainerPort{
|
Ports: []corev1.ContainerPort{
|
||||||
{
|
{
|
||||||
ContainerPort: 101,
|
ContainerPort: 101,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
@ -100,13 +100,13 @@ func TestProtocolsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &extensions.ReplicaSet{
|
object: &extensionsv1beta1.ReplicaSet{
|
||||||
Spec: extensions.ReplicaSetSpec{
|
Spec: extensionsv1beta1.ReplicaSetSpec{
|
||||||
Template: api.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
Spec: api.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []api.Container{
|
Containers: []corev1.Container{
|
||||||
{
|
{
|
||||||
Ports: []api.ContainerPort{
|
Ports: []corev1.ContainerPort{
|
||||||
{
|
{
|
||||||
ContainerPort: 101,
|
ContainerPort: 101,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
@ -120,7 +120,7 @@ func TestProtocolsForObject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
object: &api.Node{},
|
object: &corev1.Node{},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user