Skip to content

Commit 546436e

Browse files
update device health status comments
1 parent 753b6fe commit 546436e

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

pkg/apis/core/types.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,11 +2788,17 @@ type ContainerStatus struct {
27882788
}
27892789

27902790
type ResourceStatus struct {
2791+
// Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec.
2792+
// For DRA resources, the value must be "claim:<claim_name>/<request>".
2793+
// When this status is reported about a container, the "claim_name" and "request" must match one of the claims of this container.
2794+
// +required
27912795
Name ResourceName
2792-
// List of unique Resources health. Each element in the list contains a unique resource ID and resource health.
2793-
// At a minimum, ResourceID must uniquely identify the Resource
2794-
// allocated to the Pod on the Node for the lifetime of a Pod.
2795-
// See ResourceID type for it's definition.
2796+
// List of unique resources health. Each element in the list contains an unique resource ID and its health.
2797+
// At a minimum, for the lifetime of a Pod, resource ID must uniquely identify the resource allocated to the Pod on the Node.
2798+
// If other Pod on the same Node reports the status with the same resource ID, it must be the same resource they share.
2799+
// See ResourceID type definition for a specific format it has in various use cases.
2800+
// +listType=map
2801+
// +listMapKey=resourceID
27962802
Resources []ResourceHealth
27972803

27982804
// allow to extend this struct in future with the overall health fields or things like Device Plugin version
@@ -2801,12 +2807,13 @@ type ResourceStatus struct {
28012807
// ResourceID is calculated based on the source of this resource health information.
28022808
// For DevicePlugin:
28032809
//
2804-
// deviceplugin:DeviceID, where DeviceID is from the Device structure of DevicePlugin's ListAndWatchResponse type: https://github.com/kubernetes/kubernetes/blob/eda1c780543a27c078450e2f17d674471e00f494/staging/src/k8s.io/kubelet/pkg/apis/deviceplugin/v1alpha/api.proto#L61-L73
2810+
// DeviceID, where DeviceID is how device plugin identifies the device. The same DeviceID can be found in PodResources API.
28052811
//
28062812
// DevicePlugin ID is usually a constant for the lifetime of a Node and typically can be used to uniquely identify the device on the node.
2813+
//
28072814
// For DRA:
28082815
//
2809-
// dra:<driver name>/<pool name>/<device name>: such a device can be looked up in the information published by that DRA driver to learn more about it. It is designed to be globally unique in a cluster.
2816+
// <driver name>/<pool name>/<device name>: such a device can be looked up in the information published by that DRA driver to learn more about it. It is designed to be globally unique in a cluster.
28102817
type ResourceID string
28112818

28122819
type ResourceHealthStatus string
@@ -2818,7 +2825,7 @@ const (
28182825
)
28192826

28202827
// ResourceHealth represents the health of a resource. It has the latest device health information.
2821-
// This is a part of KEP https://kep.k8s.io/4680 and historical health changes are planned to be added in future iterations of a KEP.
2828+
// This is a part of KEP https://kep.k8s.io/4680.
28222829
type ResourceHealth struct {
28232830
// ResourceID is the unique identifier of the resource. See the ResourceID type for more information.
28242831
ResourceID ResourceID

staging/src/k8s.io/api/core/v1/types.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,13 +3103,15 @@ type ContainerStatus struct {
31033103
}
31043104

31053105
type ResourceStatus struct {
3106-
// Name of the resource. Must be unique within the pod and match one of the resources from the pod spec.
3106+
// Name of the resource. Must be unique within the pod and in case of non-DRA resource, match one of the resources from the pod spec.
3107+
// For DRA resources, the value must be "claim:<claim_name>/<request>".
3108+
// When this status is reported about a container, the "claim_name" and "request" must match one of the claims of this container.
31073109
// +required
31083110
Name ResourceName `json:"name" protobuf:"bytes,1,opt,name=name"`
3109-
// List of unique Resources health. Each element in the list contains an unique resource ID and resource health.
3110-
// At a minimum, ResourceID must uniquely identify the Resource
3111-
// allocated to the Pod on the Node for the lifetime of a Pod.
3112-
// See ResourceID type for it's definition.
3111+
// List of unique resources health. Each element in the list contains an unique resource ID and its health.
3112+
// At a minimum, for the lifetime of a Pod, resource ID must uniquely identify the resource allocated to the Pod on the Node.
3113+
// If other Pod on the same Node reports the status with the same resource ID, it must be the same resource they share.
3114+
// See ResourceID type definition for a specific format it has in various use cases.
31133115
// +listType=map
31143116
// +listMapKey=resourceID
31153117
Resources []ResourceHealth `json:"resources,omitempty" protobuf:"bytes,2,rep,name=resources"`
@@ -3126,16 +3128,16 @@ const (
31263128
// ResourceID is calculated based on the source of this resource health information.
31273129
// For DevicePlugin:
31283130
//
3129-
// deviceplugin:DeviceID, where DeviceID is from the Device structure of DevicePlugin's ListAndWatchResponse type: https://github.com/kubernetes/kubernetes/blob/eda1c780543a27c078450e2f17d674471e00f494/staging/src/k8s.io/kubelet/pkg/apis/deviceplugin/v1alpha/api.proto#L61-L73
3131+
// DeviceID, where DeviceID is from the Device structure of DevicePlugin's ListAndWatchResponse type: https://github.com/kubernetes/kubernetes/blob/eda1c780543a27c078450e2f17d674471e00f494/staging/src/k8s.io/kubelet/pkg/apis/deviceplugin/v1alpha/api.proto#L61-L73
31303132
//
31313133
// DevicePlugin ID is usually a constant for the lifetime of a Node and typically can be used to uniquely identify the device on the node.
31323134
// For DRA:
31333135
//
3134-
// dra:<driver name>/<pool name>/<device name>: such a device can be looked up in the information published by that DRA driver to learn more about it. It is designed to be globally unique in a cluster.
3136+
// <driver name>/<pool name>/<device name>: such a device can be looked up in the information published by that DRA driver to learn more about it. It is designed to be globally unique in a cluster.
31353137
type ResourceID string
31363138

31373139
// ResourceHealth represents the health of a resource. It has the latest device health information.
3138-
// This is a part of KEP https://kep.k8s.io/4680 and historical health changes are planned to be added in future iterations of a KEP.
3140+
// This is a part of KEP https://kep.k8s.io/4680.
31393141
type ResourceHealth struct {
31403142
// ResourceID is the unique identifier of the resource. See the ResourceID type for more information.
31413143
ResourceID ResourceID `json:"resourceID" protobuf:"bytes,1,opt,name=resourceID"`

0 commit comments

Comments
 (0)