mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Improve validation and fix not throwing an error during ns delete
This commit is contained in:
		@@ -1240,6 +1240,15 @@ func ValidateNamespaceStatusUpdate(newNamespace, oldNamespace *api.Namespace) er
 | 
			
		||||
	allErrs := errs.ValidationErrorList{}
 | 
			
		||||
	allErrs = append(allErrs, ValidateObjectMetaUpdate(&oldNamespace.ObjectMeta, &newNamespace.ObjectMeta).Prefix("metadata")...)
 | 
			
		||||
	newNamespace.Spec = oldNamespace.Spec
 | 
			
		||||
	if newNamespace.DeletionTimestamp.IsZero() {
 | 
			
		||||
		if newNamespace.Status.Phase != api.NamespaceActive {
 | 
			
		||||
			allErrs = append(allErrs, errs.NewFieldInvalid("Status.Phase", newNamespace.Status.Phase, "A namespace may only be in active status if it does not have a deletion timestamp."))
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		if newNamespace.Status.Phase != api.NamespaceTerminating {
 | 
			
		||||
			allErrs = append(allErrs, errs.NewFieldInvalid("Status.Phase", newNamespace.Status.Phase, "A namespace may only be in terminating status if it has a deletion timestamp."))
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return allErrs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user