Skip to content

Commit 053624e

Browse files
Merge pull request #111023 from pohly/dynamic-resource-allocation
dynamic resource allocation Kubernetes-commit: d1c0171aed848900daa07212370c991c19c318b1
2 parents 3590eda + 8356158 commit 053624e

File tree

94 files changed

+9828
-1189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+9828
-1189
lines changed

core/v1/generated.pb.go

+1,806-1,101
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/v1/generated.proto

+81
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/v1/types.go

+81
Original file line numberDiff line numberDiff line change
@@ -2314,6 +2314,26 @@ type ResourceRequirements struct {
23142314
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
23152315
// +optional
23162316
Requests ResourceList `json:"requests,omitempty" protobuf:"bytes,2,rep,name=requests,casttype=ResourceList,castkey=ResourceName"`
2317+
// Claims lists the names of resources, defined in spec.resourceClaims,
2318+
// that are used by this container.
2319+
//
2320+
// This is an alpha field and requires enabling the
2321+
// DynamicResourceAllocation feature gate.
2322+
//
2323+
// This field is immutable.
2324+
//
2325+
// +listType=set
2326+
// +featureGate=DynamicResourceAllocation
2327+
// +optional
2328+
Claims []ResourceClaim `json:"claims,omitempty" protobuf:"bytes,3,opt,name=claims"`
2329+
}
2330+
2331+
// ResourceClaim references one entry in PodSpec.ResourceClaims.
2332+
type ResourceClaim struct {
2333+
// Name must match the name of one entry in pod.spec.resourceClaims of
2334+
// the Pod where this field is used. It makes that resource available
2335+
// inside a container.
2336+
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
23172337
}
23182338

