mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
mark PodOverhead to GA in v1.24; remove in v1.26
This commit is contained in:
parent
8bf64e4128
commit
acd696266e
6
api/openapi-spec/swagger.json
generated
6
api/openapi-spec/swagger.json
generated
@ -8663,7 +8663,7 @@
|
|||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity"
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity"
|
||||||
},
|
},
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"preemptionPolicy": {
|
"preemptionPolicy": {
|
||||||
@ -13194,7 +13194,7 @@
|
|||||||
},
|
},
|
||||||
"overhead": {
|
"overhead": {
|
||||||
"$ref": "#/definitions/io.k8s.api.node.v1.Overhead",
|
"$ref": "#/definitions/io.k8s.api.node.v1.Overhead",
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/\nThis field is in beta starting v1.18 and is only honored by servers that enable the PodOverhead feature."
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/"
|
||||||
},
|
},
|
||||||
"scheduling": {
|
"scheduling": {
|
||||||
"$ref": "#/definitions/io.k8s.api.node.v1.Scheduling",
|
"$ref": "#/definitions/io.k8s.api.node.v1.Scheduling",
|
||||||
@ -13304,7 +13304,7 @@
|
|||||||
},
|
},
|
||||||
"overhead": {
|
"overhead": {
|
||||||
"$ref": "#/definitions/io.k8s.api.node.v1beta1.Overhead",
|
"$ref": "#/definitions/io.k8s.api.node.v1beta1.Overhead",
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature."
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md"
|
||||||
},
|
},
|
||||||
"scheduling": {
|
"scheduling": {
|
||||||
"$ref": "#/definitions/io.k8s.api.node.v1beta1.Scheduling",
|
"$ref": "#/definitions/io.k8s.api.node.v1beta1.Scheduling",
|
||||||
|
@ -4305,7 +4305,7 @@
|
|||||||
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
||||||
"default": {}
|
"default": {}
|
||||||
},
|
},
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"preemptionPolicy": {
|
"preemptionPolicy": {
|
||||||
|
@ -2995,7 +2995,7 @@
|
|||||||
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
||||||
"default": {}
|
"default": {}
|
||||||
},
|
},
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"preemptionPolicy": {
|
"preemptionPolicy": {
|
||||||
|
@ -2221,7 +2221,7 @@
|
|||||||
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
||||||
"default": {}
|
"default": {}
|
||||||
},
|
},
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"preemptionPolicy": {
|
"preemptionPolicy": {
|
||||||
|
@ -2023,7 +2023,7 @@
|
|||||||
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
||||||
"default": {}
|
"default": {}
|
||||||
},
|
},
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"preemptionPolicy": {
|
"preemptionPolicy": {
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
},
|
},
|
||||||
"overhead": {
|
"overhead": {
|
||||||
"$ref": "#/components/schemas/io.k8s.api.node.v1.Overhead",
|
"$ref": "#/components/schemas/io.k8s.api.node.v1.Overhead",
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/\nThis field is in beta starting v1.18 and is only honored by servers that enable the PodOverhead feature."
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/"
|
||||||
},
|
},
|
||||||
"scheduling": {
|
"scheduling": {
|
||||||
"$ref": "#/components/schemas/io.k8s.api.node.v1.Scheduling",
|
"$ref": "#/components/schemas/io.k8s.api.node.v1.Scheduling",
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
},
|
},
|
||||||
"overhead": {
|
"overhead": {
|
||||||
"$ref": "#/components/schemas/io.k8s.api.node.v1beta1.Overhead",
|
"$ref": "#/components/schemas/io.k8s.api.node.v1beta1.Overhead",
|
||||||
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature."
|
"description": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md"
|
||||||
},
|
},
|
||||||
"scheduling": {
|
"scheduling": {
|
||||||
"$ref": "#/components/schemas/io.k8s.api.node.v1beta1.Scheduling",
|
"$ref": "#/components/schemas/io.k8s.api.node.v1beta1.Scheduling",
|
||||||
|
@ -571,11 +571,6 @@ func dropDisabledFields(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) && !overheadInUse(oldPodSpec) {
|
|
||||||
// Set Overhead to nil only if the feature is disabled and it is not used
|
|
||||||
podSpec.Overhead = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
dropDisabledProcMountField(podSpec, oldPodSpec)
|
dropDisabledProcMountField(podSpec, oldPodSpec)
|
||||||
|
|
||||||
dropDisabledCSIVolumeSourceAlphaFields(podSpec, oldPodSpec)
|
dropDisabledCSIVolumeSourceAlphaFields(podSpec, oldPodSpec)
|
||||||
@ -659,17 +654,6 @@ func ephemeralContainersInUse(podSpec *api.PodSpec) bool {
|
|||||||
return len(podSpec.EphemeralContainers) > 0
|
return len(podSpec.EphemeralContainers) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// overheadInUse returns true if the pod spec is non-nil and has Overhead set
|
|
||||||
func overheadInUse(podSpec *api.PodSpec) bool {
|
|
||||||
if podSpec == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if podSpec.Overhead != nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// procMountInUse returns true if the pod spec is non-nil and has a SecurityContext's ProcMount field set to a non-default value
|
// procMountInUse returns true if the pod spec is non-nil and has a SecurityContext's ProcMount field set to a non-default value
|
||||||
func procMountInUse(podSpec *api.PodSpec) bool {
|
func procMountInUse(podSpec *api.PodSpec) bool {
|
||||||
if podSpec == nil {
|
if podSpec == nil {
|
||||||
|
@ -71,7 +71,7 @@ func PodRequestsAndLimitsReuse(pod *v1.Pod, reuseReqs, reuseLimits v1.ResourceLi
|
|||||||
|
|
||||||
// if PodOverhead feature is supported, add overhead for running a pod
|
// if PodOverhead feature is supported, add overhead for running a pod
|
||||||
// to the sum of requests and to non-zero limits:
|
// to the sum of requests and to non-zero limits:
|
||||||
if pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {
|
if pod.Spec.Overhead != nil {
|
||||||
addResourceList(reqs, pod.Spec.Overhead)
|
addResourceList(reqs, pod.Spec.Overhead)
|
||||||
|
|
||||||
for name, quantity := range pod.Spec.Overhead {
|
for name, quantity := range pod.Spec.Overhead {
|
||||||
@ -152,7 +152,7 @@ func GetResourceRequestQuantity(pod *v1.Pod, resourceName v1.ResourceName) resou
|
|||||||
|
|
||||||
// if PodOverhead feature is supported, add overhead for running a pod
|
// if PodOverhead feature is supported, add overhead for running a pod
|
||||||
// to the total requests if the resource total is non-zero
|
// to the total requests if the resource total is non-zero
|
||||||
if pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {
|
if pod.Spec.Overhead != nil {
|
||||||
if podOverhead, ok := pod.Spec.Overhead[resourceName]; ok && !requestQuantity.IsZero() {
|
if podOverhead, ok := pod.Spec.Overhead[resourceName]; ok && !requestQuantity.IsZero() {
|
||||||
requestQuantity.Add(podOverhead)
|
requestQuantity.Add(podOverhead)
|
||||||
}
|
}
|
||||||
|
@ -2944,7 +2944,6 @@ type PodSpec struct {
|
|||||||
// set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value
|
// set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value
|
||||||
// defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero.
|
// defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero.
|
||||||
// More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead
|
// More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead
|
||||||
// This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
Overhead ResourceList
|
Overhead ResourceList
|
||||||
// EnableServiceLinks indicates whether information about services should be injected into pod's
|
// EnableServiceLinks indicates whether information about services should be injected into pod's
|
||||||
|
@ -50,8 +50,6 @@ type RuntimeClass struct {
|
|||||||
// Overhead represents the resource overhead associated with running a pod for a
|
// Overhead represents the resource overhead associated with running a pod for a
|
||||||
// given RuntimeClass. For more details, see
|
// given RuntimeClass. For more details, see
|
||||||
// https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates
|
// https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates
|
||||||
// This field is beta-level as of Kubernetes v1.18, and is only honored by servers
|
|
||||||
// that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
Overhead *Overhead
|
Overhead *Overhead
|
||||||
|
|
||||||
|
@ -391,6 +391,7 @@ const (
|
|||||||
// owner: @egernst
|
// owner: @egernst
|
||||||
// alpha: v1.16
|
// alpha: v1.16
|
||||||
// beta: v1.18
|
// beta: v1.18
|
||||||
|
// ga: v1.24
|
||||||
//
|
//
|
||||||
// Enables PodOverhead, for accounting pod overheads which are specific to a given RuntimeClass
|
// Enables PodOverhead, for accounting pod overheads which are specific to a given RuntimeClass
|
||||||
PodOverhead featuregate.Feature = "PodOverhead"
|
PodOverhead featuregate.Feature = "PodOverhead"
|
||||||
@ -893,7 +894,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
KubeletPodResources: {Default: true, PreRelease: featuregate.Beta},
|
KubeletPodResources: {Default: true, PreRelease: featuregate.Beta},
|
||||||
LocalStorageCapacityIsolationFSQuotaMonitoring: {Default: false, PreRelease: featuregate.Alpha},
|
LocalStorageCapacityIsolationFSQuotaMonitoring: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
NonPreemptingPriority: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
|
NonPreemptingPriority: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
|
||||||
PodOverhead: {Default: true, PreRelease: featuregate.Beta},
|
PodOverhead: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26
|
||||||
IPv6DualStack: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
|
IPv6DualStack: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
|
||||||
EndpointSlice: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
|
EndpointSlice: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
|
||||||
EndpointSliceProxying: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
|
EndpointSliceProxying: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
|
||||||
|
8
pkg/generated/openapi/zz_generated.openapi.go
generated
8
pkg/generated/openapi/zz_generated.openapi.go
generated
@ -22082,7 +22082,7 @@ func schema_k8sio_api_core_v1_PodSpec(ref common.ReferenceCallback) common.OpenA
|
|||||||
},
|
},
|
||||||
"overhead": {
|
"overhead": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
Description: "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
Type: []string{"object"},
|
Type: []string{"object"},
|
||||||
AdditionalProperties: &spec.SchemaOrBool{
|
AdditionalProperties: &spec.SchemaOrBool{
|
||||||
Allows: true,
|
Allows: true,
|
||||||
@ -34565,7 +34565,7 @@ func schema_k8sio_api_node_v1_RuntimeClass(ref common.ReferenceCallback) common.
|
|||||||
},
|
},
|
||||||
"overhead": {
|
"overhead": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/\nThis field is in beta starting v1.18 and is only honored by servers that enable the PodOverhead feature.",
|
Description: "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/",
|
||||||
Ref: ref("k8s.io/api/node/v1.Overhead"),
|
Ref: ref("k8s.io/api/node/v1.Overhead"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -34832,7 +34832,7 @@ func schema_k8sio_api_node_v1alpha1_RuntimeClassSpec(ref common.ReferenceCallbac
|
|||||||
},
|
},
|
||||||
"overhead": {
|
"overhead": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
Description: "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
Ref: ref("k8s.io/api/node/v1alpha1.Overhead"),
|
Ref: ref("k8s.io/api/node/v1alpha1.Overhead"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -34974,7 +34974,7 @@ func schema_k8sio_api_node_v1beta1_RuntimeClass(ref common.ReferenceCallback) co
|
|||||||
},
|
},
|
||||||
"overhead": {
|
"overhead": {
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
Description: "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
Ref: ref("k8s.io/api/node/v1beta1.Overhead"),
|
Ref: ref("k8s.io/api/node/v1beta1.Overhead"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -21,15 +21,13 @@ package kuberuntime
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
|
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||||
resourcehelper "k8s.io/kubernetes/pkg/api/v1/resource"
|
resourcehelper "k8s.io/kubernetes/pkg/api/v1/resource"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *kubeGenericRuntimeManager) convertOverheadToLinuxResources(pod *v1.Pod) *runtimeapi.LinuxContainerResources {
|
func (m *kubeGenericRuntimeManager) convertOverheadToLinuxResources(pod *v1.Pod) *runtimeapi.LinuxContainerResources {
|
||||||
resources := &runtimeapi.LinuxContainerResources{}
|
resources := &runtimeapi.LinuxContainerResources{}
|
||||||
if pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {
|
if pod.Spec.Overhead != nil {
|
||||||
cpu := pod.Spec.Overhead.Cpu()
|
cpu := pod.Spec.Overhead.Cpu()
|
||||||
memory := pod.Spec.Overhead.Memory()
|
memory := pod.Spec.Overhead.Memory()
|
||||||
|
|
||||||
|
@ -30,12 +30,10 @@ import (
|
|||||||
"k8s.io/apiserver/pkg/admission"
|
"k8s.io/apiserver/pkg/admission"
|
||||||
quota "k8s.io/apiserver/pkg/quota/v1"
|
quota "k8s.io/apiserver/pkg/quota/v1"
|
||||||
"k8s.io/apiserver/pkg/quota/v1/generic"
|
"k8s.io/apiserver/pkg/quota/v1/generic"
|
||||||
"k8s.io/apiserver/pkg/util/feature"
|
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
k8s_api_v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
k8s_api_v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||||
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
||||||
"k8s.io/kubernetes/pkg/apis/core/v1/helper/qos"
|
"k8s.io/kubernetes/pkg/apis/core/v1/helper/qos"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
"k8s.io/utils/clock"
|
"k8s.io/utils/clock"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -369,10 +367,9 @@ func PodUsageFunc(obj runtime.Object, clock clock.Clock) (corev1.ResourceList, e
|
|||||||
limits = quota.Max(limits, pod.Spec.InitContainers[i].Resources.Limits)
|
limits = quota.Max(limits, pod.Spec.InitContainers[i].Resources.Limits)
|
||||||
}
|
}
|
||||||
|
|
||||||
if feature.DefaultFeatureGate.Enabled(features.PodOverhead) {
|
requests = quota.Add(requests, pod.Spec.Overhead)
|
||||||
requests = quota.Add(requests, pod.Spec.Overhead)
|
limits = quota.Add(limits, pod.Spec.Overhead)
|
||||||
limits = quota.Add(limits, pod.Spec.Overhead)
|
|
||||||
}
|
|
||||||
result = quota.Add(result, podComputeUsageHelper(requests, limits))
|
result = quota.Add(result, podComputeUsageHelper(requests, limits))
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
quota "k8s.io/apiserver/pkg/quota/v1"
|
quota "k8s.io/apiserver/pkg/quota/v1"
|
||||||
"k8s.io/apiserver/pkg/quota/v1/generic"
|
"k8s.io/apiserver/pkg/quota/v1/generic"
|
||||||
"k8s.io/apiserver/pkg/util/feature"
|
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
"k8s.io/kubernetes/pkg/util/node"
|
"k8s.io/kubernetes/pkg/util/node"
|
||||||
"k8s.io/utils/clock"
|
"k8s.io/utils/clock"
|
||||||
testingclock "k8s.io/utils/clock/testing"
|
testingclock "k8s.io/utils/clock/testing"
|
||||||
@ -154,9 +151,8 @@ func TestPodEvaluatorUsage(t *testing.T) {
|
|||||||
deletionTimestampNotPastGracePeriod := metav1.NewTime(fakeClock.Now())
|
deletionTimestampNotPastGracePeriod := metav1.NewTime(fakeClock.Now())
|
||||||
|
|
||||||
testCases := map[string]struct {
|
testCases := map[string]struct {
|
||||||
pod *api.Pod
|
pod *api.Pod
|
||||||
usage corev1.ResourceList
|
usage corev1.ResourceList
|
||||||
podOverheadEnabled bool
|
|
||||||
}{
|
}{
|
||||||
"init container CPU": {
|
"init container CPU": {
|
||||||
pod: &api.Pod{
|
pod: &api.Pod{
|
||||||
@ -525,41 +521,11 @@ func TestPodEvaluatorUsage(t *testing.T) {
|
|||||||
corev1.ResourceCPU: resource.MustParse("2"),
|
corev1.ResourceCPU: resource.MustParse("2"),
|
||||||
generic.ObjectCountQuotaResourceNameFor(schema.GroupResource{Resource: "pods"}): resource.MustParse("1"),
|
generic.ObjectCountQuotaResourceNameFor(schema.GroupResource{Resource: "pods"}): resource.MustParse("1"),
|
||||||
},
|
},
|
||||||
podOverheadEnabled: true,
|
|
||||||
},
|
|
||||||
"do not count pod overhead as usage with pod overhead disabled": {
|
|
||||||
pod: &api.Pod{
|
|
||||||
Spec: api.PodSpec{
|
|
||||||
Overhead: api.ResourceList{
|
|
||||||
api.ResourceCPU: resource.MustParse("1"),
|
|
||||||
},
|
|
||||||
Containers: []api.Container{
|
|
||||||
{
|
|
||||||
Resources: api.ResourceRequirements{
|
|
||||||
Requests: api.ResourceList{
|
|
||||||
api.ResourceCPU: resource.MustParse("1"),
|
|
||||||
},
|
|
||||||
Limits: api.ResourceList{
|
|
||||||
api.ResourceCPU: resource.MustParse("2"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
usage: corev1.ResourceList{
|
|
||||||
corev1.ResourceRequestsCPU: resource.MustParse("1"),
|
|
||||||
corev1.ResourceLimitsCPU: resource.MustParse("2"),
|
|
||||||
corev1.ResourcePods: resource.MustParse("1"),
|
|
||||||
corev1.ResourceCPU: resource.MustParse("1"),
|
|
||||||
generic.ObjectCountQuotaResourceNameFor(schema.GroupResource{Resource: "pods"}): resource.MustParse("1"),
|
|
||||||
},
|
|
||||||
podOverheadEnabled: false,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
t.Parallel()
|
||||||
for testName, testCase := range testCases {
|
for testName, testCase := range testCases {
|
||||||
t.Run(testName, func(t *testing.T) {
|
t.Run(testName, func(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.PodOverhead, testCase.podOverheadEnabled)()
|
|
||||||
actual, err := evaluator.Usage(testCase.pod)
|
actual, err := evaluator.Usage(testCase.pod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
@ -23,11 +23,9 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||||
"k8s.io/apiserver/pkg/registry/rest"
|
"k8s.io/apiserver/pkg/registry/rest"
|
||||||
"k8s.io/apiserver/pkg/storage/names"
|
"k8s.io/apiserver/pkg/storage/names"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
"k8s.io/kubernetes/pkg/apis/node"
|
"k8s.io/kubernetes/pkg/apis/node"
|
||||||
"k8s.io/kubernetes/pkg/apis/node/validation"
|
"k8s.io/kubernetes/pkg/apis/node/validation"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// strategy implements verification logic for RuntimeClass.
|
// strategy implements verification logic for RuntimeClass.
|
||||||
@ -58,12 +56,6 @@ func (strategy) AllowCreateOnUpdate() bool {
|
|||||||
// PrepareForCreate clears fields that are not allowed to be set by end users
|
// PrepareForCreate clears fields that are not allowed to be set by end users
|
||||||
// on creation.
|
// on creation.
|
||||||
func (strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
func (strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
||||||
rc := obj.(*node.RuntimeClass)
|
|
||||||
|
|
||||||
if !utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) && rc != nil {
|
|
||||||
// Set Overhead to nil only if the feature is disabled and it is not used
|
|
||||||
rc.Overhead = nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||||
|
@ -25,14 +25,12 @@ import (
|
|||||||
storagev1 "k8s.io/api/storage/v1"
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/apiserver/pkg/util/feature"
|
|
||||||
"k8s.io/client-go/dynamic/dynamicinformer"
|
"k8s.io/client-go/dynamic/dynamicinformer"
|
||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
corev1helpers "k8s.io/component-helpers/scheduling/corev1"
|
corev1helpers "k8s.io/component-helpers/scheduling/corev1"
|
||||||
corev1nodeaffinity "k8s.io/component-helpers/scheduling/corev1/nodeaffinity"
|
corev1nodeaffinity "k8s.io/component-helpers/scheduling/corev1/nodeaffinity"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodename"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodename"
|
||||||
@ -491,7 +489,7 @@ func preCheckForNode(nodeInfo *framework.NodeInfo) queue.PreEnqueueCheck {
|
|||||||
// returns all failures.
|
// returns all failures.
|
||||||
func AdmissionCheck(pod *v1.Pod, nodeInfo *framework.NodeInfo, includeAllFailures bool) []AdmissionResult {
|
func AdmissionCheck(pod *v1.Pod, nodeInfo *framework.NodeInfo, includeAllFailures bool) []AdmissionResult {
|
||||||
var admissionResults []AdmissionResult
|
var admissionResults []AdmissionResult
|
||||||
insufficientResources := noderesources.Fits(pod, nodeInfo, feature.DefaultFeatureGate.Enabled(features.PodOverhead))
|
insufficientResources := noderesources.Fits(pod, nodeInfo)
|
||||||
if len(insufficientResources) != 0 {
|
if len(insufficientResources) != 0 {
|
||||||
for i := range insufficientResources {
|
for i := range insufficientResources {
|
||||||
admissionResults = append(admissionResults, AdmissionResult{InsufficientResource: &insufficientResources[i]})
|
admissionResults = append(admissionResults, AdmissionResult{InsufficientResource: &insufficientResources[i]})
|
||||||
|
@ -37,9 +37,6 @@ import (
|
|||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
|
|
||||||
"k8s.io/apiserver/pkg/util/feature"
|
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework"
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodename"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodename"
|
||||||
@ -506,7 +503,6 @@ func TestAdmissionCheck(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.PodOverhead, true)()
|
|
||||||
nodeInfo := framework.NewNodeInfo(tt.existingPods...)
|
nodeInfo := framework.NewNodeInfo(tt.existingPods...)
|
||||||
nodeInfo.SetNode(tt.node)
|
nodeInfo.SetNode(tt.node)
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ package feature
|
|||||||
type Features struct {
|
type Features struct {
|
||||||
EnablePodAffinityNamespaceSelector bool
|
EnablePodAffinityNamespaceSelector bool
|
||||||
EnablePodDisruptionBudget bool
|
EnablePodDisruptionBudget bool
|
||||||
EnablePodOverhead bool
|
|
||||||
EnableReadWriteOncePod bool
|
EnableReadWriteOncePod bool
|
||||||
EnableVolumeCapacityPriority bool
|
EnableVolumeCapacityPriority bool
|
||||||
EnableCSIStorageCapacity bool
|
EnableCSIStorageCapacity bool
|
||||||
|
@ -91,7 +91,6 @@ func NewBalancedAllocation(baArgs runtime.Object, h framework.Handle, fts featur
|
|||||||
scorer: balancedResourceScorer,
|
scorer: balancedResourceScorer,
|
||||||
useRequested: true,
|
useRequested: true,
|
||||||
resourceToWeightMap: resToWeightMap,
|
resourceToWeightMap: resToWeightMap,
|
||||||
enablePodOverhead: fts.EnablePodOverhead,
|
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ func TestNodeResourcesBalancedAllocation(t *testing.T) {
|
|||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
snapshot := cache.NewSnapshot(test.pods, test.nodes)
|
snapshot := cache.NewSnapshot(test.pods, test.nodes)
|
||||||
fh, _ := runtime.NewFramework(nil, nil, runtime.WithSnapshotSharedLister(snapshot))
|
fh, _ := runtime.NewFramework(nil, nil, runtime.WithSnapshotSharedLister(snapshot))
|
||||||
p, _ := NewBalancedAllocation(&test.args, fh, feature.Features{EnablePodOverhead: true})
|
p, _ := NewBalancedAllocation(&test.args, fh, feature.Features{})
|
||||||
for i := range test.nodes {
|
for i := range test.nodes {
|
||||||
hostResult, err := p.(framework.ScorePlugin).Score(context.Background(), nil, test.pod, test.nodes[i].Name)
|
hostResult, err := p.(framework.ScorePlugin).Score(context.Background(), nil, test.pod, test.nodes[i].Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -78,7 +78,6 @@ var nodeResourceStrategyTypeMap = map[config.ScoringStrategyType]scorer{
|
|||||||
type Fit struct {
|
type Fit struct {
|
||||||
ignoredResources sets.String
|
ignoredResources sets.String
|
||||||
ignoredResourceGroups sets.String
|
ignoredResourceGroups sets.String
|
||||||
enablePodOverhead bool
|
|
||||||
handle framework.Handle
|
handle framework.Handle
|
||||||
resourceAllocationScorer
|
resourceAllocationScorer
|
||||||
}
|
}
|
||||||
@ -126,7 +125,6 @@ func NewFit(plArgs runtime.Object, h framework.Handle, fts feature.Features) (fr
|
|||||||
return &Fit{
|
return &Fit{
|
||||||
ignoredResources: sets.NewString(args.IgnoredResources...),
|
ignoredResources: sets.NewString(args.IgnoredResources...),
|
||||||
ignoredResourceGroups: sets.NewString(args.IgnoredResourceGroups...),
|
ignoredResourceGroups: sets.NewString(args.IgnoredResourceGroups...),
|
||||||
enablePodOverhead: fts.EnablePodOverhead,
|
|
||||||
handle: h,
|
handle: h,
|
||||||
resourceAllocationScorer: *scorePlugin(args),
|
resourceAllocationScorer: *scorePlugin(args),
|
||||||
}, nil
|
}, nil
|
||||||
@ -137,8 +135,7 @@ func NewFit(plArgs runtime.Object, h framework.Handle, fts feature.Features) (fr
|
|||||||
// the max in each dimension iteratively. In contrast, we sum the resource vectors for
|
// the max in each dimension iteratively. In contrast, we sum the resource vectors for
|
||||||
// regular containers since they run simultaneously.
|
// regular containers since they run simultaneously.
|
||||||
//
|
//
|
||||||
// If Pod Overhead is specified and the feature gate is set, the resources defined for Overhead
|
// The resources defined for Overhead should be added to the calculated Resource request sum
|
||||||
// are added to the calculated Resource request sum
|
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
@ -159,7 +156,7 @@ func NewFit(plArgs runtime.Object, h framework.Handle, fts feature.Features) (fr
|
|||||||
// Memory: 1G
|
// Memory: 1G
|
||||||
//
|
//
|
||||||
// Result: CPU: 3, Memory: 3G
|
// Result: CPU: 3, Memory: 3G
|
||||||
func computePodResourceRequest(pod *v1.Pod, enablePodOverhead bool) *preFilterState {
|
func computePodResourceRequest(pod *v1.Pod) *preFilterState {
|
||||||
result := &preFilterState{}
|
result := &preFilterState{}
|
||||||
for _, container := range pod.Spec.Containers {
|
for _, container := range pod.Spec.Containers {
|
||||||
result.Add(container.Resources.Requests)
|
result.Add(container.Resources.Requests)
|
||||||
@ -171,7 +168,7 @@ func computePodResourceRequest(pod *v1.Pod, enablePodOverhead bool) *preFilterSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If Overhead is being utilized, add to the total requests for the pod
|
// If Overhead is being utilized, add to the total requests for the pod
|
||||||
if pod.Spec.Overhead != nil && enablePodOverhead {
|
if pod.Spec.Overhead != nil {
|
||||||
result.Add(pod.Spec.Overhead)
|
result.Add(pod.Spec.Overhead)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@ -179,7 +176,7 @@ func computePodResourceRequest(pod *v1.Pod, enablePodOverhead bool) *preFilterSt
|
|||||||
|
|
||||||
// PreFilter invoked at the prefilter extension point.
|
// PreFilter invoked at the prefilter extension point.
|
||||||
func (f *Fit) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status) {
|
func (f *Fit) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status) {
|
||||||
cycleState.Write(preFilterStateKey, computePodResourceRequest(pod, f.enablePodOverhead))
|
cycleState.Write(preFilterStateKey, computePodResourceRequest(pod))
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,8 +245,8 @@ type InsufficientResource struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fits checks if node have enough resources to host the pod.
|
// Fits checks if node have enough resources to host the pod.
|
||||||
func Fits(pod *v1.Pod, nodeInfo *framework.NodeInfo, enablePodOverhead bool) []InsufficientResource {
|
func Fits(pod *v1.Pod, nodeInfo *framework.NodeInfo) []InsufficientResource {
|
||||||
return fitsRequest(computePodResourceRequest(pod, enablePodOverhead), nodeInfo, nil, nil)
|
return fitsRequest(computePodResourceRequest(pod), nodeInfo, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func fitsRequest(podRequest *preFilterState, nodeInfo *framework.NodeInfo, ignoredExtendedResources, ignoredResourceGroups sets.String) []InsufficientResource {
|
func fitsRequest(podRequest *preFilterState, nodeInfo *framework.NodeInfo, ignoredExtendedResources, ignoredResourceGroups sets.String) []InsufficientResource {
|
||||||
|
@ -472,7 +472,7 @@ func TestEnoughRequests(t *testing.T) {
|
|||||||
test.args.ScoringStrategy = defaultScoringStrategy
|
test.args.ScoringStrategy = defaultScoringStrategy
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := NewFit(&test.args, nil, plfeature.Features{EnablePodOverhead: true})
|
p, err := NewFit(&test.args, nil, plfeature.Features{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ func TestEnoughRequests(t *testing.T) {
|
|||||||
t.Errorf("status does not match: %v, want: %v", gotStatus, test.wantStatus)
|
t.Errorf("status does not match: %v, want: %v", gotStatus, test.wantStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
gotInsufficientResources := fitsRequest(computePodResourceRequest(test.pod, true), test.nodeInfo, p.(*Fit).ignoredResources, p.(*Fit).ignoredResourceGroups)
|
gotInsufficientResources := fitsRequest(computePodResourceRequest(test.pod), test.nodeInfo, p.(*Fit).ignoredResources, p.(*Fit).ignoredResourceGroups)
|
||||||
if !reflect.DeepEqual(gotInsufficientResources, test.wantInsufficientResources) {
|
if !reflect.DeepEqual(gotInsufficientResources, test.wantInsufficientResources) {
|
||||||
t.Errorf("insufficient resources do not match: %+v, want: %v", gotInsufficientResources, test.wantInsufficientResources)
|
t.Errorf("insufficient resources do not match: %+v, want: %v", gotInsufficientResources, test.wantInsufficientResources)
|
||||||
}
|
}
|
||||||
@ -500,7 +500,7 @@ func TestPreFilterDisabled(t *testing.T) {
|
|||||||
nodeInfo := framework.NewNodeInfo()
|
nodeInfo := framework.NewNodeInfo()
|
||||||
node := v1.Node{}
|
node := v1.Node{}
|
||||||
nodeInfo.SetNode(&node)
|
nodeInfo.SetNode(&node)
|
||||||
p, err := NewFit(&config.NodeResourcesFitArgs{ScoringStrategy: defaultScoringStrategy}, nil, plfeature.Features{EnablePodOverhead: true})
|
p, err := NewFit(&config.NodeResourcesFitArgs{ScoringStrategy: defaultScoringStrategy}, nil, plfeature.Features{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -550,7 +550,7 @@ func TestNotEnoughRequests(t *testing.T) {
|
|||||||
node := v1.Node{Status: v1.NodeStatus{Capacity: v1.ResourceList{}, Allocatable: makeAllocatableResources(10, 20, 1, 0, 0, 0)}}
|
node := v1.Node{Status: v1.NodeStatus{Capacity: v1.ResourceList{}, Allocatable: makeAllocatableResources(10, 20, 1, 0, 0, 0)}}
|
||||||
test.nodeInfo.SetNode(&node)
|
test.nodeInfo.SetNode(&node)
|
||||||
|
|
||||||
p, err := NewFit(&config.NodeResourcesFitArgs{ScoringStrategy: defaultScoringStrategy}, nil, plfeature.Features{EnablePodOverhead: true})
|
p, err := NewFit(&config.NodeResourcesFitArgs{ScoringStrategy: defaultScoringStrategy}, nil, plfeature.Features{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -622,7 +622,7 @@ func TestStorageRequests(t *testing.T) {
|
|||||||
node := v1.Node{Status: v1.NodeStatus{Capacity: makeResources(10, 20, 32, 5, 20, 5).Capacity, Allocatable: makeAllocatableResources(10, 20, 32, 5, 20, 5)}}
|
node := v1.Node{Status: v1.NodeStatus{Capacity: makeResources(10, 20, 32, 5, 20, 5).Capacity, Allocatable: makeAllocatableResources(10, 20, 32, 5, 20, 5)}}
|
||||||
test.nodeInfo.SetNode(&node)
|
test.nodeInfo.SetNode(&node)
|
||||||
|
|
||||||
p, err := NewFit(&config.NodeResourcesFitArgs{ScoringStrategy: defaultScoringStrategy}, nil, plfeature.Features{EnablePodOverhead: true})
|
p, err := NewFit(&config.NodeResourcesFitArgs{ScoringStrategy: defaultScoringStrategy}, nil, plfeature.Features{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -759,7 +759,7 @@ func TestFitScore(t *testing.T) {
|
|||||||
snapshot := cache.NewSnapshot(test.existingPods, test.nodes)
|
snapshot := cache.NewSnapshot(test.existingPods, test.nodes)
|
||||||
fh, _ := runtime.NewFramework(nil, nil, runtime.WithSnapshotSharedLister(snapshot))
|
fh, _ := runtime.NewFramework(nil, nil, runtime.WithSnapshotSharedLister(snapshot))
|
||||||
args := test.nodeResourcesFitArgs
|
args := test.nodeResourcesFitArgs
|
||||||
p, err := NewFit(&args, fh, plfeature.Features{EnablePodOverhead: true})
|
p, err := NewFit(&args, fh, plfeature.Features{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ func TestLeastAllocatedScoringStrategy(t *testing.T) {
|
|||||||
Type: config.LeastAllocated,
|
Type: config.LeastAllocated,
|
||||||
Resources: test.resources,
|
Resources: test.resources,
|
||||||
},
|
},
|
||||||
}, fh, plfeature.Features{EnablePodOverhead: true})
|
}, fh, plfeature.Features{})
|
||||||
|
|
||||||
if diff := cmp.Diff(test.wantErrs.ToAggregate(), err, ignoreBadValueDetail); diff != "" {
|
if diff := cmp.Diff(test.wantErrs.ToAggregate(), err, ignoreBadValueDetail); diff != "" {
|
||||||
t.Fatalf("got err (-want,+got):\n%s", diff)
|
t.Fatalf("got err (-want,+got):\n%s", diff)
|
||||||
|
@ -340,7 +340,7 @@ func TestMostAllocatedScoringStrategy(t *testing.T) {
|
|||||||
Type: config.MostAllocated,
|
Type: config.MostAllocated,
|
||||||
Resources: test.resources,
|
Resources: test.resources,
|
||||||
},
|
},
|
||||||
}, fh, plfeature.Features{EnablePodOverhead: true})
|
}, fh, plfeature.Features{})
|
||||||
|
|
||||||
if diff := cmp.Diff(test.wantErrs.ToAggregate(), err, ignoreBadValueDetail); diff != "" {
|
if diff := cmp.Diff(test.wantErrs.ToAggregate(), err, ignoreBadValueDetail); diff != "" {
|
||||||
t.Fatalf("got err (-want,+got):\n%s", diff)
|
t.Fatalf("got err (-want,+got):\n%s", diff)
|
||||||
|
@ -121,7 +121,7 @@ func TestRequestedToCapacityRatioScoringStrategy(t *testing.T) {
|
|||||||
Shape: shape,
|
Shape: shape,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, fh, plfeature.Features{EnablePodOverhead: true})
|
}, fh, plfeature.Features{})
|
||||||
|
|
||||||
if diff := cmp.Diff(test.wantErrs.ToAggregate(), err, ignoreBadValueDetail); diff != "" {
|
if diff := cmp.Diff(test.wantErrs.ToAggregate(), err, ignoreBadValueDetail); diff != "" {
|
||||||
t.Fatalf("got err (-want,+got):\n%s", diff)
|
t.Fatalf("got err (-want,+got):\n%s", diff)
|
||||||
@ -340,7 +340,7 @@ func TestResourceBinPackingSingleExtended(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
p, err := NewFit(&args, fh, feature.Features{EnablePodOverhead: true})
|
p, err := NewFit(&args, fh, feature.Features{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
@ -588,7 +588,7 @@ func TestResourceBinPackingMultipleExtended(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := NewFit(&args, fh, feature.Features{EnablePodOverhead: true})
|
p, err := NewFit(&args, fh, feature.Features{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,6 @@ type resourceAllocationScorer struct {
|
|||||||
useRequested bool
|
useRequested bool
|
||||||
scorer func(requested, allocable resourceToValueMap) int64
|
scorer func(requested, allocable resourceToValueMap) int64
|
||||||
resourceToWeightMap resourceToWeightMap
|
resourceToWeightMap resourceToWeightMap
|
||||||
|
|
||||||
enablePodOverhead bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// resourceToValueMap is keyed with resource name and valued with quantity.
|
// resourceToValueMap is keyed with resource name and valued with quantity.
|
||||||
@ -129,7 +127,7 @@ func (r *resourceAllocationScorer) calculatePodResourceRequest(pod *v1.Pod, reso
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If Overhead is being utilized, add to the total requests for the pod
|
// If Overhead is being utilized, add to the total requests for the pod
|
||||||
if pod.Spec.Overhead != nil && r.enablePodOverhead {
|
if pod.Spec.Overhead != nil {
|
||||||
if quantity, found := pod.Spec.Overhead[resource]; found {
|
if quantity, found := pod.Spec.Overhead[resource]; found {
|
||||||
podRequest += quantity.Value()
|
podRequest += quantity.Value()
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ import (
|
|||||||
func NewInTreeRegistry() runtime.Registry {
|
func NewInTreeRegistry() runtime.Registry {
|
||||||
fts := plfeature.Features{
|
fts := plfeature.Features{
|
||||||
EnablePodDisruptionBudget: feature.DefaultFeatureGate.Enabled(features.PodDisruptionBudget),
|
EnablePodDisruptionBudget: feature.DefaultFeatureGate.Enabled(features.PodDisruptionBudget),
|
||||||
EnablePodOverhead: feature.DefaultFeatureGate.Enabled(features.PodOverhead),
|
|
||||||
EnableReadWriteOncePod: feature.DefaultFeatureGate.Enabled(features.ReadWriteOncePod),
|
EnableReadWriteOncePod: feature.DefaultFeatureGate.Enabled(features.ReadWriteOncePod),
|
||||||
EnableVolumeCapacityPriority: feature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority),
|
EnableVolumeCapacityPriority: feature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority),
|
||||||
EnableCSIStorageCapacity: feature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity),
|
EnableCSIStorageCapacity: feature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity),
|
||||||
|
@ -736,7 +736,7 @@ func calculateResource(pod *v1.Pod) (res Resource, non0CPU int64, non0Mem int64)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If Overhead is being utilized, add to the total requests for the pod
|
// If Overhead is being utilized, add to the total requests for the pod
|
||||||
if pod.Spec.Overhead != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) {
|
if pod.Spec.Overhead != nil {
|
||||||
resPtr.Add(pod.Spec.Overhead)
|
resPtr.Add(pod.Spec.Overhead)
|
||||||
if _, found := pod.Spec.Overhead[v1.ResourceCPU]; found {
|
if _, found := pod.Spec.Overhead[v1.ResourceCPU]; found {
|
||||||
non0CPU += pod.Spec.Overhead.Cpu().MilliValue()
|
non0CPU += pod.Spec.Overhead.Cpu().MilliValue()
|
||||||
|
@ -36,11 +36,9 @@ import (
|
|||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
nodev1client "k8s.io/client-go/kubernetes/typed/node/v1"
|
nodev1client "k8s.io/client-go/kubernetes/typed/node/v1"
|
||||||
nodev1listers "k8s.io/client-go/listers/node/v1"
|
nodev1listers "k8s.io/client-go/listers/node/v1"
|
||||||
"k8s.io/component-base/featuregate"
|
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
node "k8s.io/kubernetes/pkg/apis/node"
|
node "k8s.io/kubernetes/pkg/apis/node"
|
||||||
apinodev1 "k8s.io/kubernetes/pkg/apis/node/v1"
|
apinodev1 "k8s.io/kubernetes/pkg/apis/node/v1"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
"k8s.io/kubernetes/pkg/util/tolerations"
|
"k8s.io/kubernetes/pkg/util/tolerations"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -62,9 +60,6 @@ type RuntimeClass struct {
|
|||||||
*admission.Handler
|
*admission.Handler
|
||||||
runtimeClassLister nodev1listers.RuntimeClassLister
|
runtimeClassLister nodev1listers.RuntimeClassLister
|
||||||
runtimeClassClient nodev1client.RuntimeClassInterface
|
runtimeClassClient nodev1client.RuntimeClassInterface
|
||||||
|
|
||||||
inspectedFeatures bool
|
|
||||||
podOverheadEnabled bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ admission.MutationInterface = &RuntimeClass{}
|
var _ admission.MutationInterface = &RuntimeClass{}
|
||||||
@ -78,12 +73,6 @@ func (r *RuntimeClass) SetExternalKubeClientSet(client kubernetes.Interface) {
|
|||||||
r.runtimeClassClient = client.NodeV1().RuntimeClasses()
|
r.runtimeClassClient = client.NodeV1().RuntimeClasses()
|
||||||
}
|
}
|
||||||
|
|
||||||
// InspectFeatureGates allows setting bools without taking a dep on a global variable
|
|
||||||
func (r *RuntimeClass) InspectFeatureGates(featureGates featuregate.FeatureGate) {
|
|
||||||
r.podOverheadEnabled = featureGates.Enabled(features.PodOverhead)
|
|
||||||
r.inspectedFeatures = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetExternalKubeInformerFactory implements the WantsExternalKubeInformerFactory interface.
|
// SetExternalKubeInformerFactory implements the WantsExternalKubeInformerFactory interface.
|
||||||
func (r *RuntimeClass) SetExternalKubeInformerFactory(f informers.SharedInformerFactory) {
|
func (r *RuntimeClass) SetExternalKubeInformerFactory(f informers.SharedInformerFactory) {
|
||||||
runtimeClassInformer := f.Node().V1().RuntimeClasses()
|
runtimeClassInformer := f.Node().V1().RuntimeClasses()
|
||||||
@ -93,9 +82,6 @@ func (r *RuntimeClass) SetExternalKubeInformerFactory(f informers.SharedInformer
|
|||||||
|
|
||||||
// ValidateInitialization implements the WantsExternalKubeInformerFactory interface.
|
// ValidateInitialization implements the WantsExternalKubeInformerFactory interface.
|
||||||
func (r *RuntimeClass) ValidateInitialization() error {
|
func (r *RuntimeClass) ValidateInitialization() error {
|
||||||
if !r.inspectedFeatures {
|
|
||||||
return fmt.Errorf("InspectFeatureGates was not called")
|
|
||||||
}
|
|
||||||
if r.runtimeClassLister == nil {
|
if r.runtimeClassLister == nil {
|
||||||
return fmt.Errorf("missing RuntimeClass lister")
|
return fmt.Errorf("missing RuntimeClass lister")
|
||||||
}
|
}
|
||||||
@ -116,10 +102,8 @@ func (r *RuntimeClass) Admit(ctx context.Context, attributes admission.Attribute
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if r.podOverheadEnabled {
|
if err := setOverhead(attributes, pod, runtimeClass); err != nil {
|
||||||
if err := setOverhead(attributes, pod, runtimeClass); err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := setScheduling(attributes, pod, runtimeClass); err != nil {
|
if err := setScheduling(attributes, pod, runtimeClass); err != nil {
|
||||||
@ -140,10 +124,8 @@ func (r *RuntimeClass) Validate(ctx context.Context, attributes admission.Attrib
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if r.podOverheadEnabled {
|
if err := validateOverhead(attributes, pod, runtimeClass); err != nil {
|
||||||
if err := validateOverhead(attributes, pod, runtimeClass); err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -31,10 +31,8 @@ import (
|
|||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
"k8s.io/component-base/featuregate"
|
|
||||||
"k8s.io/kubernetes/pkg/apis/core"
|
"k8s.io/kubernetes/pkg/apis/core"
|
||||||
"k8s.io/kubernetes/pkg/controller"
|
"k8s.io/kubernetes/pkg/controller"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@ -321,22 +319,12 @@ func NewObjectInterfacesForTest() admission.ObjectInterfaces {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newRuntimeClassForTest(
|
func newRuntimeClassForTest(
|
||||||
featureInspection bool,
|
|
||||||
addLister bool,
|
addLister bool,
|
||||||
listerObject *nodev1.RuntimeClass,
|
listerObject *nodev1.RuntimeClass,
|
||||||
addClient bool,
|
addClient bool,
|
||||||
clientObject *nodev1.RuntimeClass) *RuntimeClass {
|
clientObject *nodev1.RuntimeClass) *RuntimeClass {
|
||||||
runtimeClass := NewRuntimeClass()
|
runtimeClass := NewRuntimeClass()
|
||||||
|
|
||||||
if featureInspection {
|
|
||||||
relevantFeatures := map[featuregate.Feature]featuregate.FeatureSpec{
|
|
||||||
features.PodOverhead: {Default: false},
|
|
||||||
}
|
|
||||||
fg := featuregate.NewFeatureGate()
|
|
||||||
fg.Add(relevantFeatures)
|
|
||||||
runtimeClass.InspectFeatureGates(fg)
|
|
||||||
}
|
|
||||||
|
|
||||||
if addLister {
|
if addLister {
|
||||||
informerFactory := informers.NewSharedInformerFactory(nil, controller.NoResyncPeriodFunc())
|
informerFactory := informers.NewSharedInformerFactory(nil, controller.NoResyncPeriodFunc())
|
||||||
runtimeClass.SetExternalKubeInformerFactory(informerFactory)
|
runtimeClass.SetExternalKubeInformerFactory(informerFactory)
|
||||||
@ -367,22 +355,17 @@ func TestValidateInitialization(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "runtimeClass enabled, success",
|
name: "runtimeClass enabled, success",
|
||||||
expectError: false,
|
expectError: false,
|
||||||
runtimeClass: newRuntimeClassForTest(true, true, nil, true, nil),
|
runtimeClass: newRuntimeClassForTest(true, nil, true, nil),
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "runtimeClass enabled, no feature inspection",
|
|
||||||
expectError: true,
|
|
||||||
runtimeClass: newRuntimeClassForTest(false, true, nil, true, nil),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "runtimeClass enabled, no lister",
|
name: "runtimeClass enabled, no lister",
|
||||||
expectError: true,
|
expectError: true,
|
||||||
runtimeClass: newRuntimeClassForTest(true, false, nil, true, nil),
|
runtimeClass: newRuntimeClassForTest(false, nil, true, nil),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "runtimeClass enabled, no client",
|
name: "runtimeClass enabled, no client",
|
||||||
expectError: true,
|
expectError: true,
|
||||||
runtimeClass: newRuntimeClassForTest(true, true, nil, false, nil),
|
runtimeClass: newRuntimeClassForTest(true, nil, false, nil),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,17 +415,17 @@ func TestAdmit(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "runtimeClass found by lister",
|
name: "runtimeClass found by lister",
|
||||||
expectError: false,
|
expectError: false,
|
||||||
runtimeClass: newRuntimeClassForTest(true, true, rc, true, nil),
|
runtimeClass: newRuntimeClassForTest(true, rc, true, nil),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "runtimeClass found by client",
|
name: "runtimeClass found by client",
|
||||||
expectError: false,
|
expectError: false,
|
||||||
runtimeClass: newRuntimeClassForTest(true, true, nil, true, rc),
|
runtimeClass: newRuntimeClassForTest(true, nil, true, rc),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "runtimeClass not found by lister nor client",
|
name: "runtimeClass not found by lister nor client",
|
||||||
expectError: true,
|
expectError: true,
|
||||||
runtimeClass: newRuntimeClassForTest(true, true, nil, true, nil),
|
runtimeClass: newRuntimeClassForTest(true, nil, true, nil),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,7 +489,6 @@ func TestValidate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
rt := NewRuntimeClass()
|
rt := NewRuntimeClass()
|
||||||
rt.podOverheadEnabled = true
|
|
||||||
o := NewObjectInterfacesForTest()
|
o := NewObjectInterfacesForTest()
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
@ -3670,7 +3670,6 @@ message PodSpec {
|
|||||||
// set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value
|
// set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value
|
||||||
// defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero.
|
// defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero.
|
||||||
// More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
// More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
||||||
// This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
map<string, k8s.io.apimachinery.pkg.api.resource.Quantity> overhead = 32;
|
map<string, k8s.io.apimachinery.pkg.api.resource.Quantity> overhead = 32;
|
||||||
|
|
||||||
|
@ -3252,7 +3252,6 @@ type PodSpec struct {
|
|||||||
// set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value
|
// set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value
|
||||||
// defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero.
|
// defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero.
|
||||||
// More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
// More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
||||||
// This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
Overhead ResourceList `json:"overhead,omitempty" protobuf:"bytes,32,opt,name=overhead"`
|
Overhead ResourceList `json:"overhead,omitempty" protobuf:"bytes,32,opt,name=overhead"`
|
||||||
// TopologySpreadConstraints describes how a group of pods ought to spread across topology
|
// TopologySpreadConstraints describes how a group of pods ought to spread across topology
|
||||||
|
@ -1666,7 +1666,7 @@ var map_PodSpec = map[string]string{
|
|||||||
"runtimeClassName": "RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the \"legacy\" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class",
|
"runtimeClassName": "RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the \"legacy\" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class",
|
||||||
"enableServiceLinks": "EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.",
|
"enableServiceLinks": "EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.",
|
||||||
"preemptionPolicy": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.",
|
"preemptionPolicy": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.",
|
||||||
"overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
"overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. This field will be autopopulated at admission time by the RuntimeClass admission controller. If the RuntimeClass admission controller is enabled, overhead must not be set in Pod create requests. The RuntimeClass admission controller will reject Pod create requests which have the overhead already set. If RuntimeClass is configured and selected in the PodSpec, Overhead will be set to the value defined in the corresponding RuntimeClass, otherwise it will remain unset and treated as zero. More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
"topologySpreadConstraints": "TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed.",
|
"topologySpreadConstraints": "TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed.",
|
||||||
"setHostnameAsFQDN": "If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false.",
|
"setHostnameAsFQDN": "If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false.",
|
||||||
"os": "Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set.\n\nIf the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions\n\nIf the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup This is an alpha field and requires the IdentifyPodOS feature",
|
"os": "Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set.\n\nIf the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions\n\nIf the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup This is an alpha field and requires the IdentifyPodOS feature",
|
||||||
|
@ -64,8 +64,6 @@ message RuntimeClass {
|
|||||||
// Overhead represents the resource overhead associated with running a pod for a
|
// Overhead represents the resource overhead associated with running a pod for a
|
||||||
// given RuntimeClass. For more details, see
|
// given RuntimeClass. For more details, see
|
||||||
// https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/
|
// https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/
|
||||||
// This field is in beta starting v1.18
|
|
||||||
// and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
optional Overhead overhead = 3;
|
optional Overhead overhead = 3;
|
||||||
|
|
||||||
|
@ -53,8 +53,6 @@ type RuntimeClass struct {
|
|||||||
// Overhead represents the resource overhead associated with running a pod for a
|
// Overhead represents the resource overhead associated with running a pod for a
|
||||||
// given RuntimeClass. For more details, see
|
// given RuntimeClass. For more details, see
|
||||||
// https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/
|
// https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/
|
||||||
// This field is in beta starting v1.18
|
|
||||||
// and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
Overhead *Overhead `json:"overhead,omitempty" protobuf:"bytes,3,opt,name=overhead"`
|
Overhead *Overhead `json:"overhead,omitempty" protobuf:"bytes,3,opt,name=overhead"`
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ var map_RuntimeClass = map[string]string{
|
|||||||
"": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://kubernetes.io/docs/concepts/containers/runtime-class/",
|
"": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://kubernetes.io/docs/concepts/containers/runtime-class/",
|
||||||
"metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
"metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||||
"handler": "Handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.",
|
"handler": "Handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.",
|
||||||
"overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/\nThis field is in beta starting v1.18 and is only honored by servers that enable the PodOverhead feature.",
|
"overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see\n https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/",
|
||||||
"scheduling": "Scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.",
|
"scheduling": "Scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,6 @@ message RuntimeClassSpec {
|
|||||||
// Overhead represents the resource overhead associated with running a pod for a
|
// Overhead represents the resource overhead associated with running a pod for a
|
||||||
// given RuntimeClass. For more details, see
|
// given RuntimeClass. For more details, see
|
||||||
// https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
// https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
||||||
// This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
optional Overhead overhead = 2;
|
optional Overhead overhead = 2;
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@ type RuntimeClassSpec struct {
|
|||||||
// Overhead represents the resource overhead associated with running a pod for a
|
// Overhead represents the resource overhead associated with running a pod for a
|
||||||
// given RuntimeClass. For more details, see
|
// given RuntimeClass. For more details, see
|
||||||
// https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
// https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
||||||
// This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
Overhead *Overhead `json:"overhead,omitempty" protobuf:"bytes,2,opt,name=overhead"`
|
Overhead *Overhead `json:"overhead,omitempty" protobuf:"bytes,2,opt,name=overhead"`
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ func (RuntimeClassList) SwaggerDoc() map[string]string {
|
|||||||
var map_RuntimeClassSpec = map[string]string{
|
var map_RuntimeClassSpec = map[string]string{
|
||||||
"": "RuntimeClassSpec is a specification of a RuntimeClass. It contains parameters that are required to describe the RuntimeClass to the Container Runtime Interface (CRI) implementation, as well as any other components that need to understand how the pod will be run. The RuntimeClassSpec is immutable.",
|
"": "RuntimeClassSpec is a specification of a RuntimeClass. It contains parameters that are required to describe the RuntimeClass to the Container Runtime Interface (CRI) implementation, as well as any other components that need to understand how the pod will be run. The RuntimeClassSpec is immutable.",
|
||||||
"runtimeHandler": "RuntimeHandler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The RuntimeHandler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.",
|
"runtimeHandler": "RuntimeHandler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The RuntimeHandler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.",
|
||||||
"overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
"overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
"scheduling": "Scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.",
|
"scheduling": "Scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ message RuntimeClass {
|
|||||||
// Overhead represents the resource overhead associated with running a pod for a
|
// Overhead represents the resource overhead associated with running a pod for a
|
||||||
// given RuntimeClass. For more details, see
|
// given RuntimeClass. For more details, see
|
||||||
// https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
// https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
||||||
// This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
optional Overhead overhead = 3;
|
optional Overhead overhead = 3;
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ type RuntimeClass struct {
|
|||||||
// Overhead represents the resource overhead associated with running a pod for a
|
// Overhead represents the resource overhead associated with running a pod for a
|
||||||
// given RuntimeClass. For more details, see
|
// given RuntimeClass. For more details, see
|
||||||
// https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
// https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
|
||||||
// This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.
|
|
||||||
// +optional
|
// +optional
|
||||||
Overhead *Overhead `json:"overhead,omitempty" protobuf:"bytes,3,opt,name=overhead"`
|
Overhead *Overhead `json:"overhead,omitempty" protobuf:"bytes,3,opt,name=overhead"`
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ var map_RuntimeClass = map[string]string{
|
|||||||
"": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are (currently) manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class",
|
"": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are (currently) manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class",
|
||||||
"metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
"metadata": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||||
"handler": "Handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.",
|
"handler": "Handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, and is immutable.",
|
||||||
"overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md This field is beta-level as of Kubernetes v1.18, and is only honored by servers that enable the PodOverhead feature.",
|
"overhead": "Overhead represents the resource overhead associated with running a pod for a given RuntimeClass. For more details, see https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md",
|
||||||
"scheduling": "Scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.",
|
"scheduling": "Scheduling holds the scheduling constraints to ensure that pods running with this RuntimeClass are scheduled to nodes that support it. If scheduling is nil, this RuntimeClass is assumed to be supported by all nodes.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user