@@ -377,8 +377,6 @@ func GetValidationOptionsFromPodSpecAndMeta(podSpec, oldPodSpec *api.PodSpec, po
377
377
// default pod validation options based on feature gate
378
378
opts := apivalidation.PodValidationOptions {
379
379
AllowInvalidPodDeletionCost : ! utilfeature .DefaultFeatureGate .Enabled (features .PodDeletionCost ),
380
- // Allow pod spec to use status.hostIPs in downward API if feature is enabled
381
- AllowHostIPsField : utilfeature .DefaultFeatureGate .Enabled (features .PodHostIPs ),
382
380
// Do not allow pod spec to use non-integer multiple of huge page unit size default
383
381
AllowIndivisibleHugePagesValues : false ,
384
382
AllowInvalidLabelValueInSelector : false ,
@@ -396,9 +394,6 @@ func GetValidationOptionsFromPodSpecAndMeta(podSpec, oldPodSpec *api.PodSpec, po
396
394
opts .AllowOnlyRecursiveSELinuxChangePolicy = useOnlyRecursiveSELinuxChangePolicy (oldPodSpec )
397
395
398
396
if oldPodSpec != nil {
399
- // if old spec has status.hostIPs downwardAPI set, we must allow it
400
- opts .AllowHostIPsField = opts .AllowHostIPsField || hasUsedDownwardAPIFieldPathWithPodSpec (oldPodSpec , "status.hostIPs" )
401
-
402
397
// if old spec used non-integer multiple of huge page unit size, we must allow it
403
398
opts .AllowIndivisibleHugePagesValues = usesIndivisibleHugePagesValues (oldPodSpec )
404
399
@@ -536,55 +531,6 @@ func relaxedEnvVarUsed(name string, oldPodEnvVarNames sets.Set[string]) bool {
536
531
return false
537
532
}
538
533
539
- func hasUsedDownwardAPIFieldPathWithPodSpec (podSpec * api.PodSpec , fieldPath string ) bool {
540
- if podSpec == nil {
541
- return false
542
- }
543
- for _ , vol := range podSpec .Volumes {
544
- if hasUsedDownwardAPIFieldPathWithVolume (& vol , fieldPath ) {
545
- return true
546
- }
547
- }
548
- for _ , c := range podSpec .InitContainers {
549
- if hasUsedDownwardAPIFieldPathWithContainer (& c , fieldPath ) {
550
- return true
551
- }
552
- }
553
- for _ , c := range podSpec .Containers {
554
- if hasUsedDownwardAPIFieldPathWithContainer (& c , fieldPath ) {
555
- return true
556
- }
557
- }
558
- return false
559
- }
560
-
561
- func hasUsedDownwardAPIFieldPathWithVolume (volume * api.Volume , fieldPath string ) bool {
562
- if volume == nil || volume .DownwardAPI == nil {
563
- return false
564
- }
565
- for _ , file := range volume .DownwardAPI .Items {
566
- if file .FieldRef != nil &&
567
- file .FieldRef .FieldPath == fieldPath {
568
- return true
569
- }
570
- }
571
- return false
572
- }
573
-
574
- func hasUsedDownwardAPIFieldPathWithContainer (container * api.Container , fieldPath string ) bool {
575
- if container == nil {
576
- return false
577
- }
578
- for _ , env := range container .Env {
579
- if env .ValueFrom != nil &&
580
- env .ValueFrom .FieldRef != nil &&
581
- env .ValueFrom .FieldRef .FieldPath == fieldPath {
582
- return true
583
- }
584
- }
585
- return false
586
- }
587
-
588
534
// GetValidationOptionsFromPodTemplate will return pod validation options for specified template.
589
535
func GetValidationOptionsFromPodTemplate (podTemplate , oldPodTemplate * api.PodTemplateSpec ) apivalidation.PodValidationOptions {
590
536
var newPodSpec , oldPodSpec * api.PodSpec
@@ -859,11 +805,6 @@ func dropDisabledPodStatusFields(podStatus, oldPodStatus *api.PodStatus, podSpec
859
805
podStatus .ResourceClaimStatuses = nil
860
806
}
861
807
862
- // drop HostIPs to empty (disable PodHostIPs).
863
- if ! utilfeature .DefaultFeatureGate .Enabled (features .PodHostIPs ) && ! hostIPsInUse (oldPodStatus ) {
864
- podStatus .HostIPs = nil
865
- }
866
-
867
808
if ! utilfeature .DefaultFeatureGate .Enabled (features .RecursiveReadOnlyMounts ) && ! rroInUse (oldPodSpec ) {
868
809
for i := range podStatus .ContainerStatuses {
869
810
podStatus .ContainerStatuses [i ].VolumeMounts = nil
@@ -900,13 +841,6 @@ func dropDisabledPodStatusFields(podStatus, oldPodStatus *api.PodStatus, podSpec
900
841
}
901
842
}
902
843
903
- func hostIPsInUse (podStatus * api.PodStatus ) bool {
904
- if podStatus == nil {
905
- return false
906
- }
907
- return len (podStatus .HostIPs ) > 0
908
- }
909
-
910
844
// dropDisabledDynamicResourceAllocationFields removes pod claim references from
911
845
// container specs and pod-level resource claims unless they are already used
912
846
// by the old pod spec.
0 commit comments