Skip to content

Commit

Permalink
Merge pull request #128407 from ndixita/pod-level-resources
Browse files Browse the repository at this point in the history
[PodLevelResources] Pod Level Resources Feature Alpha

Kubernetes-commit: c25f5eefe4efda4c0d9561d06942cd3de3dfe2e4
  • Loading branch information
k8s-publishing-bot committed Nov 27, 2024
2 parents 84e0db8 + 59e28a2 commit f8e5e36
Show file tree
Hide file tree
Showing 64 changed files with 1,539 additions and 1,030 deletions.
2,072 changes: 1,064 additions & 1,008 deletions core/v1/generated.pb.go

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions core/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions core/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4087,6 +4087,20 @@ type PodSpec struct {
// +featureGate=DynamicResourceAllocation
// +optional
ResourceClaims []PodResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,39,rep,name=resourceClaims"`
// Resources is the total amount of CPU and Memory resources required by all
// containers in the pod. It supports specifying Requests and Limits for
// "cpu" and "memory" resource names only. ResourceClaims are not supported.
//
// This field enables fine-grained control over resource allocation for the
// entire pod, allowing resource sharing among containers in a pod.
// TODO: For beta graduation, expand this comment with a detailed explanation.
//
// This is an alpha field and requires enabling the PodLevelResources feature
// gate.
//
// +featureGate=PodLevelResources
// +optional
Resources *ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,40,opt,name=resources"`
}

// PodResourceClaim references exactly one ResourceClaim, either directly
Expand Down
1 change: 1 addition & 0 deletions core/v1/types_swagger_doc_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,7 @@ var map_PodSpec = map[string]string{
"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.",
"schedulingGates": "SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod.\n\nSchedulingGates can only be set at pod creation time, and be removed only afterwards.",
"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.",
"resources": "Resources is the total amount of CPU and Memory resources required by all containers in the pod. It supports specifying Requests and Limits for \"cpu\" and \"memory\" resource names only. ResourceClaims are not supported.\n\nThis field enables fine-grained control over resource allocation for the entire pod, allowing resource sharing among containers in a pod.\n\nThis is an alpha field and requires enabling the PodLevelResources feature gate.",
}

