Skip to content

Commit 7192863

Browse files
SergeyKanzhelevk8s-publishing-bot
authored andcommitted
add AllocatedResourcesStatus field to ContainerStatus
Kubernetes-commit: 16e8911fdccbdb348a0b3291acf6102494494f9b
1 parent a789efa commit 7192863

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

core/v1/types.go

+59
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,65 @@ type ContainerStatus struct {
30913091
// +featureGate=SupplementalGroupsPolicy
30923092
// +optional
30933093
User *ContainerUser `json:"user,omitempty" protobuf:"bytes,13,opt,name=user,casttype=ContainerUser"`
3094+
// AllocatedResourcesStatus represents the status of various resources
3095+
// allocated for this Pod.
3096+
// +featureGate=ResourceHealthStatus
3097+
// +optional
3098+
// +patchMergeKey=name
3099+
// +patchStrategy=merge
3100+
// +listType=map
3101+
// +listMapKey=name
3102+
AllocatedResourcesStatus []ResourceStatus `json:"allocatedResourcesStatus,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,14,rep,name=allocatedResourcesStatus"`
3103+
}
3104+
3105+
type ResourceStatus struct {
3106+
// Name of the resource. Must be unique within the pod and match one of the resources from the pod spec.
3107+
// +required
3108+
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.
3113+
// +listType=map
3114+
// +listMapKey=resourceID
3115+
Resources []ResourceHealth `json:"resources,omitempty" protobuf:"bytes,2,rep,name=resources"`
3116+
}
3117+
3118+
type ResourceHealthStatus string
3119+
3120+
const (
3121+
ResourceHealthStatusHealthy ResourceHealthStatus = "Healthy"
3122+
ResourceHealthStatusUnhealthy ResourceHealthStatus = "Unhealthy"
3123+
ResourceHealthStatusUnknown ResourceHealthStatus = "Unknown"
3124+
)
3125+
3126+
// ResourceID is calculated based on the source of this resource health information.
3127+
// For DevicePlugin:
3128+
//
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
3130+
//
3131+
// 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.
3132+
// For DRA:
3133+
//
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.
3135+
type ResourceID string
3136+
3137+
// 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.
3139+
type ResourceHealth struct {
3140+
// ResourceID is the unique identifier of the resource. See the ResourceID type for more information.
3141+
ResourceID ResourceID `json:"resourceID" protobuf:"bytes,1,opt,name=resourceID"`
3142+
// Health of the resource.
3143+
// can be one of:
3144+
// - Healthy: operates as normal
3145+
// - Unhealthy: reported unhealthy. We consider this a temporary health issue
3146+
// since we do not have a mechanism today to distinguish
3147+
// temporary and permanent issues.
3148+
// - Unknown: The status cannot be determined.
3149+
// For example, Device Plugin got unregistered and hasn't been re-registered since.
3150+
//
3151+
// In future we may want to introduce the PermanentlyUnhealthy Status.
3152+
Health ResourceHealthStatus `json:"health,omitempty" protobuf:"bytes,2,name=health"`
30943153
}
30953154

30963155
// ContainerUser represents user identity information

0 commit comments

Comments
 (0)