Add a new neverTerminate job behavior just for upgrade
This commit is contained in:
		@@ -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":
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user