diff --git a/pkg/apis/experimental/deep_copy_generated.go b/pkg/apis/experimental/deep_copy_generated.go index 4b7d2b987fe..9146ffc2ce3 100644 --- a/pkg/apis/experimental/deep_copy_generated.go +++ b/pkg/apis/experimental/deep_copy_generated.go @@ -1340,8 +1340,8 @@ func deepCopy_experimental_JobStatus(in JobStatus, out *JobStatus, c *conversion out.CompletionTime = nil } out.Active = in.Active - out.Successful = in.Successful - out.Unsuccessful = in.Unsuccessful + out.Succeeded = in.Succeeded + out.Failed = in.Failed return nil } diff --git a/pkg/apis/experimental/types.go b/pkg/apis/experimental/types.go index 7db4d885dd4..0fd351af48d 100644 --- a/pkg/apis/experimental/types.go +++ b/pkg/apis/experimental/types.go @@ -432,11 +432,11 @@ type JobStatus struct { // Active is the number of actively running pods. Active int `json:"active,omitempty"` - // Successful is the number of pods which reached Phase Succeeded. - Successful int `json:"successful,omitempty"` + // Succeeded is the number of pods which reached Phase Succeeded. + Succeeded int `json:"succeeded,omitempty"` - // Unsuccessful is the number of pods which reached Phase Failed. - Unsuccessful int `json:"unsuccessful,omitempty"` + // Failed is the number of pods which reached Phase Failed. + Failed int `json:"failed,omitempty"` } type JobConditionType string diff --git a/pkg/apis/experimental/v1alpha1/conversion_generated.go b/pkg/apis/experimental/v1alpha1/conversion_generated.go index 9c72e05ff81..b52a1e9cdde 100644 --- a/pkg/apis/experimental/v1alpha1/conversion_generated.go +++ b/pkg/apis/experimental/v1alpha1/conversion_generated.go @@ -2836,8 +2836,8 @@ func autoconvert_experimental_JobStatus_To_v1alpha1_JobStatus(in *experimental.J out.CompletionTime = nil } out.Active = in.Active - out.Successful = in.Successful - out.Unsuccessful = in.Unsuccessful + out.Succeeded = in.Succeeded + out.Failed = in.Failed return nil } @@ -3758,8 +3758,8 @@ func autoconvert_v1alpha1_JobStatus_To_experimental_JobStatus(in *JobStatus, out out.CompletionTime = nil } out.Active = in.Active - out.Successful = in.Successful - out.Unsuccessful = in.Unsuccessful + out.Succeeded = in.Succeeded + out.Failed = in.Failed return nil } diff --git a/pkg/apis/experimental/v1alpha1/deep_copy_generated.go b/pkg/apis/experimental/v1alpha1/deep_copy_generated.go index 4cdba093231..7511e5e80b6 100644 --- a/pkg/apis/experimental/v1alpha1/deep_copy_generated.go +++ b/pkg/apis/experimental/v1alpha1/deep_copy_generated.go @@ -1352,8 +1352,8 @@ func deepCopy_v1alpha1_JobStatus(in JobStatus, out *JobStatus, c *conversion.Clo out.CompletionTime = nil } out.Active = in.Active - out.Successful = in.Successful - out.Unsuccessful = in.Unsuccessful + out.Succeeded = in.Succeeded + out.Failed = in.Failed return nil } diff --git a/pkg/apis/experimental/v1alpha1/types.go b/pkg/apis/experimental/v1alpha1/types.go index 9f702614afc..a959d17e6a9 100644 --- a/pkg/apis/experimental/v1alpha1/types.go +++ b/pkg/apis/experimental/v1alpha1/types.go @@ -441,11 +441,11 @@ type JobStatus struct { // Active is the number of actively running pods. Active int `json:"active,omitempty"` - // Successful is the number of pods which reached Phase Succeeded. - Successful int `json:"successful,omitempty"` + // Succeeded is the number of pods which reached Phase Succeeded. + Succeeded int `json:"succeeded,omitempty"` - // Unsuccessful is the number of pods which reached Phase Failed. - Unsuccessful int `json:"unsuccessful,omitempty"` + // Failed is the number of pods which reached Phase Failed. + Failed int `json:"failed,omitempty"` } type JobConditionType string diff --git a/pkg/apis/experimental/v1alpha1/types_swagger_doc_generated.go b/pkg/apis/experimental/v1alpha1/types_swagger_doc_generated.go index 775053d36a1..49feb57b276 100644 --- a/pkg/apis/experimental/v1alpha1/types_swagger_doc_generated.go +++ b/pkg/apis/experimental/v1alpha1/types_swagger_doc_generated.go @@ -347,8 +347,8 @@ var map_JobStatus = map[string]string{ "startTime": "StartTime represents time when the job was acknowledged by the Job Manager. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.", "completionTime": "CompletionTime represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC.", "active": "Active is the number of actively running pods.", - "successful": "Successful is the number of pods which reached Phase Succeeded.", - "unsuccessful": "Unsuccessful is the number of pods which reached Phase Failed.", + "succeeded": "Succeeded is the number of pods which reached Phase Succeeded.", + "failed": "Failed is the number of pods which reached Phase Failed.", } func (JobStatus) SwaggerDoc() map[string]string { diff --git a/pkg/apis/experimental/validation/validation.go b/pkg/apis/experimental/validation/validation.go index 22d4a164605..bd04b7a4a48 100644 --- a/pkg/apis/experimental/validation/validation.go +++ b/pkg/apis/experimental/validation/validation.go @@ -345,8 +345,8 @@ func ValidateJobSpec(spec *experimental.JobSpec) errs.ValidationErrorList { func ValidateJobStatus(status *experimental.JobStatus) errs.ValidationErrorList { allErrs := errs.ValidationErrorList{} allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Active), "active")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Successful), "successful")...) - allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Unsuccessful), "unsuccessful")...) + allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Succeeded), "succeeded")...) + allErrs = append(allErrs, apivalidation.ValidatePositiveField(int64(status.Failed), "failed")...) return allErrs } diff --git a/pkg/client/unversioned/conditions.go b/pkg/client/unversioned/conditions.go index cc6fed4d9d9..b0df788d2fa 100644 --- a/pkg/client/unversioned/conditions.go +++ b/pkg/client/unversioned/conditions.go @@ -58,7 +58,7 @@ func JobHasDesiredParallelism(c Interface, job *experimental.Job) wait.Condition return true, nil } // otherwise count successful - progress := *job.Spec.Completions - job.Status.Active - job.Status.Successful + progress := *job.Spec.Completions - job.Status.Active - job.Status.Succeeded return progress == 0, nil } } diff --git a/pkg/controller/job/controller.go b/pkg/controller/job/controller.go index 9ace279bffe..86c5d5006be 100644 --- a/pkg/controller/job/controller.go +++ b/pkg/controller/job/controller.go @@ -322,20 +322,20 @@ func (jm *JobController) syncJob(key string) error { activePods := controller.FilterActivePods(podList.Items) active := len(activePods) - successful, unsuccessful := getStatus(podList.Items) + succeeded, failed := getStatus(podList.Items) if jobNeedsSync { - active = jm.manageJob(activePods, successful, unsuccessful, &job) + active = jm.manageJob(activePods, succeeded, &job) } - completions := successful + completions := succeeded if completions == *job.Spec.Completions { job.Status.Conditions = append(job.Status.Conditions, newCondition()) } // no need to update the job if the status hasn't changed since last time - if job.Status.Active != active || job.Status.Successful != successful || job.Status.Unsuccessful != unsuccessful { + if job.Status.Active != active || job.Status.Succeeded != succeeded || job.Status.Failed != failed { job.Status.Active = active - job.Status.Successful = successful - job.Status.Unsuccessful = unsuccessful + job.Status.Succeeded = succeeded + job.Status.Failed = failed if err := jm.updateHandler(&job); err != nil { glog.Errorf("Failed to update job %v, requeuing. Error: %v", job.Name, err) @@ -354,13 +354,13 @@ func newCondition() experimental.JobCondition { } } -func getStatus(pods []api.Pod) (successful, unsuccessful int) { - successful = filterPods(pods, api.PodSucceeded) - unsuccessful = filterPods(pods, api.PodFailed) +func getStatus(pods []api.Pod) (succeeded, failed int) { + succeeded = filterPods(pods, api.PodSucceeded) + failed = filterPods(pods, api.PodFailed) return } -func (jm *JobController) manageJob(activePods []*api.Pod, successful, unsuccessful int, job *experimental.Job) int { +func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *experimental.Job) int { var activeLock sync.Mutex active := len(activePods) parallelism := *job.Spec.Parallelism @@ -399,7 +399,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, successful, unsuccessf } else if active < parallelism { // how many executions are left to run - diff := *job.Spec.Completions - successful + diff := *job.Spec.Completions - succeeded // limit to parallelism and count active pods as well if diff > parallelism { diff = parallelism diff --git a/pkg/controller/job/controller_test.go b/pkg/controller/job/controller_test.go index 93c3f096271..77e06e4fafc 100644 --- a/pkg/controller/job/controller_test.go +++ b/pkg/controller/job/controller_test.go @@ -95,16 +95,16 @@ func TestControllerSyncJob(t *testing.T) { // pod setup podControllerError error activePods int - successfulPods int - unsuccessfulPods int + succeededPods int + failedPods int // expectations - expectedCreations int - expectedDeletions int - expectedActive int - expectedSuccessful int - expectedUnsuccessful int - expectedComplete bool + expectedCreations int + expectedDeletions int + expectedActive int + expectedSucceeded int + expectedFailed int + expectedComplete bool }{ "job start": { 2, 5, @@ -177,10 +177,10 @@ func TestControllerSyncJob(t *testing.T) { for _, pod := range newPodList(tc.activePods, api.PodRunning, job) { manager.podStore.Store.Add(&pod) } - for _, pod := range newPodList(tc.successfulPods, api.PodSucceeded, job) { + for _, pod := range newPodList(tc.succeededPods, api.PodSucceeded, job) { manager.podStore.Store.Add(&pod) } - for _, pod := range newPodList(tc.unsuccessfulPods, api.PodFailed, job) { + for _, pod := range newPodList(tc.failedPods, api.PodFailed, job) { manager.podStore.Store.Add(&pod) } @@ -201,11 +201,11 @@ func TestControllerSyncJob(t *testing.T) { if actual.Status.Active != tc.expectedActive { t.Errorf("%s: unexpected number of active pods. Expected %d, saw %d\n", name, tc.expectedActive, actual.Status.Active) } - if actual.Status.Successful != tc.expectedSuccessful { - t.Errorf("%s: unexpected number of successful pods. Expected %d, saw %d\n", name, tc.expectedSuccessful, actual.Status.Successful) + if actual.Status.Succeeded != tc.expectedSucceeded { + t.Errorf("%s: unexpected number of succeeded pods. Expected %d, saw %d\n", name, tc.expectedSucceeded, actual.Status.Succeeded) } - if actual.Status.Unsuccessful != tc.expectedUnsuccessful { - t.Errorf("%s: unexpected number of unsuccessful pods. Expected %d, saw %d\n", name, tc.expectedUnsuccessful, actual.Status.Unsuccessful) + if actual.Status.Failed != tc.expectedFailed { + t.Errorf("%s: unexpected number of failed pods. Expected %d, saw %d\n", name, tc.expectedFailed, actual.Status.Failed) } // validate conditions if tc.expectedComplete { diff --git a/pkg/kubectl/describe.go b/pkg/kubectl/describe.go index 35456a402c6..141df607322 100644 --- a/pkg/kubectl/describe.go +++ b/pkg/kubectl/describe.go @@ -893,7 +893,7 @@ func describeJob(job *experimental.Job, events *api.EventList) (string, error) { fmt.Fprintf(out, "Parallelism:\t%d\n", *job.Spec.Parallelism) fmt.Fprintf(out, "Completions:\t%d\n", *job.Spec.Completions) fmt.Fprintf(out, "Labels:\t%s\n", labels.FormatLabels(job.Labels)) - fmt.Fprintf(out, "Pods Statuses:\t%d Running / %d Succeeded / %d Failed\n", job.Status.Active, job.Status.Successful, job.Status.Unsuccessful) + fmt.Fprintf(out, "Pods Statuses:\t%d Running / %d Succeeded / %d Failed\n", job.Status.Active, job.Status.Succeeded, job.Status.Failed) if job.Spec.Template != nil { describeVolumes(job.Spec.Template.Spec.Volumes, out) } diff --git a/pkg/kubectl/resource_printer.go b/pkg/kubectl/resource_printer.go index 97d05591771..30c7acf716f 100644 --- a/pkg/kubectl/resource_printer.go +++ b/pkg/kubectl/resource_printer.go @@ -741,7 +741,7 @@ func printJob(job *experimental.Job, w io.Writer, withNamespace bool, wide bool, firstContainer.Name, firstContainer.Image, labels.FormatLabels(job.Spec.Selector), - job.Status.Successful) + job.Status.Succeeded) if err != nil { return err } diff --git a/pkg/registry/job/strategy.go b/pkg/registry/job/strategy.go index dc8e7a566d2..ae9fb5c504b 100644 --- a/pkg/registry/job/strategy.go +++ b/pkg/registry/job/strategy.go @@ -99,7 +99,7 @@ func (jobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object func JobToSelectableFields(job *experimental.Job) fields.Set { return fields.Set{ "metadata.name": job.Name, - "status.successful": strconv.Itoa(job.Status.Successful), + "status.successful": strconv.Itoa(job.Status.Succeeded), } } diff --git a/test/e2e/job.go b/test/e2e/job.go index 063b2066fbd..62f5acc9dfb 100644 --- a/test/e2e/job.go +++ b/test/e2e/job.go @@ -101,7 +101,7 @@ var _ = Describe("Job", func() { if err != nil { return false, err } - return curr.Status.Unsuccessful > lotsOfFailures, nil + return curr.Status.Failed > lotsOfFailures, nil }) }) @@ -256,6 +256,6 @@ func waitForJobFinish(c *client.Client, ns, jobName string, completions int) err if err != nil { return false, err } - return curr.Status.Successful == completions, nil + return curr.Status.Succeeded == completions, nil }) }