mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-29 21:29:24 +00:00
move kubelet constant for podreadytostart to staging
This commit is contained in:
@@ -30,7 +30,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/util/uuid"
|
||||
"k8s.io/kubernetes/pkg/kubelet/events"
|
||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2eevents "k8s.io/kubernetes/test/e2e/framework/events"
|
||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||
@@ -41,6 +40,7 @@ import (
|
||||
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = SIGDescribe("Pod conditions managed by Kubelet", func() {
|
||||
@@ -113,7 +113,7 @@ func runPodFailingConditionsTest(f *framework.Framework, hasInitContainers, chec
|
||||
|
||||
// Verify PodReadyToStartContainers is not set (since sandboxcreation is blocked)
|
||||
if checkPodReadyToStart {
|
||||
_, err := getTransitionTimeForPodConditionWithStatus(p, kubetypes.PodReadyToStartContainers, false)
|
||||
_, err := getTransitionTimeForPodConditionWithStatus(p, v1.PodReadyToStartContainers, false)
|
||||
framework.ExpectNoError(err)
|
||||
}
|
||||
|
||||
@@ -125,9 +125,7 @@ func runPodFailingConditionsTest(f *framework.Framework, hasInitContainers, chec
|
||||
// Verify PodInitialized is set if init containers are not present (since without init containers, it gets set very early)
|
||||
initializedTime, err := getTransitionTimeForPodConditionWithStatus(p, v1.PodInitialized, true)
|
||||
framework.ExpectNoError(err)
|
||||
if initializedTime.Before(scheduledTime) {
|
||||
framework.Failf("pod without init containers is initialized at: %v which is before pod scheduled at: %v", initializedTime, scheduledTime)
|
||||
}
|
||||
gomega.Expect(initializedTime.Before(scheduledTime)).NotTo(gomega.BeTrue(), fmt.Sprintf("pod without init containers is initialized at: %v which is before pod scheduled at: %v", initializedTime, scheduledTime))
|
||||
}
|
||||
|
||||
// Verify ContainersReady is not set (since sandboxcreation is blocked)
|
||||
@@ -164,47 +162,33 @@ func runPodReadyConditionsTest(f *framework.Framework, hasInitContainers, checkP
|
||||
condBeforeContainersReadyTransitionTime := initializedTime
|
||||
errSubstrIfContainersReadyTooEarly := "is initialized"
|
||||
if checkPodReadyToStart {
|
||||
readyToStartContainersTime, err := getTransitionTimeForPodConditionWithStatus(p, kubetypes.PodReadyToStartContainers, true)
|
||||
readyToStartContainersTime, err := getTransitionTimeForPodConditionWithStatus(p, v1.PodReadyToStartContainers, true)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
if hasInitContainers {
|
||||
// With init containers, verify the sequence of conditions is: Scheduled => PodReadyToStartContainers => Initialized
|
||||
if readyToStartContainersTime.Before(scheduledTime) {
|
||||
framework.Failf("pod with init containers is initialized at: %v which is before pod has ready to start at: %v", initializedTime, readyToStartContainersTime)
|
||||
}
|
||||
if initializedTime.Before(readyToStartContainersTime) {
|
||||
framework.Failf("pod with init containers is initialized at: %v which is before pod has ready to start at: %v", initializedTime, readyToStartContainersTime)
|
||||
}
|
||||
gomega.Expect(readyToStartContainersTime.Before(scheduledTime)).ToNot(gomega.BeTrue(), fmt.Sprintf("pod with init containers is initialized at: %v which is before pod has ready to start at: %v", initializedTime, readyToStartContainersTime))
|
||||
gomega.Expect(initializedTime.Before(readyToStartContainersTime)).ToNot(gomega.BeTrue(), fmt.Sprintf("pod with init containers is initialized at: %v which is before pod has ready to start at: %v", initializedTime, readyToStartContainersTime))
|
||||
} else {
|
||||
// Without init containers, verify the sequence of conditions is: Scheduled => Initialized => PodReadyToStartContainers
|
||||
condBeforeContainersReadyTransitionTime = readyToStartContainersTime
|
||||
errSubstrIfContainersReadyTooEarly = "ready to start"
|
||||
if initializedTime.Before(scheduledTime) {
|
||||
framework.Failf("pod without init containers initialized at: %v which is before pod scheduled at: %v", initializedTime, scheduledTime)
|
||||
}
|
||||
if readyToStartContainersTime.Before(initializedTime) {
|
||||
framework.Failf("pod without init containers has ready to start at: %v which is before pod is initialized at: %v", readyToStartContainersTime, initializedTime)
|
||||
}
|
||||
gomega.Expect(initializedTime.Before(scheduledTime)).NotTo(gomega.BeTrue(), fmt.Sprintf("pod without init containers initialized at: %v which is before pod scheduled at: %v", initializedTime, scheduledTime))
|
||||
gomega.Expect(readyToStartContainersTime.Before(initializedTime)).NotTo(gomega.BeTrue(), fmt.Sprintf("pod without init containers has ready to start at: %v which is before pod is initialized at: %v", readyToStartContainersTime, initializedTime))
|
||||
}
|
||||
} else {
|
||||
// In the absence of PodHasReadyToStartContainers feature disabled, verify the sequence is: Scheduled => Initialized
|
||||
if initializedTime.Before(scheduledTime) {
|
||||
framework.Failf("pod initialized at: %v which is before pod scheduled at: %v", initializedTime, scheduledTime)
|
||||
}
|
||||
gomega.Expect(initializedTime.Before(scheduledTime)).NotTo(gomega.BeTrue(), fmt.Sprintf("pod initialized at: %v which is before pod scheduled at: %v", initializedTime, scheduledTime))
|
||||
}
|
||||
// Verify the next condition to get set is ContainersReady
|
||||
containersReadyTime, err := getTransitionTimeForPodConditionWithStatus(p, v1.ContainersReady, true)
|
||||
framework.ExpectNoError(err)
|
||||
if containersReadyTime.Before(condBeforeContainersReadyTransitionTime) {
|
||||
framework.Failf("containers ready at: %v which is before pod %s: %v", containersReadyTime, errSubstrIfContainersReadyTooEarly, initializedTime)
|
||||
}
|
||||
gomega.Expect(containersReadyTime.Before(condBeforeContainersReadyTransitionTime)).NotTo(gomega.BeTrue(), fmt.Sprintf("containers ready at: %v which is before pod %s: %v", containersReadyTime, errSubstrIfContainersReadyTooEarly, initializedTime))
|
||||
|
||||
// Verify ContainersReady => PodReady
|
||||
podReadyTime, err := getTransitionTimeForPodConditionWithStatus(p, v1.PodReady, true)
|
||||
framework.ExpectNoError(err)
|
||||
if podReadyTime.Before(containersReadyTime) {
|
||||
framework.Failf("pod ready at: %v which is before pod containers ready at: %v", podReadyTime, containersReadyTime)
|
||||
}
|
||||
gomega.Expect(podReadyTime.Before(containersReadyTime)).NotTo(gomega.BeTrue(), fmt.Sprintf("pod ready at: %v which is before pod containers ready at: %v", podReadyTime, containersReadyTime))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user