Merge pull request #51761 from karataliu/ccmupdatenode

Automatic merge from submit-queue (batch tested with PRs 51819, 51706, 51761, 51818, 51500)

Fix providerID update validation

**What this PR does / why we need it**:
Cloud controller manager supports updating providerID in #50730, but the node updating was blocked by 
validation rule.

This is to propose a fix for updating the validation rule by allowing altering spec.providerID if not set.

Please check #51596 for detail

**Which issue this PR fixes**
fixes #51596

**Special notes for your reviewer**:

**Release note**:
```release-note
```
This commit is contained in:
Kubernetes Submit Queue
2017-09-03 15:00:07 -07:00
committed by GitHub
2 changed files with 37 additions and 0 deletions

View File

@@ -8375,6 +8375,33 @@ func TestValidateNodeUpdate(t *testing.T) {
},
},
}, false},
{api.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "update-provider-id-when-not-set",
},
}, api.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "update-provider-id-when-not-set",
},
Spec: api.NodeSpec{
ProviderID: "provider:///new",
},
}, true},
{api.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "update-provider-id-when-set",
},
Spec: api.NodeSpec{
ProviderID: "provider:///old",
},
}, api.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "update-provider-id-when-set",
},
Spec: api.NodeSpec{
ProviderID: "provider:///new",
},
}, false},
}
for i, test := range tests {
test.oldNode.ObjectMeta.ResourceVersion = "1"