mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Clear node status before the validation check.
This commit is contained in:
parent
95d4da98bb
commit
9884142061
@ -578,6 +578,8 @@ func ValidateMinionUpdate(oldMinion *api.Node, minion *api.Node) errs.Validation
|
|||||||
// Allow users to update labels and capacity
|
// Allow users to update labels and capacity
|
||||||
oldMinion.Labels = minion.Labels
|
oldMinion.Labels = minion.Labels
|
||||||
oldMinion.Spec.Capacity = minion.Spec.Capacity
|
oldMinion.Spec.Capacity = minion.Spec.Capacity
|
||||||
|
// Clear status
|
||||||
|
oldMinion.Status = minion.Status
|
||||||
|
|
||||||
if !reflect.DeepEqual(oldMinion, minion) {
|
if !reflect.DeepEqual(oldMinion, minion) {
|
||||||
glog.V(4).Infof("Update failed validation %#v vs %#v", oldMinion, minion)
|
glog.V(4).Infof("Update failed validation %#v vs %#v", oldMinion, minion)
|
||||||
|
@ -1236,6 +1236,20 @@ func TestValidateMinionUpdate(t *testing.T) {
|
|||||||
HostIP: "1.2.3.4",
|
HostIP: "1.2.3.4",
|
||||||
},
|
},
|
||||||
}, false},
|
}, false},
|
||||||
|
{api.Node{
|
||||||
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
Name: "foo",
|
||||||
|
Labels: map[string]string{"bar": "foo"},
|
||||||
|
},
|
||||||
|
Status: api.NodeStatus{
|
||||||
|
HostIP: "1.2.3.4",
|
||||||
|
},
|
||||||
|
}, api.Node{
|
||||||
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
Name: "foo",
|
||||||
|
Labels: map[string]string{"bar": "fooobaz"},
|
||||||
|
},
|
||||||
|
}, true},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
errs := ValidateMinionUpdate(&test.oldMinion, &test.minion)
|
errs := ValidateMinionUpdate(&test.oldMinion, &test.minion)
|
||||||
|
Loading…
Reference in New Issue
Block a user