Make deployments work.

This commit is contained in:
Madhusudan.C.S
2016-02-05 18:43:02 -08:00
parent 518f08aa7c
commit ed7ad6dcf3
28 changed files with 485 additions and 385 deletions

View File

@@ -351,13 +351,13 @@ func ValidateDeploymentSpec(spec *extensions.DeploymentSpec, fldPath *field.Path
if spec.Selector == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("selector"), ""))
} else {
allErrs = append(allErrs, ValidateLabelSelector(spec.Selector, fldPath.Child("selector"))...)
allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(spec.Selector, fldPath.Child("selector"))...)
if len(spec.Selector.MatchLabels)+len(spec.Selector.MatchExpressions) == 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, "empty selector is not valid for deployment."))
}
}
selector, err := extensions.LabelSelectorAsSelector(spec.Selector)
selector, err := unversioned.LabelSelectorAsSelector(spec.Selector)
if err != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("selector"), spec.Selector, "failed to convert LabelSelector to Selector."))
} else {

View File

@@ -952,7 +952,7 @@ func validDeployment() *extensions.Deployment {
Namespace: api.NamespaceDefault,
},
Spec: extensions.DeploymentSpec{
Selector: &extensions.LabelSelector{
Selector: &unversioned.LabelSelector{
MatchLabels: map[string]string{
"name": "abc",
},
@@ -1002,7 +1002,7 @@ func TestValidateDeployment(t *testing.T) {
}
// selector should match the labels in pod template.
invalidSelectorDeployment := validDeployment()
invalidSelectorDeployment.Spec.Selector = &extensions.LabelSelector{
invalidSelectorDeployment.Spec.Selector = &unversioned.LabelSelector{
MatchLabels: map[string]string{
"name": "def",
},