Add a new neverTerminate job behavior just for upgrade

This commit is contained in:
Maciej Szulik 2024-01-08 12:47:25 +01:00
parent 18608cc56b
commit 67cf648ab7
No known key found for this signature in database
GPG Key ID: F15E55D276FA84C4
2 changed files with 7 additions and 1 deletions

View File

@ -92,6 +92,12 @@ func NewTestJobOnNode(behavior, name string, rPol v1.RestartPolicy, parallelism,
}
}
switch behavior {
case "neverTerminate":
// this job is being used in an upgrade job see test/e2e/upgrades/apps/job.go
// it should never be optimized, as it always has to restart during an upgrade
// and continue running
job.Spec.Template.Spec.Containers[0].Command = []string{"sleep", "1000000"}
job.Spec.Template.Spec.TerminationGracePeriodSeconds = ptr.To(int64(1))
case "notTerminate":
job.Spec.Template.Spec.Containers[0].Image = imageutils.GetPauseImageName()
case "fail":

View File

@ -47,7 +47,7 @@ func (t *JobUpgradeTest) Setup(ctx context.Context, f *framework.Framework) {
t.namespace = f.Namespace.Name
ginkgo.By("Creating a job")
t.job = e2ejob.NewTestJob("notTerminate", "foo", v1.RestartPolicyOnFailure, 2, 2, nil, 6)
t.job = e2ejob.NewTestJob("neverTerminate", "foo", v1.RestartPolicyOnFailure, 2, 2, nil, 6)
job, err := e2ejob.CreateJob(ctx, f.ClientSet, t.namespace, t.job)
t.job = job
framework.ExpectNoError(err)