Add ready field to Job status

to keep a count of the pods that have the ready condition.

Also:
- Add feature gate JobReadyPods.
- Add Ready to describe.

Change-Id: Ib934730a430a8e2a2f485671e345fe2330006939
This commit is contained in:
Aldo Culquicondor
2021-09-08 14:31:59 -04:00
parent c733594040
commit 1bff5eb44d
18 changed files with 224 additions and 97 deletions

View File

@@ -686,6 +686,21 @@ func TestValidateJobUpdateStatus(t *testing.T) {
},
},
update: batch.Job{
ObjectMeta: metav1.ObjectMeta{
Name: "abc",
Namespace: metav1.NamespaceDefault,
ResourceVersion: "1",
},
Status: batch.JobStatus{
Active: 2,
Succeeded: 3,
Failed: 4,
Ready: pointer.Int32(1),
},
},
},
"nil ready": {
old: batch.Job{
ObjectMeta: metav1.ObjectMeta{
Name: "abc",
Namespace: metav1.NamespaceDefault,
@@ -693,10 +708,22 @@ func TestValidateJobUpdateStatus(t *testing.T) {
},
Status: batch.JobStatus{
Active: 1,
Succeeded: 1,
Succeeded: 2,
Failed: 3,
},
},
update: batch.Job{
ObjectMeta: metav1.ObjectMeta{
Name: "abc",
Namespace: metav1.NamespaceDefault,
ResourceVersion: "1",
},
Status: batch.JobStatus{
Active: 2,
Succeeded: 3,
Failed: 4,
},
},
},
"negative counts": {
old: batch.Job{
@@ -720,12 +747,15 @@ func TestValidateJobUpdateStatus(t *testing.T) {
Status: batch.JobStatus{
Active: -1,
Succeeded: -2,
Failed: 3,
Failed: -3,
Ready: pointer.Int32(-1),
},
},
wantErrs: field.ErrorList{
{Type: field.ErrorTypeInvalid, Field: "status.active"},
{Type: field.ErrorTypeInvalid, Field: "status.succeeded"},
{Type: field.ErrorTypeInvalid, Field: "status.failed"},
{Type: field.ErrorTypeInvalid, Field: "status.ready"},
},
},
"empty and duplicated uncounted pods": {