mirror of https://github.com/k3s-io/k3s
Merge pull request #3096 from brendandburns/update
Clear node status before the validation check.pull/6/head
commit
bf67e14e9f
|
@ -578,6 +578,8 @@ func ValidateMinionUpdate(oldMinion *api.Node, minion *api.Node) errs.Validation
|
|||
// Allow users to update labels and capacity
|
||||
oldMinion.Labels = minion.Labels
|
||||
oldMinion.Spec.Capacity = minion.Spec.Capacity
|
||||
// Clear status
|
||||
oldMinion.Status = minion.Status
|
||||
|
||||
if !reflect.DeepEqual(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",
|
||||
},
|
||||
}, 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 {
|
||||
errs := ValidateMinionUpdate(&test.oldMinion, &test.minion)
|
||||
|
|
Loading…
Reference in New Issue