allErrs=append(allErrs,field.NewInvalidError(field.NewPath("involvedObject","namespace"),event.InvolvedObject.Namespace,"not required for node"))
allErrs=append(allErrs,field.Invalid(field.NewPath("involvedObject","namespace"),event.InvolvedObject.Namespace,"not required for node"))
}
}
ifevent.InvolvedObject.Kind!="Node"&&
ifevent.InvolvedObject.Kind!="Node"&&
event.Namespace!=event.InvolvedObject.Namespace{
event.Namespace!=event.InvolvedObject.Namespace{
allErrs=append(allErrs,field.NewInvalidError(field.NewPath("involvedObject","namespace"),event.InvolvedObject.Namespace,"does not match involvedObject"))
allErrs=append(allErrs,field.Invalid(field.NewPath("involvedObject","namespace"),event.InvolvedObject.Namespace,"does not match involvedObject"))
allErrs=append(allErrs,field.NewInvalidError(fldPath.Child("deletionGracePeriodSeconds"),newMeta.DeletionGracePeriodSeconds,"field is immutable; may only be changed via deletion"))
allErrs=append(allErrs,field.Invalid(fldPath.Child("deletionGracePeriodSeconds"),newMeta.DeletionGracePeriodSeconds,"field is immutable; may only be changed via deletion"))
}
}
// Reject updates that don't specify a resource version
// Reject updates that don't specify a resource version
ifnewMeta.ResourceVersion==""{
ifnewMeta.ResourceVersion==""{
allErrs=append(allErrs,field.NewInvalidError(fldPath.Child("resourceVersion"),newMeta.ResourceVersion,"resourceVersion must be specified for an update"))
allErrs=append(allErrs,field.Invalid(fldPath.Child("resourceVersion"),newMeta.ResourceVersion,"resourceVersion must be specified for an update"))
allErrors=append(allErrors,field.NewInvalidError(idxPath.Child("containerPort"),port.ContainerPort,"must match hostPort when hostNetwork is set to true"))
allErrors=append(allErrors,field.Invalid(idxPath.Child("containerPort"),port.ContainerPort,"must match hostPort when hostNetwork is set to true"))
//TODO: Pinpoint the specific container that causes the invalid error after we have strategic merge diff
//TODO: Pinpoint the specific container that causes the invalid error after we have strategic merge diff
allErrs=append(allErrs,field.NewInvalidError(specPath.Child("containers"),"contents not printed here, please refer to the \"details\"","may not add or remove containers"))
allErrs=append(allErrs,field.Invalid(specPath.Child("containers"),"contents not printed here, please refer to the \"details\"","may not add or remove containers"))
//TODO: Pinpoint the specific field that causes the invalid error after we have strategic merge diff
//TODO: Pinpoint the specific field that causes the invalid error after we have strategic merge diff
allErrs=append(allErrs,field.NewInvalidError(specPath,"contents not printed here, please refer to the \"details\"","may not update fields other than container.image"))
allErrs=append(allErrs,field.Invalid(specPath,"contents not printed here, please refer to the \"details\"","may not update fields other than container.image"))
allErrs=append(allErrs,field.NewInvalidError(portPath.Child("protocol"),service.Spec.Ports[i].Protocol,"cannot create an external load balancer with non-TCP ports"))
allErrs=append(allErrs,field.Invalid(portPath.Child("protocol"),service.Spec.Ports[i].Protocol,"cannot create an external load balancer with non-TCP ports"))
allErrs=append(allErrs,field.NewInvalidError(portPath.Child("nodePort"),service.Spec.Ports[i].NodePort,"cannot specify a node port with services of type ClusterIP"))
allErrs=append(allErrs,field.Invalid(portPath.Child("nodePort"),service.Spec.Ports[i].NodePort,"cannot specify a node port with services of type ClusterIP"))
// Verify that the RC selector matches the labels in template.
// Verify that the RC selector matches the labels in template.
labels:=labels.Set(template.Labels)
labels:=labels.Set(template.Labels)
if!selector.Matches(labels){
if!selector.Matches(labels){
allErrs=append(allErrs,field.NewInvalidError(fldPath.Child("metadata","labels"),template.Labels,"selector does not match labels in "+fldPath.String()))
allErrs=append(allErrs,field.Invalid(fldPath.Child("metadata","labels"),template.Labels,"selector does not match labels in "+fldPath.String()))
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("gcePersistentDisk",".readOnly"),false,"readOnly must be true for replicated pods > 1, as GCE PD can only be mounted on multiple machines if it is read-only."))
allErrs=append(allErrs,field.Invalid(idxPath.Child("gcePersistentDisk",".readOnly"),false,"readOnly must be true for replicated pods > 1, as GCE PD can only be mounted on multiple machines if it is read-only."))
}
}
}
}
// TODO: What to do for AWS? It doesn't support replicas
// TODO: What to do for AWS? It doesn't support replicas
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("min").Key(string(k)),minQuantity,fmt.Sprintf("min value %s is greater than max value %s",minQuantity.String(),maxQuantity.String())))
allErrs=append(allErrs,field.Invalid(idxPath.Child("min").Key(string(k)),minQuantity,fmt.Sprintf("min value %s is greater than max value %s",minQuantity.String(),maxQuantity.String())))
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("defaultRequest").Key(string(k)),defaultRequestQuantity,fmt.Sprintf("min value %s is greater than default request value %s",minQuantity.String(),defaultRequestQuantity.String())))
allErrs=append(allErrs,field.Invalid(idxPath.Child("defaultRequest").Key(string(k)),defaultRequestQuantity,fmt.Sprintf("min value %s is greater than default request value %s",minQuantity.String(),defaultRequestQuantity.String())))
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("defaultRequest").Key(string(k)),defaultRequestQuantity,fmt.Sprintf("default request value %s is greater than max value %s",defaultRequestQuantity.String(),maxQuantity.String())))
allErrs=append(allErrs,field.Invalid(idxPath.Child("defaultRequest").Key(string(k)),defaultRequestQuantity,fmt.Sprintf("default request value %s is greater than max value %s",defaultRequestQuantity.String(),maxQuantity.String())))
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("defaultRequest").Key(string(k)),defaultRequestQuantity,fmt.Sprintf("default request value %s is greater than default limit value %s",defaultRequestQuantity.String(),defaultQuantity.String())))
allErrs=append(allErrs,field.Invalid(idxPath.Child("defaultRequest").Key(string(k)),defaultRequestQuantity,fmt.Sprintf("default request value %s is greater than default limit value %s",defaultRequestQuantity.String(),defaultQuantity.String())))
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("default").Key(string(k)),minQuantity,fmt.Sprintf("min value %s is greater than default value %s",minQuantity.String(),defaultQuantity.String())))
allErrs=append(allErrs,field.Invalid(idxPath.Child("default").Key(string(k)),minQuantity,fmt.Sprintf("min value %s is greater than default value %s",minQuantity.String(),defaultQuantity.String())))
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("default").Key(string(k)),maxQuantity,fmt.Sprintf("default value %s is greater than max value %s",defaultQuantity.String(),maxQuantity.String())))
allErrs=append(allErrs,field.Invalid(idxPath.Child("default").Key(string(k)),maxQuantity,fmt.Sprintf("default value %s is greater than max value %s",defaultQuantity.String(),maxQuantity.String())))
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("maxLimitRequestRatio").Key(string(k)),maxRatio,fmt.Sprintf("ratio %s is less than 1",maxRatio.String())))
allErrs=append(allErrs,field.Invalid(idxPath.Child("maxLimitRequestRatio").Key(string(k)),maxRatio,fmt.Sprintf("ratio %s is less than 1",maxRatio.String())))
allErrs=append(allErrs,field.NewInvalidError(idxPath.Child("maxLimitRequestRatio").Key(string(k)),maxRatio,fmt.Sprintf("ratio %s is greater than max/min = %f",maxRatio.String(),maxRatioLimit)))
allErrs=append(allErrs,field.Invalid(idxPath.Child("maxLimitRequestRatio").Key(string(k)),maxRatio,fmt.Sprintf("ratio %s is greater than max/min = %f",maxRatio.String(),maxRatioLimit)))
allErrs=append(allErrs,field.NewInvalidError(dataPath.Key(key),key,fmt.Sprintf("must have at most %d characters and match regex %s",validation.DNS1123SubdomainMaxLength,SecretKeyFmt)))
allErrs=append(allErrs,field.Invalid(dataPath.Key(key),key,fmt.Sprintf("must have at most %d characters and match regex %s",validation.DNS1123SubdomainMaxLength,SecretKeyFmt)))
returnappend(allErrs,field.NewInvalidError(fldPath,stringValue,fmt.Sprintf("name is neither a standard finalizer name nor is it fully qualified")))
returnappend(allErrs,field.Invalid(fldPath,stringValue,fmt.Sprintf("name is neither a standard finalizer name nor is it fully qualified")))
}
}
}
}
...
@@ -1914,11 +1914,11 @@ func ValidateNamespaceStatusUpdate(newNamespace, oldNamespace *api.Namespace) fi
...
@@ -1914,11 +1914,11 @@ func ValidateNamespaceStatusUpdate(newNamespace, oldNamespace *api.Namespace) fi
newNamespace.Spec=oldNamespace.Spec
newNamespace.Spec=oldNamespace.Spec
ifnewNamespace.DeletionTimestamp.IsZero(){
ifnewNamespace.DeletionTimestamp.IsZero(){
ifnewNamespace.Status.Phase!=api.NamespaceActive{
ifnewNamespace.Status.Phase!=api.NamespaceActive{
allErrs=append(allErrs,field.NewInvalidError(field.NewPath("status","Phase"),newNamespace.Status.Phase,"may only be in active status if it does not have a deletion timestamp."))
allErrs=append(allErrs,field.Invalid(field.NewPath("status","Phase"),newNamespace.Status.Phase,"may only be in active status if it does not have a deletion timestamp."))
allErrs=append(allErrs,field.NewInvalidError(field.NewPath("status","Phase"),newNamespace.Status.Phase,"may only be in terminating status if it has a deletion timestamp."))
allErrs=append(allErrs,field.Invalid(field.NewPath("status","Phase"),newNamespace.Status.Phase,"may only be in terminating status if it has a deletion timestamp."))
allErrs=append(allErrs,field.NewInvalidError(field.NewPath("tailLines"),*opts.TailLines,"tailLines must be a non-negative integer or nil"))
allErrs=append(allErrs,field.Invalid(field.NewPath("tailLines"),*opts.TailLines,"tailLines must be a non-negative integer or nil"))
}
}
ifopts.LimitBytes!=nil&&*opts.LimitBytes<1{
ifopts.LimitBytes!=nil&&*opts.LimitBytes<1{
allErrs=append(allErrs,field.NewInvalidError(field.NewPath("limitBytes"),*opts.LimitBytes,"limitBytes must be a positive integer or nil"))
allErrs=append(allErrs,field.Invalid(field.NewPath("limitBytes"),*opts.LimitBytes,"limitBytes must be a positive integer or nil"))
}
}
switch{
switch{
caseopts.SinceSeconds!=nil&&opts.SinceTime!=nil:
caseopts.SinceSeconds!=nil&&opts.SinceTime!=nil:
allErrs=append(allErrs,field.NewInvalidError(field.NewPath("sinceSeconds"),*opts.SinceSeconds,"only one of sinceTime or sinceSeconds can be provided"))
allErrs=append(allErrs,field.Invalid(field.NewPath("sinceSeconds"),*opts.SinceSeconds,"only one of sinceTime or sinceSeconds can be provided"))
allErrs=append(allErrs,field.NewInvalidError(field.NewPath("sinceTime"),*opts.SinceTime,"only one of sinceTime or sinceSeconds can be provided"))
allErrs=append(allErrs,field.Invalid(field.NewPath("sinceTime"),*opts.SinceTime,"only one of sinceTime or sinceSeconds can be provided"))
caseopts.SinceSeconds!=nil:
caseopts.SinceSeconds!=nil:
if*opts.SinceSeconds<1{
if*opts.SinceSeconds<1{
allErrs=append(allErrs,field.NewInvalidError(field.NewPath("sinceSeconds"),*opts.SinceSeconds,"sinceSeconds must be a positive integer"))
allErrs=append(allErrs,field.Invalid(field.NewPath("sinceSeconds"),*opts.SinceSeconds,"sinceSeconds must be a positive integer"))
allErrs=append(allErrs,field.NewInvalidError(fldPath.Child("cpuUtilization","targetPercentage"),autoscaler.CPUUtilization.TargetPercentage,`must be greater than or equal to 1`))
allErrs=append(allErrs,field.Invalid(fldPath.Child("cpuUtilization","targetPercentage"),autoscaler.CPUUtilization.TargetPercentage,`must be greater than or equal to 1`))
// TODO: Pinpoint the specific field that causes the invalid error after we have strategic merge diff
// TODO: Pinpoint the specific field that causes the invalid error after we have strategic merge diff
allErrs=append(allErrs,field.NewInvalidError(fldPath.Child("spec"),"content of spec is not printed out, please refer to the \"details\"","may not update fields other than spec.nodeSelector"))
allErrs=append(allErrs,field.Invalid(fldPath.Child("spec"),"content of spec is not printed out, please refer to the \"details\"","may not update fields other than spec.nodeSelector"))
allErrs=append(allErrs,field.NewForbiddenError(fldPath.Child("rollingUpdate"),"should be nil when strategy type is "+extensions.RecreateDeploymentStrategyType))
allErrs=append(allErrs,field.Forbidden(fldPath.Child("rollingUpdate"),"should be nil when strategy type is "+extensions.RecreateDeploymentStrategyType))
allErrs=append(allErrs,field.NewInvalidError(fldPath.Child("rules"),spec.Rules,"Either a default backend or a set of host rules are required for ingress."))
allErrs=append(allErrs,field.Invalid(fldPath.Child("rules"),spec.Rules,"Either a default backend or a set of host rules are required for ingress."))
`Error from server: Invalid2 "invalidation" is invalid: [field1: invalid value 'multi1', Details: details, field2: invalid value 'multi2', Details: details]`,
`Error from server: Invalid2 "invalidation" is invalid: [field1: invalid value 'multi1', Details: details, field2: invalid value 'multi2', Details: details]`,