Merge pull request #45480 from xiangpengzhao/scheduledjob-cronjob

Automatic merge from submit-queue (batch tested with PRs 45634, 45480)

Rename vars scheduledJob to cronJob in describe.go

**What this PR does / why we need it**:
Rename vars scheduledJob to cronJob in describe.go

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:
There might still be some leftovers in other places.
@soltysh 

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-05-11 00:12:40 -07:00 committed by GitHub
commit 9a0f5ccb33

View File

@ -1525,47 +1525,47 @@ func describeJob(job *batch.Job, events *api.EventList) (string, error) {
})
}
// CronJobDescriber generates information about a scheduled job and the jobs it has created.
// CronJobDescriber generates information about a cron job and the jobs it has created.
type CronJobDescriber struct {
clientset.Interface
}
func (d *CronJobDescriber) Describe(namespace, name string, describerSettings printers.DescriberSettings) (string, error) {
scheduledJob, err := d.Batch().CronJobs(namespace).Get(name, metav1.GetOptions{})
cronJob, err := d.Batch().CronJobs(namespace).Get(name, metav1.GetOptions{})
if err != nil {
return "", err
}
var events *api.EventList
if describerSettings.ShowEvents {
events, _ = d.Core().Events(namespace).Search(api.Scheme, scheduledJob)
events, _ = d.Core().Events(namespace).Search(api.Scheme, cronJob)
}
return describeCronJob(scheduledJob, events)
return describeCronJob(cronJob, events)
}
func describeCronJob(scheduledJob *batch.CronJob, events *api.EventList) (string, error) {
func describeCronJob(cronJob *batch.CronJob, events *api.EventList) (string, error) {
return tabbedString(func(out io.Writer) error {
w := NewPrefixWriter(out)
w.Write(LEVEL_0, "Name:\t%s\n", scheduledJob.Name)
w.Write(LEVEL_0, "Namespace:\t%s\n", scheduledJob.Namespace)
printLabelsMultiline(w, "Labels", scheduledJob.Labels)
printAnnotationsMultiline(w, "Annotations", scheduledJob.Annotations)
w.Write(LEVEL_0, "Schedule:\t%s\n", scheduledJob.Spec.Schedule)
w.Write(LEVEL_0, "Concurrency Policy:\t%s\n", scheduledJob.Spec.ConcurrencyPolicy)
w.Write(LEVEL_0, "Suspend:\t%s\n", printBoolPtr(scheduledJob.Spec.Suspend))
if scheduledJob.Spec.StartingDeadlineSeconds != nil {
w.Write(LEVEL_0, "Starting Deadline Seconds:\t%ds\n", *scheduledJob.Spec.StartingDeadlineSeconds)
w.Write(LEVEL_0, "Name:\t%s\n", cronJob.Name)
w.Write(LEVEL_0, "Namespace:\t%s\n", cronJob.Namespace)
printLabelsMultiline(w, "Labels", cronJob.Labels)
printAnnotationsMultiline(w, "Annotations", cronJob.Annotations)
w.Write(LEVEL_0, "Schedule:\t%s\n", cronJob.Spec.Schedule)
w.Write(LEVEL_0, "Concurrency Policy:\t%s\n", cronJob.Spec.ConcurrencyPolicy)
w.Write(LEVEL_0, "Suspend:\t%s\n", printBoolPtr(cronJob.Spec.Suspend))
if cronJob.Spec.StartingDeadlineSeconds != nil {
w.Write(LEVEL_0, "Starting Deadline Seconds:\t%ds\n", *cronJob.Spec.StartingDeadlineSeconds)
} else {
w.Write(LEVEL_0, "Starting Deadline Seconds:\t<unset>\n")
}
describeJobTemplate(scheduledJob.Spec.JobTemplate, w)
if scheduledJob.Status.LastScheduleTime != nil {
w.Write(LEVEL_0, "Last Schedule Time:\t%s\n", scheduledJob.Status.LastScheduleTime.Time.Format(time.RFC1123Z))
describeJobTemplate(cronJob.Spec.JobTemplate, w)
if cronJob.Status.LastScheduleTime != nil {
w.Write(LEVEL_0, "Last Schedule Time:\t%s\n", cronJob.Status.LastScheduleTime.Time.Format(time.RFC1123Z))
} else {
w.Write(LEVEL_0, "Last Schedule Time:\t<unset>\n")
}
printActiveJobs(w, "Active Jobs", scheduledJob.Status.Active)
printActiveJobs(w, "Active Jobs", cronJob.Status.Active)
if events != nil {
DescribeEvents(events, w)
}