Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new DaemonSetStatus to kubectl printer and describer #42843

Merged
merged 1 commit into from Mar 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/printers/internalversion/describe.go
Expand Up @@ -1535,6 +1535,8 @@ func describeDaemonSet(daemon *extensions.DaemonSet, events *api.EventList, runn
printAnnotationsMultiline(w, "Annotations", daemon.Annotations)
w.Write(LEVEL_0, "Desired Number of Nodes Scheduled: %d\n", daemon.Status.DesiredNumberScheduled)
w.Write(LEVEL_0, "Current Number of Nodes Scheduled: %d\n", daemon.Status.CurrentNumberScheduled)
w.Write(LEVEL_0, "Number of Nodes Scheduled with Up-to-date Pods: %d\n", daemon.Status.UpdatedNumberScheduled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow these are really verbose and I never noticed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Number is redundant and generally I would prefer to keep these consistent with the D/RC/RS status but it got out of hand...

w.Write(LEVEL_0, "Number of Nodes Scheduled with Available Pods: %d\n", daemon.Status.NumberAvailable)
w.Write(LEVEL_0, "Number of Nodes Misscheduled: %d\n", daemon.Status.NumberMisscheduled)
w.Write(LEVEL_0, "Pods Status:\t%d Running / %d Waiting / %d Succeeded / %d Failed\n", running, waiting, succeeded, failed)
DescribePodTemplate(&daemon.Spec.Template, out)
Expand Down
8 changes: 6 additions & 2 deletions pkg/printers/internalversion/printers.go
Expand Up @@ -66,7 +66,7 @@ var (
endpointColumns = []string{"NAME", "ENDPOINTS", "AGE"}
nodeColumns = []string{"NAME", "STATUS", "AGE", "VERSION"}
nodeWideColumns = []string{"EXTERNAL-IP", "OS-IMAGE", "KERNEL-VERSION"}
daemonSetColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "NODE-SELECTOR", "AGE"}
daemonSetColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "UP-TO-DATE", "AVAILABLE", "NODE-SELECTOR", "AGE"}
daemonSetWideColumns = []string{"CONTAINER(S)", "IMAGE(S)", "SELECTOR"}
eventColumns = []string{"LASTSEEN", "FIRSTSEEN", "COUNT", "NAME", "KIND", "SUBOBJECT", "TYPE", "REASON", "SOURCE", "MESSAGE"}
limitRangeColumns = []string{"NAME", "AGE"}
Expand Down Expand Up @@ -904,16 +904,20 @@ func printDaemonSet(ds *extensions.DaemonSet, w io.Writer, options printers.Prin
desiredScheduled := ds.Status.DesiredNumberScheduled
currentScheduled := ds.Status.CurrentNumberScheduled
numberReady := ds.Status.NumberReady
numberUpdated := ds.Status.UpdatedNumberScheduled
numberAvailable := ds.Status.NumberAvailable
selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector)
if err != nil {
// this shouldn't happen if LabelSelector passed validation
return err
}
if _, err := fmt.Fprintf(w, "%s\t%d\t%d\t%d\t%s\t%s",
if _, err := fmt.Fprintf(w, "%s\t%d\t%d\t%d\t%d\t%d\t%s\t%s",
name,
desiredScheduled,
currentScheduled,
numberReady,
numberUpdated,
numberAvailable,
labels.FormatLabels(ds.Spec.Template.Spec.NodeSelector),
translateTimestamp(ds.CreationTimestamp),
); err != nil {
Expand Down
4 changes: 3 additions & 1 deletion pkg/printers/internalversion/printers_test.go
Expand Up @@ -1596,9 +1596,11 @@ func TestPrintDaemonSet(t *testing.T) {
CurrentNumberScheduled: 2,
DesiredNumberScheduled: 3,
NumberReady: 1,
UpdatedNumberScheduled: 2,
NumberAvailable: 0,
},
},
"test1\t3\t2\t1\t<none>\t0s\n",
"test1\t3\t2\t1\t2\t0\t<none>\t0s\n",
},
}

Expand Down