Merge pull request #99144 from bart0sh/PR0094-promote-HugePageStorageMediumSize-to-GA
promote huge page storage medium size to GA
This commit is contained in:
@@ -48,7 +48,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/apis/core/helper"
|
||||
podshelper "k8s.io/kubernetes/pkg/apis/core/pods"
|
||||
corev1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
||||
"k8s.io/kubernetes/pkg/capabilities"
|
||||
"k8s.io/kubernetes/pkg/cluster/ports"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
@@ -3313,8 +3312,6 @@ func validateContainersOnlyForPod(containers []core.Container, fldPath *field.Pa
|
||||
|
||||
// PodValidationOptions contains the different settings for pod validation
|
||||
type PodValidationOptions struct {
|
||||
// Allow pod spec to have more than one huge page resource (with different sizes)
|
||||
AllowMultipleHugePageResources bool
|
||||
// Allow pod spec to use hugepages in downward API
|
||||
AllowDownwardAPIHugePages bool
|
||||
// Allow invalid pod-deletion-cost annotation value for backward compatibility.
|
||||
@@ -3327,23 +3324,6 @@ type PodValidationOptions struct {
|
||||
AllowExpandedDNSConfig bool
|
||||
}
|
||||
|
||||
// ValidatePodSingleHugePageResources checks if there are multiple huge
|
||||
// pages resources in the pod object.
|
||||
func ValidatePodSingleHugePageResources(pod *core.Pod, specPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
resourceSet := helper.ToPodResourcesSet(&pod.Spec)
|
||||
hugePageResources := sets.NewString()
|
||||
for resourceStr := range resourceSet {
|
||||
if v1helper.IsHugePageResourceName(v1.ResourceName(resourceStr)) {
|
||||
hugePageResources.Insert(resourceStr)
|
||||
}
|
||||
}
|
||||
if len(hugePageResources) > 1 {
|
||||
allErrs = append(allErrs, field.Invalid(specPath, hugePageResources.List(), "must use a single hugepage size in a pod spec"))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
||||
// validatePodMetadataAndSpec tests if required fields in the pod.metadata and pod.spec are set,
|
||||
// and is called by ValidatePodCreate and ValidatePodUpdate.
|
||||
func validatePodMetadataAndSpec(pod *core.Pod, opts PodValidationOptions) field.ErrorList {
|
||||
@@ -3373,10 +3353,6 @@ func validatePodMetadataAndSpec(pod *core.Pod, opts PodValidationOptions) field.
|
||||
allErrs = append(allErrs, validateContainersOnlyForPod(pod.Spec.Containers, specPath.Child("containers"))...)
|
||||
allErrs = append(allErrs, validateContainersOnlyForPod(pod.Spec.InitContainers, specPath.Child("initContainers"))...)
|
||||
|
||||
if !opts.AllowMultipleHugePageResources {
|
||||
allErrs = append(allErrs, ValidatePodSingleHugePageResources(pod, specPath)...)
|
||||
}
|
||||
|
||||
return allErrs
|
||||
}
|
||||
|
||||
@@ -4074,10 +4050,6 @@ func ValidatePodUpdate(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel
|
||||
allErrs = append(allErrs, ValidatePodSpecificAnnotationUpdates(newPod, oldPod, fldPath.Child("annotations"), opts)...)
|
||||
specPath := field.NewPath("spec")
|
||||
|
||||
if !opts.AllowMultipleHugePageResources {
|
||||
allErrs = append(allErrs, ValidatePodSingleHugePageResources(newPod, specPath)...)
|
||||
}
|
||||
|
||||
// validate updateable fields:
|
||||
// 1. spec.containers[*].image
|
||||
// 2. spec.initContainers[*].image
|
||||
|
Reference in New Issue
Block a user