mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
remove v1.Semantics
This commit is contained in:
parent
aad6831aa7
commit
b50367cbdc
@ -22,9 +22,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
|
||||||
"k8s.io/kubernetes/pkg/conversion"
|
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
"k8s.io/kubernetes/pkg/selection"
|
"k8s.io/kubernetes/pkg/selection"
|
||||||
@ -32,27 +29,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/sets"
|
"k8s.io/kubernetes/pkg/util/sets"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Semantic can do semantic deep equality checks for api objects.
|
|
||||||
// Example: api.Semantic.DeepEqual(aPod, aPodWithNonNilButEmptyMaps) == true
|
|
||||||
var Semantic = conversion.EqualitiesOrDie(
|
|
||||||
func(a, b resource.Quantity) bool {
|
|
||||||
// Ignore formatting, only care that numeric value stayed the same.
|
|
||||||
// TODO: if we decide it's important, it should be safe to start comparing the format.
|
|
||||||
//
|
|
||||||
// Uninitialized quantities are equivalent to 0 quantities.
|
|
||||||
return a.Cmp(b) == 0
|
|
||||||
},
|
|
||||||
func(a, b unversioned.Time) bool {
|
|
||||||
return a.UTC() == b.UTC()
|
|
||||||
},
|
|
||||||
func(a, b labels.Selector) bool {
|
|
||||||
return a.String() == b.String()
|
|
||||||
},
|
|
||||||
func(a, b fields.Selector) bool {
|
|
||||||
return a.String() == b.String()
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// IsOpaqueIntResourceName returns true if the resource name has the opaque
|
// IsOpaqueIntResourceName returns true if the resource name has the opaque
|
||||||
// integer resource prefix.
|
// integer resource prefix.
|
||||||
func IsOpaqueIntResourceName(name ResourceName) bool {
|
func IsOpaqueIntResourceName(name ResourceName) bool {
|
||||||
|
@ -18,74 +18,12 @@ package v1
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConversionError(t *testing.T) {
|
|
||||||
var i int
|
|
||||||
var s string
|
|
||||||
i = 3
|
|
||||||
s = "foo"
|
|
||||||
c := ConversionError{
|
|
||||||
In: &i, Out: &s,
|
|
||||||
Message: "Can't make x into y, silly",
|
|
||||||
}
|
|
||||||
var e error
|
|
||||||
e = &c // ensure it implements error
|
|
||||||
msg := e.Error()
|
|
||||||
t.Logf("Message is %v", msg)
|
|
||||||
for _, part := range []string{"3", "int", "string", "Can't"} {
|
|
||||||
if !strings.Contains(msg, part) {
|
|
||||||
t.Errorf("didn't find %v", part)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestSemantic(t *testing.T) {
|
|
||||||
table := []struct {
|
|
||||||
a, b interface{}
|
|
||||||
shouldEqual bool
|
|
||||||
}{
|
|
||||||
{resource.MustParse("0"), resource.Quantity{}, true},
|
|
||||||
{resource.Quantity{}, resource.MustParse("0"), true},
|
|
||||||
{resource.Quantity{}, resource.MustParse("1m"), false},
|
|
||||||
{
|
|
||||||
resource.NewQuantity(5, resource.BinarySI),
|
|
||||||
resource.NewQuantity(5, resource.DecimalSI),
|
|
||||||
true,
|
|
||||||
},
|
|
||||||
{resource.MustParse("2m"), resource.MustParse("1m"), false},
|
|
||||||
}
|
|
||||||
|
|
||||||
for index, item := range table {
|
|
||||||
if e, a := item.shouldEqual, Semantic.DeepEqual(item.a, item.b); e != a {
|
|
||||||
t.Errorf("case[%d], expected %v, got %v.", index, e, a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestIsStandardResource(t *testing.T) {
|
|
||||||
testCases := []struct {
|
|
||||||
input string
|
|
||||||
output bool
|
|
||||||
}{
|
|
||||||
{"cpu", true},
|
|
||||||
{"memory", true},
|
|
||||||
{"disk", false},
|
|
||||||
{"blah", false},
|
|
||||||
{"x.y.z", false},
|
|
||||||
}
|
|
||||||
for i, tc := range testCases {
|
|
||||||
if IsStandardResourceName(tc.input) != tc.output {
|
|
||||||
t.Errorf("case[%d], expected: %t, got: %t", i, tc.output, !tc.output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestAddToNodeAddresses(t *testing.T) {
|
func TestAddToNodeAddresses(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
existing []NodeAddress
|
existing []NodeAddress
|
||||||
@ -137,7 +75,7 @@ func TestAddToNodeAddresses(t *testing.T) {
|
|||||||
|
|
||||||
for i, tc := range testCases {
|
for i, tc := range testCases {
|
||||||
AddToNodeAddresses(&tc.existing, tc.toAdd...)
|
AddToNodeAddresses(&tc.existing, tc.toAdd...)
|
||||||
if !Semantic.DeepEqual(tc.expected, tc.existing) {
|
if !api.Semantic.DeepEqual(tc.expected, tc.existing) {
|
||||||
t.Errorf("case[%d], expected: %v, got: %v", i, tc.expected, tc.existing)
|
t.Errorf("case[%d], expected: %v, got: %v", i, tc.expected, tc.existing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
@ -273,7 +274,7 @@ func TestCreatePods(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected error: %v", err)
|
t.Fatalf("Unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepDerivative(&expectedPod, actualPod) {
|
if !api.Semantic.DeepDerivative(&expectedPod, actualPod) {
|
||||||
t.Logf("Body: %s", fakeHandler.RequestBody)
|
t.Logf("Body: %s", fakeHandler.RequestBody)
|
||||||
t.Errorf("Unexpected mismatch. Expected\n %#v,\n Got:\n %#v", &expectedPod, actualPod)
|
t.Errorf("Unexpected mismatch. Expected\n %#v,\n Got:\n %#v", &expectedPod, actualPod)
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
extensions "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
|
extensions "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
|
||||||
@ -220,7 +221,7 @@ func (dc *DeploymentController) updateReplicaSet(old, cur interface{}) {
|
|||||||
}
|
}
|
||||||
// A number of things could affect the old deployment: labels changing,
|
// A number of things could affect the old deployment: labels changing,
|
||||||
// pod template changing, etc.
|
// pod template changing, etc.
|
||||||
if !v1.Semantic.DeepEqual(oldRS, curRS) {
|
if !api.Semantic.DeepEqual(oldRS, curRS) {
|
||||||
if oldD := dc.getDeploymentForReplicaSet(oldRS); oldD != nil {
|
if oldD := dc.getDeploymentForReplicaSet(oldRS); oldD != nil {
|
||||||
dc.enqueueDeployment(oldD)
|
dc.enqueueDeployment(oldD)
|
||||||
}
|
}
|
||||||
|
@ -611,7 +611,7 @@ func equalIgnoreHash(template1, template2 v1.PodTemplateSpec) (bool, error) {
|
|||||||
|
|
||||||
// Then, compare the templates without comparing their labels
|
// Then, compare the templates without comparing their labels
|
||||||
template1.Labels, template2.Labels = nil, nil
|
template1.Labels, template2.Labels = nil, nil
|
||||||
result := v1.Semantic.DeepEqual(template1, template2)
|
result := api.Semantic.DeepEqual(template1, template2)
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ func TestGetNewRC(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("In test case %s, got unexpected error %v", test.test, err)
|
t.Errorf("In test case %s, got unexpected error %v", test.test, err)
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepEqual(rs, test.expected) {
|
if !api.Semantic.DeepEqual(rs, test.expected) {
|
||||||
t.Errorf("In test case %s, expected %#v, got %#v", test.test, test.expected, rs)
|
t.Errorf("In test case %s, expected %#v, got %#v", test.test, test.expected, rs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||||
@ -656,7 +657,7 @@ func TestWatchJobs(t *testing.T) {
|
|||||||
t.Errorf("Expected to find job under key %v: %v", key, err)
|
t.Errorf("Expected to find job under key %v: %v", key, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepDerivative(*job, testJob) {
|
if !api.Semantic.DeepDerivative(*job, testJob) {
|
||||||
t.Errorf("Expected %#v, but got %#v", testJob, *job)
|
t.Errorf("Expected %#v, but got %#v", testJob, *job)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -699,7 +700,7 @@ func TestWatchPods(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Expected to find job under key %v: %v", key, err)
|
t.Errorf("Expected to find job under key %v: %v", key, err)
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepDerivative(job, testJob) {
|
if !api.Semantic.DeepDerivative(job, testJob) {
|
||||||
t.Errorf("\nExpected %#v,\nbut got %#v", testJob, job)
|
t.Errorf("\nExpected %#v,\nbut got %#v", testJob, job)
|
||||||
close(received)
|
close(received)
|
||||||
return nil
|
return nil
|
||||||
|
@ -773,7 +773,7 @@ func (nc *NodeController) tryUpdateNodeStatus(node *v1.Node) (time.Duration, v1.
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, currentCondition := v1.GetNodeCondition(&node.Status, v1.NodeReady)
|
_, currentCondition := v1.GetNodeCondition(&node.Status, v1.NodeReady)
|
||||||
if !v1.Semantic.DeepEqual(currentCondition, &observedReadyCondition) {
|
if !api.Semantic.DeepEqual(currentCondition, &observedReadyCondition) {
|
||||||
if _, err = nc.kubeClient.Core().Nodes().UpdateStatus(node); err != nil {
|
if _, err = nc.kubeClient.Core().Nodes().UpdateStatus(node); err != nil {
|
||||||
glog.Errorf("Error updating node %s: %v", node.Name, err)
|
glog.Errorf("Error updating node %s: %v", node.Name, err)
|
||||||
return gracePeriod, observedReadyCondition, currentReadyCondition, err
|
return gracePeriod, observedReadyCondition, currentReadyCondition, err
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
@ -1483,10 +1484,10 @@ func TestMonitorNodeStatusUpdateStatus(t *testing.T) {
|
|||||||
if item.expectedRequestCount != item.fakeNodeHandler.RequestCount {
|
if item.expectedRequestCount != item.fakeNodeHandler.RequestCount {
|
||||||
t.Errorf("expected %v call, but got %v.", item.expectedRequestCount, item.fakeNodeHandler.RequestCount)
|
t.Errorf("expected %v call, but got %v.", item.expectedRequestCount, item.fakeNodeHandler.RequestCount)
|
||||||
}
|
}
|
||||||
if len(item.fakeNodeHandler.UpdatedNodes) > 0 && !v1.Semantic.DeepEqual(item.expectedNodes, item.fakeNodeHandler.UpdatedNodes) {
|
if len(item.fakeNodeHandler.UpdatedNodes) > 0 && !api.Semantic.DeepEqual(item.expectedNodes, item.fakeNodeHandler.UpdatedNodes) {
|
||||||
t.Errorf("Case[%d] unexpected nodes: %s", i, diff.ObjectDiff(item.expectedNodes[0], item.fakeNodeHandler.UpdatedNodes[0]))
|
t.Errorf("Case[%d] unexpected nodes: %s", i, diff.ObjectDiff(item.expectedNodes[0], item.fakeNodeHandler.UpdatedNodes[0]))
|
||||||
}
|
}
|
||||||
if len(item.fakeNodeHandler.UpdatedNodeStatuses) > 0 && !v1.Semantic.DeepEqual(item.expectedNodes, item.fakeNodeHandler.UpdatedNodeStatuses) {
|
if len(item.fakeNodeHandler.UpdatedNodeStatuses) > 0 && !api.Semantic.DeepEqual(item.expectedNodes, item.fakeNodeHandler.UpdatedNodeStatuses) {
|
||||||
t.Errorf("Case[%d] unexpected nodes: %s", i, diff.ObjectDiff(item.expectedNodes[0], item.fakeNodeHandler.UpdatedNodeStatuses[0]))
|
t.Errorf("Case[%d] unexpected nodes: %s", i, diff.ObjectDiff(item.expectedNodes[0], item.fakeNodeHandler.UpdatedNodeStatuses[0]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
@ -540,7 +541,7 @@ func TestWatchControllers(t *testing.T) {
|
|||||||
t.Errorf("Expected to find replica set under key %v", key)
|
t.Errorf("Expected to find replica set under key %v", key)
|
||||||
}
|
}
|
||||||
rsSpec := *obj.(*extensions.ReplicaSet)
|
rsSpec := *obj.(*extensions.ReplicaSet)
|
||||||
if !v1.Semantic.DeepDerivative(rsSpec, testRSSpec) {
|
if !api.Semantic.DeepDerivative(rsSpec, testRSSpec) {
|
||||||
t.Errorf("Expected %#v, but got %#v", testRSSpec, rsSpec)
|
t.Errorf("Expected %#v, but got %#v", testRSSpec, rsSpec)
|
||||||
}
|
}
|
||||||
close(received)
|
close(received)
|
||||||
@ -582,7 +583,7 @@ func TestWatchPods(t *testing.T) {
|
|||||||
t.Errorf("Expected to find replica set under key %v", key)
|
t.Errorf("Expected to find replica set under key %v", key)
|
||||||
}
|
}
|
||||||
rsSpec := obj.(*extensions.ReplicaSet)
|
rsSpec := obj.(*extensions.ReplicaSet)
|
||||||
if !v1.Semantic.DeepDerivative(rsSpec, testRSSpec) {
|
if !api.Semantic.DeepDerivative(rsSpec, testRSSpec) {
|
||||||
t.Errorf("\nExpected %#v,\nbut got %#v", testRSSpec, rsSpec)
|
t.Errorf("\nExpected %#v,\nbut got %#v", testRSSpec, rsSpec)
|
||||||
}
|
}
|
||||||
close(received)
|
close(received)
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
@ -465,7 +466,7 @@ func TestWatchControllers(t *testing.T) {
|
|||||||
t.Errorf("Expected to find controller under key %v", key)
|
t.Errorf("Expected to find controller under key %v", key)
|
||||||
}
|
}
|
||||||
controllerSpec := *obj.(*v1.ReplicationController)
|
controllerSpec := *obj.(*v1.ReplicationController)
|
||||||
if !v1.Semantic.DeepDerivative(controllerSpec, testControllerSpec) {
|
if !api.Semantic.DeepDerivative(controllerSpec, testControllerSpec) {
|
||||||
t.Errorf("Expected %#v, but got %#v", testControllerSpec, controllerSpec)
|
t.Errorf("Expected %#v, but got %#v", testControllerSpec, controllerSpec)
|
||||||
}
|
}
|
||||||
close(received)
|
close(received)
|
||||||
@ -508,7 +509,7 @@ func TestWatchPods(t *testing.T) {
|
|||||||
t.Errorf("Expected to find controller under key %v", key)
|
t.Errorf("Expected to find controller under key %v", key)
|
||||||
}
|
}
|
||||||
controllerSpec := obj.(*v1.ReplicationController)
|
controllerSpec := obj.(*v1.ReplicationController)
|
||||||
if !v1.Semantic.DeepDerivative(controllerSpec, testControllerSpec) {
|
if !api.Semantic.DeepDerivative(controllerSpec, testControllerSpec) {
|
||||||
t.Errorf("\nExpected %#v,\nbut got %#v", testControllerSpec, controllerSpec)
|
t.Errorf("\nExpected %#v,\nbut got %#v", testControllerSpec, controllerSpec)
|
||||||
}
|
}
|
||||||
close(received)
|
close(received)
|
||||||
|
@ -173,7 +173,7 @@ func (rq *ResourceQuotaController) addQuota(obj interface{}) {
|
|||||||
resourceQuota := obj.(*v1.ResourceQuota)
|
resourceQuota := obj.(*v1.ResourceQuota)
|
||||||
|
|
||||||
// if we declared an intent that is not yet captured in status (prioritize it)
|
// if we declared an intent that is not yet captured in status (prioritize it)
|
||||||
if !v1.Semantic.DeepEqual(resourceQuota.Spec.Hard, resourceQuota.Status.Hard) {
|
if !api.Semantic.DeepEqual(resourceQuota.Spec.Hard, resourceQuota.Status.Hard) {
|
||||||
rq.missingUsageQueue.Add(key)
|
rq.missingUsageQueue.Add(key)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ func (rq *ResourceQuotaController) syncResourceQuotaFromKey(key string) (err err
|
|||||||
// syncResourceQuota runs a complete sync of resource quota status across all known kinds
|
// syncResourceQuota runs a complete sync of resource quota status across all known kinds
|
||||||
func (rq *ResourceQuotaController) syncResourceQuota(v1ResourceQuota v1.ResourceQuota) (err error) {
|
func (rq *ResourceQuotaController) syncResourceQuota(v1ResourceQuota v1.ResourceQuota) (err error) {
|
||||||
// quota is dirty if any part of spec hard limits differs from the status hard limits
|
// quota is dirty if any part of spec hard limits differs from the status hard limits
|
||||||
dirty := !v1.Semantic.DeepEqual(v1ResourceQuota.Spec.Hard, v1ResourceQuota.Status.Hard)
|
dirty := !api.Semantic.DeepEqual(v1ResourceQuota.Spec.Hard, v1ResourceQuota.Status.Hard)
|
||||||
|
|
||||||
resourceQuota := api.ResourceQuota{}
|
resourceQuota := api.ResourceQuota{}
|
||||||
if err := v1.Convert_v1_ResourceQuota_To_api_ResourceQuota(&v1ResourceQuota, &resourceQuota, nil); err != nil {
|
if err := v1.Convert_v1_ResourceQuota_To_api_ResourceQuota(&v1ResourceQuota, &resourceQuota, nil); err != nil {
|
||||||
|
@ -19,6 +19,7 @@ package config
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/client/cache"
|
"k8s.io/kubernetes/pkg/client/cache"
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
@ -69,7 +70,7 @@ func TestNewSourceApiserver_UpdatesAndMultiplePods(t *testing.T) {
|
|||||||
}
|
}
|
||||||
update := got.(kubetypes.PodUpdate)
|
update := got.(kubetypes.PodUpdate)
|
||||||
expected := CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod1v1)
|
expected := CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod1v1)
|
||||||
if !v1.Semantic.DeepEqual(expected, update) {
|
if !api.Semantic.DeepEqual(expected, update) {
|
||||||
t.Errorf("Expected %#v; Got %#v", expected, update)
|
t.Errorf("Expected %#v; Got %#v", expected, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ func TestNewSourceApiserver_UpdatesAndMultiplePods(t *testing.T) {
|
|||||||
expectedA := CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod1v1, pod2)
|
expectedA := CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod1v1, pod2)
|
||||||
expectedB := CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod2, pod1v1)
|
expectedB := CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod2, pod1v1)
|
||||||
|
|
||||||
if !v1.Semantic.DeepEqual(expectedA, update) && !v1.Semantic.DeepEqual(expectedB, update) {
|
if !api.Semantic.DeepEqual(expectedA, update) && !api.Semantic.DeepEqual(expectedB, update) {
|
||||||
t.Errorf("Expected %#v or %#v, Got %#v", expectedA, expectedB, update)
|
t.Errorf("Expected %#v or %#v, Got %#v", expectedA, expectedB, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ func TestNewSourceApiserver_UpdatesAndMultiplePods(t *testing.T) {
|
|||||||
expectedA = CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod1v2, pod2)
|
expectedA = CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod1v2, pod2)
|
||||||
expectedB = CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod2, pod1v2)
|
expectedB = CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod2, pod1v2)
|
||||||
|
|
||||||
if !v1.Semantic.DeepEqual(expectedA, update) && !v1.Semantic.DeepEqual(expectedB, update) {
|
if !api.Semantic.DeepEqual(expectedA, update) && !api.Semantic.DeepEqual(expectedB, update) {
|
||||||
t.Errorf("Expected %#v or %#v, Got %#v", expectedA, expectedB, update)
|
t.Errorf("Expected %#v or %#v, Got %#v", expectedA, expectedB, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +111,7 @@ func TestNewSourceApiserver_UpdatesAndMultiplePods(t *testing.T) {
|
|||||||
}
|
}
|
||||||
update = got.(kubetypes.PodUpdate)
|
update = got.(kubetypes.PodUpdate)
|
||||||
expected = CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod2)
|
expected = CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource, pod2)
|
||||||
if !v1.Semantic.DeepEqual(expected, update) {
|
if !api.Semantic.DeepEqual(expected, update) {
|
||||||
t.Errorf("Expected %#v, Got %#v", expected, update)
|
t.Errorf("Expected %#v, Got %#v", expected, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ func TestNewSourceApiserver_UpdatesAndMultiplePods(t *testing.T) {
|
|||||||
}
|
}
|
||||||
update = got.(kubetypes.PodUpdate)
|
update = got.(kubetypes.PodUpdate)
|
||||||
expected = CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource)
|
expected = CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource)
|
||||||
if !v1.Semantic.DeepEqual(expected, update) {
|
if !api.Semantic.DeepEqual(expected, update) {
|
||||||
t.Errorf("Expected %#v, Got %#v", expected, update)
|
t.Errorf("Expected %#v, Got %#v", expected, update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,7 +187,7 @@ func TestNewSourceApiserverInitialEmptySendsEmptyPodUpdate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
update := got.(kubetypes.PodUpdate)
|
update := got.(kubetypes.PodUpdate)
|
||||||
expected := CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource)
|
expected := CreatePodUpdate(kubetypes.SET, kubetypes.ApiserverSource)
|
||||||
if !v1.Semantic.DeepEqual(expected, update) {
|
if !api.Semantic.DeepEqual(expected, update) {
|
||||||
t.Errorf("Expected %#v; Got %#v", expected, update)
|
t.Errorf("Expected %#v; Got %#v", expected, update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/client/record"
|
"k8s.io/kubernetes/pkg/client/record"
|
||||||
@ -100,7 +101,7 @@ func expectPodUpdate(t *testing.T, ch <-chan kubetypes.PodUpdate, expected ...ku
|
|||||||
// except for "Pods", which are compared separately below.
|
// except for "Pods", which are compared separately below.
|
||||||
expectedCopy, updateCopy := expected[i], update
|
expectedCopy, updateCopy := expected[i], update
|
||||||
expectedCopy.Pods, updateCopy.Pods = nil, nil
|
expectedCopy.Pods, updateCopy.Pods = nil, nil
|
||||||
if !v1.Semantic.DeepEqual(expectedCopy, updateCopy) {
|
if !api.Semantic.DeepEqual(expectedCopy, updateCopy) {
|
||||||
t.Fatalf("Expected %#v, Got %#v", expectedCopy, updateCopy)
|
t.Fatalf("Expected %#v, Got %#v", expectedCopy, updateCopy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,10 +29,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
|
||||||
"k8s.io/kubernetes/pkg/api/validation"
|
"k8s.io/kubernetes/pkg/api/validation"
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -58,7 +58,7 @@ func TestUpdateOnNonExistentFile(t *testing.T) {
|
|||||||
case got := <-ch:
|
case got := <-ch:
|
||||||
update := got.(kubetypes.PodUpdate)
|
update := got.(kubetypes.PodUpdate)
|
||||||
expected := CreatePodUpdate(kubetypes.SET, kubetypes.FileSource)
|
expected := CreatePodUpdate(kubetypes.SET, kubetypes.FileSource)
|
||||||
if !v1.Semantic.DeepDerivative(expected, update) {
|
if !api.Semantic.DeepDerivative(expected, update) {
|
||||||
t.Fatalf("expected %#v, Got %#v", expected, update)
|
t.Fatalf("expected %#v, Got %#v", expected, update)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ func TestReadPodsFromFileExistAlready(t *testing.T) {
|
|||||||
t.Fatalf("%s: Invalid pod %#v, %#v", testCase.desc, internalPod, errs)
|
t.Fatalf("%s: Invalid pod %#v, %#v", testCase.desc, internalPod, errs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepEqual(testCase.expected, update) {
|
if !api.Semantic.DeepEqual(testCase.expected, update) {
|
||||||
t.Fatalf("%s: Expected %#v, Got %#v", testCase.desc, testCase.expected, update)
|
t.Fatalf("%s: Expected %#v, Got %#v", testCase.desc, testCase.expected, update)
|
||||||
}
|
}
|
||||||
case <-time.After(wait.ForeverTestTimeout):
|
case <-time.After(wait.ForeverTestTimeout):
|
||||||
@ -159,7 +159,7 @@ func TestExtractFromEmptyDir(t *testing.T) {
|
|||||||
|
|
||||||
update := (<-ch).(kubetypes.PodUpdate)
|
update := (<-ch).(kubetypes.PodUpdate)
|
||||||
expected := CreatePodUpdate(kubetypes.SET, kubetypes.FileSource)
|
expected := CreatePodUpdate(kubetypes.SET, kubetypes.FileSource)
|
||||||
if !v1.Semantic.DeepEqual(expected, update) {
|
if !api.Semantic.DeepEqual(expected, update) {
|
||||||
t.Fatalf("expected %#v, Got %#v", expected, update)
|
t.Fatalf("expected %#v, Got %#v", expected, update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ func expectUpdate(t *testing.T, ch chan interface{}, testCase *testCase) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !v1.Semantic.DeepEqual(testCase.expected, update) {
|
if !api.Semantic.DeepEqual(testCase.expected, update) {
|
||||||
t.Fatalf("%s: Expected: %#v, Got: %#v", testCase.desc, testCase.expected, update)
|
t.Fatalf("%s: Expected: %#v, Got: %#v", testCase.desc, testCase.expected, update)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -23,10 +23,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
|
||||||
"k8s.io/kubernetes/pkg/api/validation"
|
"k8s.io/kubernetes/pkg/api/validation"
|
||||||
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
@ -301,7 +301,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
}
|
}
|
||||||
update := (<-ch).(kubetypes.PodUpdate)
|
update := (<-ch).(kubetypes.PodUpdate)
|
||||||
|
|
||||||
if !v1.Semantic.DeepEqual(testCase.expected, update) {
|
if !api.Semantic.DeepEqual(testCase.expected, update) {
|
||||||
t.Errorf("%s: Expected: %#v, Got: %#v", testCase.desc, testCase.expected, update)
|
t.Errorf("%s: Expected: %#v, Got: %#v", testCase.desc, testCase.expected, update)
|
||||||
}
|
}
|
||||||
for _, pod := range update.Pods {
|
for _, pod := range update.Pods {
|
||||||
|
@ -38,6 +38,7 @@ import (
|
|||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||||
@ -314,10 +315,10 @@ func TestSetEntrypointAndCommand(t *testing.T) {
|
|||||||
}
|
}
|
||||||
setEntrypointAndCommand(tc.container, opts, actualOpts)
|
setEntrypointAndCommand(tc.container, opts, actualOpts)
|
||||||
|
|
||||||
if e, a := tc.expected.Config.Entrypoint, actualOpts.Config.Entrypoint; !v1.Semantic.DeepEqual(e, a) {
|
if e, a := tc.expected.Config.Entrypoint, actualOpts.Config.Entrypoint; !api.Semantic.DeepEqual(e, a) {
|
||||||
t.Errorf("%v: unexpected entrypoint: expected %v, got %v", tc.name, e, a)
|
t.Errorf("%v: unexpected entrypoint: expected %v, got %v", tc.name, e, a)
|
||||||
}
|
}
|
||||||
if e, a := tc.expected.Config.Cmd, actualOpts.Config.Cmd; !v1.Semantic.DeepEqual(e, a) {
|
if e, a := tc.expected.Config.Cmd, actualOpts.Config.Cmd; !api.Semantic.DeepEqual(e, a) {
|
||||||
t.Errorf("%v: unexpected command: expected %v, got %v", tc.name, e, a)
|
t.Errorf("%v: unexpected command: expected %v, got %v", tc.name, e, a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1303,7 +1304,6 @@ func TestSyncPodWithHostNetwork(t *testing.T) {
|
|||||||
{Name: "bar"},
|
{Name: "bar"},
|
||||||
},
|
},
|
||||||
HostNetwork: true,
|
HostNetwork: true,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
runSyncPod(t, dm, fakeDocker, pod, nil, false)
|
runSyncPod(t, dm, fakeDocker, pod, nil, false)
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
|
|
||||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
@ -225,7 +226,7 @@ func TestUpdateNewNodeStatus(t *testing.T) {
|
|||||||
if maxImagesInNodeStatus != len(updatedNode.Status.Images) {
|
if maxImagesInNodeStatus != len(updatedNode.Status.Images) {
|
||||||
t.Errorf("unexpected image list length in node status, expected: %v, got: %v", maxImagesInNodeStatus, len(updatedNode.Status.Images))
|
t.Errorf("unexpected image list length in node status, expected: %v, got: %v", maxImagesInNodeStatus, len(updatedNode.Status.Images))
|
||||||
} else {
|
} else {
|
||||||
if !v1.Semantic.DeepEqual(expectedNode, updatedNode) {
|
if !api.Semantic.DeepEqual(expectedNode, updatedNode) {
|
||||||
t.Errorf("unexpected objects: %s", diff.ObjectDiff(expectedNode, updatedNode))
|
t.Errorf("unexpected objects: %s", diff.ObjectDiff(expectedNode, updatedNode))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -498,7 +499,7 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
|
|||||||
t.Errorf("unexpected node condition order. NodeReady should be last.")
|
t.Errorf("unexpected node condition order. NodeReady should be last.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !v1.Semantic.DeepEqual(expectedNode, updatedNode) {
|
if !api.Semantic.DeepEqual(expectedNode, updatedNode) {
|
||||||
t.Errorf("unexpected objects: %s", diff.ObjectDiff(expectedNode, updatedNode))
|
t.Errorf("unexpected objects: %s", diff.ObjectDiff(expectedNode, updatedNode))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -806,7 +807,7 @@ func TestUpdateNodeStatusWithRuntimeStateError(t *testing.T) {
|
|||||||
LastHeartbeatTime: unversioned.Time{},
|
LastHeartbeatTime: unversioned.Time{},
|
||||||
LastTransitionTime: unversioned.Time{},
|
LastTransitionTime: unversioned.Time{},
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepEqual(expectedNode, updatedNode) {
|
if !api.Semantic.DeepEqual(expectedNode, updatedNode) {
|
||||||
t.Errorf("unexpected objects: %s", diff.ObjectDiff(expectedNode, updatedNode))
|
t.Errorf("unexpected objects: %s", diff.ObjectDiff(expectedNode, updatedNode))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
@ -76,7 +77,7 @@ func TestPodResourceLimitsDefaulting(t *testing.T) {
|
|||||||
for idx, tc := range cases {
|
for idx, tc := range cases {
|
||||||
actual, _, err := tk.kubelet.defaultPodLimitsForDownwardApi(tc.pod, nil)
|
actual, _, err := tk.kubelet.defaultPodLimitsForDownwardApi(tc.pod, nil)
|
||||||
as.Nil(err, "failed to default pod limits: %v", err)
|
as.Nil(err, "failed to default pod limits: %v", err)
|
||||||
if !v1.Semantic.DeepEqual(tc.expected, actual) {
|
if !api.Semantic.DeepEqual(tc.expected, actual) {
|
||||||
as.Fail("test case [%d] failed. Expected: %+v, Got: %+v", idx, tc.expected, actual)
|
as.Fail("test case [%d] failed. Expected: %+v, Got: %+v", idx, tc.expected, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ func NewManager(kubeClient clientset.Interface, podManager kubepod.Manager) Mana
|
|||||||
// This method normalizes the status before comparing so as to make sure that meaningless
|
// This method normalizes the status before comparing so as to make sure that meaningless
|
||||||
// changes will be ignored.
|
// changes will be ignored.
|
||||||
func isStatusEqual(oldStatus, status *v1.PodStatus) bool {
|
func isStatusEqual(oldStatus, status *v1.PodStatus) bool {
|
||||||
return v1.Semantic.DeepEqual(status, oldStatus)
|
return api.Semantic.DeepEqual(status, oldStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *manager) Start() {
|
func (m *manager) Start() {
|
||||||
|
@ -31,6 +31,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||||
@ -262,13 +263,13 @@ func TestServiceAccountTokenAutoMount(t *testing.T) {
|
|||||||
if createdPod.Spec.ServiceAccountName != expectedServiceAccount {
|
if createdPod.Spec.ServiceAccountName != expectedServiceAccount {
|
||||||
t.Fatalf("Expected %s, got %s", expectedServiceAccount, createdPod.Spec.ServiceAccountName)
|
t.Fatalf("Expected %s, got %s", expectedServiceAccount, createdPod.Spec.ServiceAccountName)
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepEqual(&expectedVolumes, &createdPod.Spec.Volumes) {
|
if !api.Semantic.DeepEqual(&expectedVolumes, &createdPod.Spec.Volumes) {
|
||||||
t.Fatalf("Expected\n\t%#v\n\tgot\n\t%#v", expectedVolumes, createdPod.Spec.Volumes)
|
t.Fatalf("Expected\n\t%#v\n\tgot\n\t%#v", expectedVolumes, createdPod.Spec.Volumes)
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepEqual(&expectedContainer1VolumeMounts, &createdPod.Spec.Containers[0].VolumeMounts) {
|
if !api.Semantic.DeepEqual(&expectedContainer1VolumeMounts, &createdPod.Spec.Containers[0].VolumeMounts) {
|
||||||
t.Fatalf("Expected\n\t%#v\n\tgot\n\t%#v", expectedContainer1VolumeMounts, createdPod.Spec.Containers[0].VolumeMounts)
|
t.Fatalf("Expected\n\t%#v\n\tgot\n\t%#v", expectedContainer1VolumeMounts, createdPod.Spec.Containers[0].VolumeMounts)
|
||||||
}
|
}
|
||||||
if !v1.Semantic.DeepEqual(&expectedContainer2VolumeMounts, &createdPod.Spec.Containers[1].VolumeMounts) {
|
if !api.Semantic.DeepEqual(&expectedContainer2VolumeMounts, &createdPod.Spec.Containers[1].VolumeMounts) {
|
||||||
t.Fatalf("Expected\n\t%#v\n\tgot\n\t%#v", expectedContainer2VolumeMounts, createdPod.Spec.Containers[1].VolumeMounts)
|
t.Fatalf("Expected\n\t%#v\n\tgot\n\t%#v", expectedContainer2VolumeMounts, createdPod.Spec.Containers[1].VolumeMounts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -696,7 +696,7 @@ func DoCleanupNode(client clientset.Interface, nodeName string, strategy Prepare
|
|||||||
return fmt.Errorf("Skipping cleanup of Node: failed to get Node %v: %v", nodeName, err)
|
return fmt.Errorf("Skipping cleanup of Node: failed to get Node %v: %v", nodeName, err)
|
||||||
}
|
}
|
||||||
updatedNode := strategy.CleanupNode(node)
|
updatedNode := strategy.CleanupNode(node)
|
||||||
if v1.Semantic.DeepEqual(node, updatedNode) {
|
if api.Semantic.DeepEqual(node, updatedNode) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if _, err = client.Core().Nodes().Update(updatedNode); err == nil {
|
if _, err = client.Core().Nodes().Update(updatedNode); err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user