23192339
const (
@@ -3347,6 +3367,7 @@ type PodSpec struct {
33473367
// - spec.containers[*].securityContext.runAsGroup
33483368
// +optional
33493369
OS *PodOS `json:"os,omitempty" protobuf:"bytes,36,opt,name=os"`
3370+
33503371
// Use the host's user namespace.
33513372
// Optional: Default to true.
33523373
// If set to true or not present, the pod will be run in the host user namespace, useful
@@ -3359,6 +3380,7 @@ type PodSpec struct {
33593380
// +k8s:conversion-gen=false
33603381
// +optional
33613382
HostUsers *bool `json:"hostUsers,omitempty" protobuf:"bytes,37,opt,name=hostUsers"`
3383+
33623384
// SchedulingGates is an opaque list of values that if specified will block scheduling the pod.
33633385
// More info: https://git.k8s.io/enhancements/keps/sig-scheduling/3521-pod-scheduling-readiness.
33643386
//
@@ -3369,6 +3391,65 @@ type PodSpec struct {
33693391
// +listType=map
33703392
// +listMapKey=name
33713393
SchedulingGates []PodSchedulingGate `json:"schedulingGates,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,38,opt,name=schedulingGates"`
3394+
// ResourceClaims defines which ResourceClaims must be allocated
3395+
// and reserved before the Pod is allowed to start. The resources
3396+
// will be made available to those containers which consume them
3397+
// by name.
3398+
//
3399+
// This is an alpha field and requires enabling the
3400+
// DynamicResourceAllocation feature gate.
3401+
//
3402+
// This field is immutable.
3403+
//
3404+
// +patchMergeKey=name
3405+
// +patchStrategy=merge,retainKeys
3406+
// +listType=map
3407+
// +listMapKey=name
3408+
// +featureGate=DynamicResourceAllocation
3409+
// +optional
3410+
ResourceClaims []PodResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,39,rep,name=resourceClaims"`
3411+
}
3412+
3413+
// PodResourceClaim references exactly one ResourceClaim through a ClaimSource.
3414+
// It adds a name to it that uniquely identifies the ResourceClaim inside the Pod.
3415+
// Containers that need access to the ResourceClaim reference it with this name.
3416+
type PodResourceClaim struct {
3417+
// Name uniquely identifies this resource claim inside the pod.
3418+
// This must be a DNS_LABEL.
3419+
Name string `json:"name" protobuf:"bytes,1,name=name"`
3420+
3421+
// Source describes where to find the ResourceClaim.
3422+
Source ClaimSource `json:"source,omitempty" protobuf:"bytes,2,name=source"`
3423+
}
3424+
3425+
// ClaimSource describes a reference to a ResourceClaim.
3426+
//
3427+
// Exactly one of these fields should be set. Consumers of this type must
3428+
// treat an empty object as if it has an unknown value.
3429+
type ClaimSource struct {
3430+
// ResourceClaimName is the name of a ResourceClaim object in the same
3431+
// namespace as this pod.
3432+
ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,1,opt,name=resourceClaimName"`
3433+
3434+
// ResourceClaimTemplateName is the name of a ResourceClaimTemplate
3435+
// object in the same namespace as this pod.
3436+
//
3437+
// The template will be used to create a new ResourceClaim, which will
3438+
// be bound to this pod. When this pod is deleted, the ResourceClaim
3439+
// will also be deleted. The name of the ResourceClaim will be <pod
3440+
// name>-<resource name>, where <resource name> is the
3441+
// PodResourceClaim.Name. Pod validation will reject the pod if the
3442+
// concatenated name is not valid for a ResourceClaim (e.g. too long).
3443+
//
3444+
// An existing ResourceClaim with that name that is not owned by the
3445+
// pod will not be used for the pod to avoid using an unrelated
3446+
// resource by mistake. Scheduling and pod startup are then blocked
3447+
// until the unrelated ResourceClaim is removed.
3448+
//
3449+
// This field is immutable and no changes will be made to the
3450+
// corresponding ResourceClaim by the control plane after creating the
3451+
// ResourceClaim.
3452+
ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimTemplateName"`
33723453
}
33733454

33743455
// OSName is the set of OS'es that can be used in OS.

core/v1/types_swagger_doc_generated.go

+31
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,16 @@ func (CinderVolumeSource) SwaggerDoc() map[string]string {
209209
return map_CinderVolumeSource
210210
}
211211

212+
var map_ClaimSource = map[string]string{
213+
"": "ClaimSource describes a reference to a ResourceClaim.\n\nExactly one of these fields should be set. Consumers of this type must treat an empty object as if it has an unknown value.",
214+
"resourceClaimName": "ResourceClaimName is the name of a ResourceClaim object in the same namespace as this pod.",
215+
"resourceClaimTemplateName": "ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this pod.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this pod. When this pod is deleted, the ResourceClaim will also be deleted. The name of the ResourceClaim will be <pod name>-<resource name>, where <resource name> is the PodResourceClaim.Name. Pod validation will reject the pod if the concatenated name is not valid for a ResourceClaim (e.g. too long).\n\nAn existing ResourceClaim with that name that is not owned by the pod will not be used for the pod to avoid using an unrelated resource by mistake. Scheduling and pod startup are then blocked until the unrelated ResourceClaim is removed.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.",
216+
}
217+
218+
func (ClaimSource) SwaggerDoc() map[string]string {
219+
return map_ClaimSource
220+
}
221+
212222
var map_ClientIPConfig = map[string]string{
213223
"": "ClientIPConfig represents the configurations of Client IP based session affinity.",
214224
"timeoutSeconds": "timeoutSeconds specifies the seconds of ClientIP type session sticky time. The value must be >0 && <=86400(for 1 day) if ServiceAffinity == \"ClientIP\". Default value is 10800(for 3 hours).",
@@ -1606,6 +1616,16 @@ func (PodReadinessGate) SwaggerDoc() map[string]string {
16061616
return map_PodReadinessGate
16071617
}
16081618

1619+
var map_PodResourceClaim = map[string]string{
1620+
"": "PodResourceClaim references exactly one ResourceClaim through a ClaimSource. It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name.",
1621+
"name": "Name uniquely identifies this resource claim inside the pod. This must be a DNS_LABEL.",
1622+
"source": "Source describes where to find the ResourceClaim.",
1623+
}
1624+
1625+
func (PodResourceClaim) SwaggerDoc() map[string]string {
1626+
return map_PodResourceClaim
1627+
}
1628+
16091629
var map_PodSchedulingGate = map[string]string{
16101630
"": "PodSchedulingGate is associated to a Pod to guard its scheduling.",
16111631
"name": "Name of the scheduling gate. Each scheduling gate must have a unique name field.",
@@ -1682,6 +1702,7 @@ var map_PodSpec = map[string]string{
16821702
"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.hostUsers - 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",
16831703
"hostUsers": "Use the host's user namespace. Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host. This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature.",
16841704
"schedulingGates": "SchedulingGates is an opaque list of values that if specified will block scheduling the pod. More info: https://git.k8s.io/enhancements/keps/sig-scheduling/3521-pod-scheduling-readiness.\n\nThis is an alpha-level feature enabled by PodSchedulingReadiness feature gate.",
1705+
"resourceClaims": "ResourceClaims defines which ResourceClaims must be allocated and reserved before the Pod is allowed to start. The resources will be made available to those containers which consume them by name.\n\nThis is an alpha field and requires enabling the DynamicResourceAllocation feature gate.\n\nThis field is immutable.",
16851706
}
16861707

16871708
func (PodSpec) SwaggerDoc() map[string]string {
@@ -1954,6 +1975,15 @@ func (ReplicationControllerStatus) SwaggerDoc() map[string]string {
19541975
return map_ReplicationControllerStatus
19551976
}
19561977

1978+
var map_ResourceClaim = map[string]string{
1979+
"": "ResourceClaim references one entry in PodSpec.ResourceClaims.",
1980+
"name": "Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container.",
1981+
}
1982+
1983+
func (ResourceClaim) SwaggerDoc() map[string]string {
1984+
return map_ResourceClaim
1985+
}
1986+
19571987
var map_ResourceFieldSelector = map[string]string{
19581988
"": "ResourceFieldSelector represents container resources (cpu, memory) and their output format",
19591989
"containerName": "Container name: required for volumes, optional for env vars",
@@ -2011,6 +2041,7 @@ var map_ResourceRequirements = map[string]string{
20112041
"": "ResourceRequirements describes the compute resource requirements.",
20122042
"limits": "Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
20132043
"requests": "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/",
2044+
"claims": "Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container.\n\nThis is an alpha field and requires enabling the DynamicResourceAllocation feature gate.\n\nThis field is immutable.",
20142045
}
20152046

20162047
func (ResourceRequirements) SwaggerDoc() map[string]string {

core/v1/zz_generated.deepcopy.go

+71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)