refactor: use metav1.ObjectMeta in other types
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/util/intstr"
|
||||
)
|
||||
@@ -40,7 +41,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"container-port": "1234",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -69,7 +70,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"container-port": "foobar",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -98,7 +99,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"container-port": "1234",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
Labels: map[string]string{
|
||||
"key1": "value1",
|
||||
@@ -131,7 +132,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"external-ip": "1.2.3.4",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -162,7 +163,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"create-external-load-balancer": "true",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -193,7 +194,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"type": string(api.ServiceTypeNodePort),
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -224,7 +225,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"type": string(api.ServiceTypeNodePort),
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -253,7 +254,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"container-port": "1234",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -283,7 +284,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"session-affinity": "ClientIP",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -314,7 +315,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"cluster-ip": "10.10.10.10",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -344,7 +345,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"cluster-ip": "None",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -373,7 +374,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"container-port": "foobar",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -407,7 +408,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"target-port": "1234",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -440,7 +441,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"protocol": "TCP",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -473,7 +474,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"protocols": "8080/UDP",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -506,7 +507,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"protocols": "8080/UDP,8081/TCP",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
@@ -546,7 +547,7 @@ func TestGenerateService(t *testing.T) {
|
||||
"cluster-ip": "None",
|
||||
},
|
||||
expected: api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
|
Reference in New Issue
Block a user