mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
added a comment that statuses lists are not being validated
This commit is contained in:
parent
6cb5ea56cb
commit
01851b89f4
@ -4106,16 +4106,37 @@ type PodStatus struct {
|
|||||||
// +optional
|
// +optional
|
||||||
QOSClass PodQOSClass
|
QOSClass PodQOSClass
|
||||||
|
|
||||||
// The list has one entry per init container in the manifest. The most recent successful
|
// Statuses of init containers in this pod. The most recent successful non-restartable
|
||||||
// init container will have ready = true, the most recently started container will have
|
// init container will have ready = true, the most recently started container will have
|
||||||
// startTime set.
|
// startTime set.
|
||||||
|
// Each init container in the pod should have at most one status in this list,
|
||||||
|
// and all statuses should be for containers in the pod.
|
||||||
|
// However this is not enforced.
|
||||||
|
// If a status for a non-existent container is present in the list, or the list has duplicate names,
|
||||||
|
// the behavior of various Kubernetes components is not defined and those statuses might be
|
||||||
|
// ignored.
|
||||||
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-and-container-status
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-and-container-status
|
||||||
InitContainerStatuses []ContainerStatus
|
InitContainerStatuses []ContainerStatus
|
||||||
// The list has one entry per app container in the manifest.
|
|
||||||
|
// Statuses of containers in this pod.
|
||||||
|
// Each container in the pod should have at most one status in this list,
|
||||||
|
// and all statuses should be for containers in the pod.
|
||||||
|
// However this is not enforced.
|
||||||
|
// If a status for a non-existent container is present in the list, or the list has duplicate names,
|
||||||
|
// the behavior of various Kubernetes components is not defined and those statuses might be
|
||||||
|
// ignored.
|
||||||
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status
|
||||||
// +optional
|
// +optional
|
||||||
ContainerStatuses []ContainerStatus
|
ContainerStatuses []ContainerStatus
|
||||||
|
|
||||||
// Status for any ephemeral containers that have run in this pod.
|
// Statuses for any ephemeral containers that have run in this pod.
|
||||||
|
// Each ephemeral container in the pod should have at most one status in this list,
|
||||||
|
// and all statuses should be for containers in the pod.
|
||||||
|
// However this is not enforced.
|
||||||
|
// If a status for a non-existent container is present in the list, or the list has duplicate names,
|
||||||
|
// the behavior of various Kubernetes components is not defined and those statuses might be
|
||||||
|
// ignored.
|
||||||
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status
|
||||||
// +optional
|
// +optional
|
||||||
EphemeralContainerStatuses []ContainerStatus
|
EphemeralContainerStatuses []ContainerStatus
|
||||||
|
|
||||||
|
@ -5385,6 +5385,10 @@ func ValidatePodStatusUpdate(newPod, oldPod *core.Pod, opts PodValidationOptions
|
|||||||
// Pod QoS is immutable
|
// Pod QoS is immutable
|
||||||
allErrs = append(allErrs, ValidateImmutableField(newPod.Status.QOSClass, oldPod.Status.QOSClass, fldPath.Child("qosClass"))...)
|
allErrs = append(allErrs, ValidateImmutableField(newPod.Status.QOSClass, oldPod.Status.QOSClass, fldPath.Child("qosClass"))...)
|
||||||
|
|
||||||
|
// Note: there is no check that ContainerStatuses, InitContainerStatuses, and EphemeralContainerStatuses doesn't have duplicate conatainer names
|
||||||
|
// or statuses of containers that are not defined in the pod spec. Changing this may lead to a breaking changes. So consumers of those fields
|
||||||
|
// must account for unexpected data. Kubelet will never report statuses like this.
|
||||||
|
//
|
||||||
// If pod should not restart, make sure the status update does not transition
|
// If pod should not restart, make sure the status update does not transition
|
||||||
// any terminated containers to a non-terminated state.
|
// any terminated containers to a non-terminated state.
|
||||||
allErrs = append(allErrs, ValidateContainerStateTransition(newPod.Status.ContainerStatuses, oldPod.Status.ContainerStatuses, fldPath.Child("containerStatuses"), oldPod.Spec.RestartPolicy)...)
|
allErrs = append(allErrs, ValidateContainerStateTransition(newPod.Status.ContainerStatuses, oldPod.Status.ContainerStatuses, fldPath.Child("containerStatuses"), oldPod.Spec.RestartPolicy)...)
|
||||||
|
@ -72,7 +72,8 @@ func (s SortedContainerStatuses) Less(i, j int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SortInitContainerStatuses ensures that statuses are in the order that their
|
// SortInitContainerStatuses ensures that statuses are in the order that their
|
||||||
// init container appears in the pod spec
|
// init container appears in the pod spec. The function assumes there are no
|
||||||
|
// duplicate names in the statuses.
|
||||||
func SortInitContainerStatuses(p *v1.Pod, statuses []v1.ContainerStatus) {
|
func SortInitContainerStatuses(p *v1.Pod, statuses []v1.ContainerStatus) {
|
||||||
containers := p.Spec.InitContainers
|
containers := p.Spec.InitContainers
|
||||||
current := 0
|
current := 0
|
||||||
|
@ -4809,24 +4809,45 @@ type PodStatus struct {
|
|||||||
// +optional
|
// +optional
|
||||||
StartTime *metav1.Time `json:"startTime,omitempty" protobuf:"bytes,7,opt,name=startTime"`
|
StartTime *metav1.Time `json:"startTime,omitempty" protobuf:"bytes,7,opt,name=startTime"`
|
||||||
|
|
||||||
// The list has one entry per init container in the manifest. The most recent successful
|
// Statuses of init containers in this pod. The most recent successful non-restartable
|
||||||
// init container will have ready = true, the most recently started container will have
|
// init container will have ready = true, the most recently started container will have
|
||||||
// startTime set.
|
// startTime set.
|
||||||
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status
|
// Each init container in the pod should have at most one status in this list,
|
||||||
|
// and all statuses should be for containers in the pod.
|
||||||
|
// However this is not enforced.
|
||||||
|
// If a status for a non-existent container is present in the list, or the list has duplicate names,
|
||||||
|
// the behavior of various Kubernetes components is not defined and those statuses might be
|
||||||
|
// ignored.
|
||||||
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-and-container-status
|
||||||
// +listType=atomic
|
// +listType=atomic
|
||||||
InitContainerStatuses []ContainerStatus `json:"initContainerStatuses,omitempty" protobuf:"bytes,10,rep,name=initContainerStatuses"`
|
InitContainerStatuses []ContainerStatus `json:"initContainerStatuses,omitempty" protobuf:"bytes,10,rep,name=initContainerStatuses"`
|
||||||
|
|
||||||
// The list has one entry per container in the manifest.
|
// Statuses of containers in this pod.
|
||||||
|
// Each container in the pod should have at most one status in this list,
|
||||||
|
// and all statuses should be for containers in the pod.
|
||||||
|
// However this is not enforced.
|
||||||
|
// If a status for a non-existent container is present in the list, or the list has duplicate names,
|
||||||
|
// the behavior of various Kubernetes components is not defined and those statuses might be
|
||||||
|
// ignored.
|
||||||
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status
|
||||||
// +optional
|
// +optional
|
||||||
// +listType=atomic
|
// +listType=atomic
|
||||||
ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty" protobuf:"bytes,8,rep,name=containerStatuses"`
|
ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty" protobuf:"bytes,8,rep,name=containerStatuses"`
|
||||||
|
|
||||||
// The Quality of Service (QOS) classification assigned to the pod based on resource requirements
|
// The Quality of Service (QOS) classification assigned to the pod based on resource requirements
|
||||||
// See PodQOSClass type for available QOS classes
|
// See PodQOSClass type for available QOS classes
|
||||||
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes
|
||||||
// +optional
|
// +optional
|
||||||
QOSClass PodQOSClass `json:"qosClass,omitempty" protobuf:"bytes,9,rep,name=qosClass"`
|
QOSClass PodQOSClass `json:"qosClass,omitempty" protobuf:"bytes,9,rep,name=qosClass"`
|
||||||
// Status for any ephemeral containers that have run in this pod.
|
|
||||||
|
// Statuses for any ephemeral containers that have run in this pod.
|
||||||
|
// Each ephemeral container in the pod should have at most one status in this list,
|
||||||
|
// and all statuses should be for containers in the pod.
|
||||||
|
// However this is not enforced.
|
||||||
|
// If a status for a non-existent container is present in the list, or the list has duplicate names,
|
||||||
|
// the behavior of various Kubernetes components is not defined and those statuses might be
|
||||||
|
// ignored.
|
||||||
|
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status
|
||||||
// +optional
|
// +optional
|
||||||
// +listType=atomic
|
// +listType=atomic
|
||||||
EphemeralContainerStatuses []ContainerStatus `json:"ephemeralContainerStatuses,omitempty" protobuf:"bytes,13,rep,name=ephemeralContainerStatuses"`
|
EphemeralContainerStatuses []ContainerStatus `json:"ephemeralContainerStatuses,omitempty" protobuf:"bytes,13,rep,name=ephemeralContainerStatuses"`
|
||||||
|
Loading…
Reference in New Issue
Block a user