func (PodSpec) SwaggerDoc() map[string]string {
Expand Down
5 changes: 5 additions & 0 deletions core/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ godebug default=go1.23

require (
github.com/gogo/protobuf v1.3.2
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba
k8s.io/apimachinery v0.0.0-20240920213627-16af2ff33fbf
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba h1:ghB5Iygt6Ge8UyIwW7C1kJx4kP7AUTCL9Qg6GCsUUOY=
k8s.io/apimachinery v0.0.0-20241108022104-96b97de8d6ba/go.mod h1:HqhdaJUgQqky29T1V0o2yFkt/pZqLFIDyn9Zi/8rxoY=
k8s.io/apimachinery v0.0.0-20240920213627-16af2ff33fbf h1:ZRwu8YHh3bFbQU4NRvHB6fiovWLBouxY86wIcLd7sBA=
k8s.io/apimachinery v0.0.0-20240920213627-16af2ff33fbf/go.mod h1:HqhdaJUgQqky29T1V0o2yFkt/pZqLFIDyn9Zi/8rxoY=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
Expand Down
16 changes: 15 additions & 1 deletion testdata/HEAD/apps.v1.DaemonSet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,21 @@
"resourceClaimName": "resourceClaimNameValue",
"resourceClaimTemplateName": "resourceClaimTemplateNameValue"
}
]
],
"resources": {
"limits": {
"limitsKey": "0"
},
"requests": {
"requestsKey": "0"
},
"claims": [
{
"name": "nameValue",
"request": "requestValue"
}
]
}
}
},
"updateStrategy": {
Expand Down
Binary file modified testdata/HEAD/apps.v1.DaemonSet.pb
Binary file not shown.
8 changes: 8 additions & 0 deletions testdata/HEAD/apps.v1.DaemonSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,14 @@ spec:
- name: nameValue
resourceClaimName: resourceClaimNameValue
resourceClaimTemplateName: resourceClaimTemplateNameValue
resources:
claims:
- name: nameValue
request: requestValue
limits:
limitsKey: "0"
requests:
requestsKey: "0"
restartPolicy: restartPolicyValue
runtimeClassName: runtimeClassNameValue
schedulerName: schedulerNameValue
Expand Down
16 changes: 15 additions & 1 deletion testdata/HEAD/apps.v1.Deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,21 @@
"resourceClaimName": "resourceClaimNameValue",
"resourceClaimTemplateName": "resourceClaimTemplateNameValue"
}
]
],
"resources": {
"limits": {
"limitsKey": "0"
},
"requests": {
"requestsKey": "0"
},
"claims": [
{
"name": "nameValue",
"request": "requestValue"
}
]
}
}
},
"strategy": {
Expand Down
Binary file modified testdata/HEAD/apps.v1.Deployment.pb
Binary file not shown.
8 changes: 8 additions & 0 deletions testdata/HEAD/apps.v1.Deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,14 @@ spec:
- name: nameValue
resourceClaimName: resourceClaimNameValue
resourceClaimTemplateName: resourceClaimTemplateNameValue
resources:
claims:
- name: nameValue
request: requestValue
limits:
limitsKey: "0"
requests:
requestsKey: "0"
restartPolicy: restartPolicyValue
runtimeClassName: runtimeClassNameValue
schedulerName: schedulerNameValue
Expand Down
16 changes: 15 additions & 1 deletion testdata/HEAD/apps.v1.ReplicaSet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,21 @@
"resourceClaimName": "resourceClaimNameValue",
"resourceClaimTemplateName": "resourceClaimTemplateNameValue"
}
]
],
"resources": {
"limits": {
"limitsKey": "0"
},
"requests": {
"requestsKey": "0"
},
"claims": [
{
"name": "nameValue",
"request": "requestValue"
}
]
}
}
}
},
Expand Down
Binary file modified testdata/HEAD/apps.v1.ReplicaSet.pb
Binary file not shown.
8 changes: 8 additions & 0 deletions testdata/HEAD/apps.v1.ReplicaSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,14 @@ spec:
- name: nameValue
resourceClaimName: resourceClaimNameValue
resourceClaimTemplateName: resourceClaimTemplateNameValue
resources:
claims:
- name: nameValue
request: requestValue
limits:
limitsKey: "0"
requests:
requestsKey: "0"
restartPolicy: restartPolicyValue
runtimeClassName: runtimeClassNameValue
schedulerName: schedulerNameValue
Expand Down
16 changes: 15 additions & 1 deletion testdata/HEAD/apps.v1.StatefulSet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,21 @@
"resourceClaimName": "resourceClaimNameValue",
"resourceClaimTemplateName": "resourceClaimTemplateNameValue"
}
]
],
"resources": {
"limits": {
"limitsKey": "0"
},
"requests": {
"requestsKey": "0"
},
"claims": [
{
"name": "nameValue",
"request": "requestValue"
}
]
}
}
},
"volumeClaimTemplates": [
Expand Down
Binary file modified testdata/HEAD/apps.v1.StatefulSet.pb
Binary file not shown.
8 changes: 8 additions & 0 deletions testdata/HEAD/apps.v1.StatefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,14 @@ spec:
- name: nameValue
resourceClaimName: resourceClaimNameValue
resourceClaimTemplateName: resourceClaimTemplateNameValue
resources:
claims:
- name: nameValue
request: requestValue
limits:
limitsKey: "0"
requests:
requestsKey: "0"
restartPolicy: restartPolicyValue
runtimeClassName: runtimeClassNameValue
schedulerName: schedulerNameValue
Expand Down
16 changes: 15 additions & 1 deletion testdata/HEAD/apps.v1beta1.Deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,21 @@
"resourceClaimName": "resourceClaimNameValue",
"resourceClaimTemplateName": "resourceClaimTemplateNameValue"
}
]
],
"resources": {
"limits": {
"limitsKey": "0"
},
"requests": {
"requestsKey": "0"
},
"claims": [
{
"name": "nameValue",
"request": "requestValue"
}
]
}
}
},
"strategy": {
Expand Down
Binary file modified testdata/HEAD/apps.v1beta1.Deployment.pb
Binary file not shown.
8 changes: 8 additions & 0 deletions testdata/HEAD/apps.v1beta1.Deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,14 @@ spec:
- name: nameValue
resourceClaimName: resourceClaimNameValue
resourceClaimTemplateName: resourceClaimTemplateNameValue
resources:
claims:
- name: nameValue
request: requestValue
limits:
limitsKey: "0"
requests:
requestsKey: "0"
restartPolicy: restartPolicyValue
runtimeClassName: runtimeClassNameValue
schedulerName: schedulerNameValue
Expand Down
16 changes: 15 additions & 1 deletion testdata/HEAD/apps.v1beta1.StatefulSet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,21 @@
"resourceClaimName": "resourceClaimNameValue",
"resourceClaimTemplateName": "resourceClaimTemplateNameValue"
}
]
],
"resources": {
"limits": {
"limitsKey": "0"
},
"requests": {
"requestsKey": "0"
},
"claims": [
{
"name": "nameValue",
"request": "requestValue"
}
]
}
}
},
"volumeClaimTemplates": [
Expand Down
Binary file modified testdata/HEAD/apps.v1beta1.StatefulSet.pb
Binary file not shown.
8 changes: 8 additions & 0 deletions testdata/HEAD/apps.v1beta1.StatefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,14 @@ spec:
- name: nameValue
resourceClaimName: resourceClaimNameValue
resourceClaimTemplateName: resourceClaimTemplateNameValue
resources:
claims:
- name: nameValue
request: requestValue
limits:
limitsKey: "0"
requests:
requestsKey: "0"
restartPolicy: restartPolicyValue
runtimeClassName: runtimeClassNameValue
schedulerName: schedulerNameValue
Expand Down
16 changes: 15 additions & 1 deletion testdata/HEAD/apps.v1beta2.DaemonSet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,21 @@
"resourceClaimName": "resourceClaimNameValue",
"resourceClaimTemplateName": "resourceClaimTemplateNameValue"
}
]
],
"resources": {
"limits": {
"limitsKey": "0"
},
"requests": {
"requestsKey": "0"
},
"claims": [
{
"name": "nameValue",
"request": "requestValue"
}
]
}
}
},
"updateStrategy": {
Expand Down
Binary file modified testdata/HEAD/apps.v1beta2.DaemonSet.pb
Binary file not shown.
8 changes: 8 additions & 0 deletions testdata/HEAD/apps.v1beta2.DaemonSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,14 @@ spec:
- name: nameValue
resourceClaimName: resourceClaimNameValue
resourceClaimTemplateName: resourceClaimTemplateNameValue
resources:
claims:
- name: nameValue
request: requestValue
limits:
limitsKey: "0"
requests:
requestsKey: "0"
restartPolicy: restartPolicyValue
runtimeClassName: runtimeClassNameValue
schedulerName: schedulerNameValue
Expand Down
16 changes: 15 additions & 1 deletion testdata/HEAD/apps.v1beta2.Deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,21 @@
"resourceClaimName": "resourceClaimNameValue",
"resourceClaimTemplateName": "resourceClaimTemplateNameValue"
}
]
],
"resources": {
"limits": {
"limitsKey": "0"
},
"requests": {
"requestsKey": "0"
},
"claims": [
{
"name": "nameValue",
"request": "requestValue"
}
]
}
}
},
"strategy": {
Expand Down
Binary file modified testdata/HEAD/apps.v1beta2.Deployment.pb
Binary file not shown.
8 changes: 8 additions & 0 deletions testdata/HEAD/apps.v1beta2.Deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,14 @@ spec:
- name: nameValue
resourceClaimName: resourceClaimNameValue
resourceClaimTemplateName: resourceClaimTemplateNameValue
resources:
claims:
- name: nameValue
request: requestValue
limits:
limitsKey: "0"
requests:
requestsKey: "0"
restartPolicy: restartPolicyValue
runtimeClassName: runtimeClassNameValue
schedulerName: schedulerNameValue
Expand Down
Loading

0 comments on commit f8e5e36

Please sign in to comment.