Make it easier to update nodes, make it possible to update capacity.

This commit is contained in:
Brendan Burns
2014-12-11 21:39:56 -08:00
parent 7cf0c4d7d7
commit cf0b41535f
4 changed files with 79 additions and 1 deletions

View File

@@ -1178,6 +1178,64 @@ func TestValidateMinionUpdate(t *testing.T) {
Labels: map[string]string{"foo": "baz"},
},
}, true},
{api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
},
Spec: api.NodeSpec{
Capacity: api.ResourceList{
"cpu": util.NewIntOrStringFromInt(10000),
"memory": util.NewIntOrStringFromInt(100),
},
},
}, api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
},
Spec: api.NodeSpec{
Capacity: api.ResourceList{
"cpu": util.NewIntOrStringFromInt(100),
"memory": util.NewIntOrStringFromInt(10000),
},
},
}, true},
{api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"bar": "foo"},
},
Spec: api.NodeSpec{
Capacity: api.ResourceList{
"cpu": util.NewIntOrStringFromInt(10000),
"memory": util.NewIntOrStringFromInt(100),
},
},
}, api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"bar": "fooobaz"},
},
Spec: api.NodeSpec{
Capacity: api.ResourceList{
"cpu": util.NewIntOrStringFromInt(100),
"memory": util.NewIntOrStringFromInt(10000),
},
},
}, true},
{api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"bar": "foo"},
},
}, api.Node{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{"bar": "fooobaz"},
},
Status: api.NodeStatus{
HostIP: "1.2.3.4",
},
}, false},
}
for _, test := range tests {
errs := ValidateMinionUpdate(&test.oldMinion, &test.minion)