Merge pull request #9919 from liggitt/port_protocol_validation

Validate port protocol case strictly
This commit is contained in:
Satnam Singh
2015-06-19 15:18:03 -07:00
3 changed files with 9 additions and 8 deletions

View File

@@ -610,7 +610,7 @@ func validatePorts(ports []api.ContainerPort) errs.ValidationErrorList {
}
if len(port.Protocol) == 0 {
pErrs = append(pErrs, errs.NewFieldRequired("protocol"))
} else if !supportedPortProtocols.Has(strings.ToUpper(string(port.Protocol))) {
} else if !supportedPortProtocols.Has(string(port.Protocol)) {
pErrs = append(pErrs, errs.NewFieldNotSupported("protocol", port.Protocol))
}
allErrs = append(allErrs, pErrs.PrefixIndex(i)...)
@@ -1144,7 +1144,7 @@ func validateServicePort(sp *api.ServicePort, requireName bool, allNames *util.S
if len(sp.Protocol) == 0 {
allErrs = append(allErrs, errs.NewFieldRequired("protocol"))
} else if !supportedPortProtocols.Has(strings.ToUpper(string(sp.Protocol))) {
} else if !supportedPortProtocols.Has(string(sp.Protocol)) {
allErrs = append(allErrs, errs.NewFieldNotSupported("protocol", sp.Protocol))
}
@@ -1680,7 +1680,7 @@ func validateEndpointPort(port *api.EndpointPort, requireName bool) errs.Validat
}
if len(port.Protocol) == 0 {
allErrs = append(allErrs, errs.NewFieldRequired("protocol"))
} else if !supportedPortProtocols.Has(strings.ToUpper(string(port.Protocol))) {
} else if !supportedPortProtocols.Has(string(port.Protocol)) {
allErrs = append(allErrs, errs.NewFieldNotSupported("protocol", port.Protocol))
}
return allErrs