mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 20:57:20 +00:00
Move the internal minion representation to match v1beta3
Moves to 'Spec' and 'Status' internally and removes duplicate fields. Moves Capacity into Spec and drops use of NodeResources
This commit is contained in:
@@ -544,9 +544,7 @@ func ValidateMinion(minion *api.Minion) errs.ValidationErrorList {
|
||||
// ValidateMinionUpdate tests to make sure a minion update can be applied. Modifies oldMinion.
|
||||
func ValidateMinionUpdate(oldMinion *api.Minion, minion *api.Minion) errs.ValidationErrorList {
|
||||
allErrs := errs.ValidationErrorList{}
|
||||
// TODO: why we need two labels for minion.
|
||||
oldMinion.Labels = minion.Labels
|
||||
oldMinion.ObjectMeta.Labels = minion.ObjectMeta.Labels
|
||||
if !reflect.DeepEqual(oldMinion, minion) {
|
||||
allErrs = append(allErrs, fmt.Errorf("Update contains more than labels changes"))
|
||||
}
|
||||
|
@@ -1033,13 +1033,19 @@ func TestValidateMinion(t *testing.T) {
|
||||
invalidSelector := map[string]string{"NoUppercaseOrSpecialCharsLike=Equals": "b"}
|
||||
successCases := []api.Minion{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc"},
|
||||
HostIP: "something",
|
||||
Labels: validSelector,
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "abc",
|
||||
Labels: validSelector,
|
||||
},
|
||||
Status: api.NodeStatus{
|
||||
HostIP: "something",
|
||||
},
|
||||
},
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc"},
|
||||
HostIP: "something",
|
||||
Status: api.NodeStatus{
|
||||
HostIP: "something",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, successCase := range successCases {
|
||||
@@ -1050,13 +1056,19 @@ func TestValidateMinion(t *testing.T) {
|
||||
|
||||
errorCases := map[string]api.Minion{
|
||||
"zero-length Name": {
|
||||
ObjectMeta: api.ObjectMeta{Name: ""},
|
||||
HostIP: "something",
|
||||
Labels: validSelector,
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "",
|
||||
Labels: validSelector,
|
||||
},
|
||||
Status: api.NodeStatus{
|
||||
HostIP: "something",
|
||||
},
|
||||
},
|
||||
"invalid-labels": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "abc-123"},
|
||||
Labels: invalidSelector,
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "abc-123",
|
||||
Labels: invalidSelector,
|
||||
},
|
||||
},
|
||||
}
|
||||
for k, v := range errorCases {
|
||||
|
Reference in New Issue
Block a user