@@ -1942,13 +1942,11 @@ func ValidatePersistentVolumeUpdate(newPv, oldPv *core.PersistentVolume) field.E
1942
1942
}
1943
1943
1944
1944
// ValidatePersistentVolumeStatusUpdate tests to see if the status update is legal for an end user to make.
1945
- // newPv is updated with fields that cannot be changed.
1946
1945
func ValidatePersistentVolumeStatusUpdate (newPv , oldPv * core.PersistentVolume ) field.ErrorList {
1947
1946
allErrs := ValidateObjectMetaUpdate (& newPv .ObjectMeta , & oldPv .ObjectMeta , field .NewPath ("metadata" ))
1948
1947
if len (newPv .ResourceVersion ) == 0 {
1949
1948
allErrs = append (allErrs , field .Required (field .NewPath ("resourceVersion" ), "" ))
1950
1949
}
1951
- newPv .Spec = oldPv .Spec
1952
1950
return allErrs
1953
1951
}
1954
1952
@@ -2094,7 +2092,6 @@ func ValidatePersistentVolumeClaimStatusUpdate(newPvc, oldPvc *core.PersistentVo
2094
2092
for r , qty := range newPvc .Status .Capacity {
2095
2093
allErrs = append (allErrs , validateBasicResource (qty , capPath .Key (string (r )))... )
2096
2094
}
2097
- newPvc .Spec = oldPvc .Spec
2098
2095
return allErrs
2099
2096
}
2100
2097
@@ -4030,8 +4027,7 @@ func ValidateContainerStateTransition(newStatuses, oldStatuses []core.ContainerS
4030
4027
return allErrs
4031
4028
}
4032
4029
4033
- // ValidatePodStatusUpdate tests to see if the update is legal for an end user to make. newPod is updated with fields
4034
- // that cannot be changed.
4030
+ // ValidatePodStatusUpdate tests to see if the update is legal for an end user to make.
4035
4031
func ValidatePodStatusUpdate (newPod , oldPod * core.Pod ) field.ErrorList {
4036
4032
fldPath := field .NewPath ("metadata" )
4037
4033
allErrs := ValidateObjectMetaUpdate (& newPod .ObjectMeta , & oldPod .ObjectMeta , fldPath )
@@ -4062,9 +4058,6 @@ func ValidatePodStatusUpdate(newPod, oldPod *core.Pod) field.ErrorList {
4062
4058
}
4063
4059
}
4064
4060
4065
- // For status update we ignore changes to pod spec.
4066
- newPod .Spec = oldPod .Spec
4067
-
4068
4061
return allErrs
4069
4062
}
4070
4063
@@ -5511,7 +5504,6 @@ func ValidateResourceQuantityValue(resource string, value resource.Quantity, fld
5511
5504
}
5512
5505
5513
5506
// ValidateResourceQuotaUpdate tests to see if the update is legal for an end user to make.
5514
- // newResourceQuota is updated with fields that cannot be changed.
5515
5507
func ValidateResourceQuotaUpdate (newResourceQuota , oldResourceQuota * core.ResourceQuota ) field.ErrorList {
5516
5508
allErrs := ValidateObjectMetaUpdate (& newResourceQuota .ObjectMeta , & oldResourceQuota .ObjectMeta , field .NewPath ("metadata" ))
5517
5509
allErrs = append (allErrs , ValidateResourceQuotaSpec (& newResourceQuota .Spec , field .NewPath ("spec" ))... )
@@ -5530,12 +5522,10 @@ func ValidateResourceQuotaUpdate(newResourceQuota, oldResourceQuota *core.Resour
5530
5522
allErrs = append (allErrs , field .Invalid (fldPath , newResourceQuota .Spec .Scopes , fieldImmutableErrorMsg ))
5531
5523
}
5532
5524
5533
- newResourceQuota .Status = oldResourceQuota .Status
5534
5525
return allErrs
5535
5526
}
5536
5527
5537
5528
// ValidateResourceQuotaStatusUpdate tests to see if the status update is legal for an end user to make.
5538
- // newResourceQuota is updated with fields that cannot be changed.
5539
5529
func ValidateResourceQuotaStatusUpdate (newResourceQuota , oldResourceQuota * core.ResourceQuota ) field.ErrorList {
5540
5530
allErrs := ValidateObjectMetaUpdate (& newResourceQuota .ObjectMeta , & oldResourceQuota .ObjectMeta , field .NewPath ("metadata" ))
5541
5531
if len (newResourceQuota .ResourceVersion ) == 0 {
@@ -5553,7 +5543,6 @@ func ValidateResourceQuotaStatusUpdate(newResourceQuota, oldResourceQuota *core.
5553
5543
allErrs = append (allErrs , ValidateResourceQuotaResourceName (string (k ), resPath )... )
5554
5544
allErrs = append (allErrs , ValidateResourceQuantityValue (string (k ), v , resPath )... )
5555
5545
}
5556
- newResourceQuota .Spec = oldResourceQuota .Spec
5557
5546
return allErrs
5558
5547
}
5559
5548
@@ -5586,19 +5575,14 @@ func validateKubeFinalizerName(stringValue string, fldPath *field.Path) field.Er
5586
5575
}
5587
5576
5588
5577
// ValidateNamespaceUpdate tests to make sure a namespace update can be applied.
5589
- // newNamespace is updated with fields that cannot be changed
5590
5578
func ValidateNamespaceUpdate (newNamespace * core.Namespace , oldNamespace * core.Namespace ) field.ErrorList {
5591
5579
allErrs := ValidateObjectMetaUpdate (& newNamespace .ObjectMeta , & oldNamespace .ObjectMeta , field .NewPath ("metadata" ))
5592
- newNamespace .Spec .Finalizers = oldNamespace .Spec .Finalizers
5593
- newNamespace .Status = oldNamespace .Status
5594
5580
return allErrs
5595
5581
}
5596
5582
5597
- // ValidateNamespaceStatusUpdate tests to see if the update is legal for an end user to make. newNamespace is updated with fields
5598
- // that cannot be changed.
5583
+ // ValidateNamespaceStatusUpdate tests to see if the update is legal for an end user to make.
5599
5584
func ValidateNamespaceStatusUpdate (newNamespace , oldNamespace * core.Namespace ) field.ErrorList {
5600
5585
allErrs := ValidateObjectMetaUpdate (& newNamespace .ObjectMeta , & oldNamespace .ObjectMeta , field .NewPath ("metadata" ))
5601
- newNamespace .Spec = oldNamespace .Spec
5602
5586
if newNamespace .DeletionTimestamp .IsZero () {
5603
5587
if newNamespace .Status .Phase != core .NamespaceActive {
5604
5588
allErrs = append (allErrs , field .Invalid (field .NewPath ("status" , "Phase" ), newNamespace .Status .Phase , "may only be 'Active' if `deletionTimestamp` is empty" ))
@@ -5612,7 +5596,6 @@ func ValidateNamespaceStatusUpdate(newNamespace, oldNamespace *core.Namespace) f
5612
5596
}
5613
5597
5614
5598
// ValidateNamespaceFinalizeUpdate tests to see if the update is legal for an end user to make.
5615
- // newNamespace is updated with fields that cannot be changed.
5616
5599
func ValidateNamespaceFinalizeUpdate (newNamespace , oldNamespace * core.Namespace ) field.ErrorList {
5617
5600
allErrs := ValidateObjectMetaUpdate (& newNamespace .ObjectMeta , & oldNamespace .ObjectMeta , field .NewPath ("metadata" ))
5618
5601
@@ -5621,7 +5604,6 @@ func ValidateNamespaceFinalizeUpdate(newNamespace, oldNamespace *core.Namespace)
5621
5604
idxPath := fldPath .Index (i )
5622
5605
allErrs = append (allErrs , validateFinalizerName (string (newNamespace .Spec .Finalizers [i ]), idxPath )... )
5623
5606
}
5624
- newNamespace .Status = oldNamespace .Status
5625
5607
return allErrs
5626
5608
}
5627
5609
0 commit comments