Skip to content

Commit

Permalink
Merge pull request kubernetes#5792 from ddysher/more-describe
Browse files Browse the repository at this point in the history
More node describe, and 'kubectl describe' tests for all resources
  • Loading branch information
j3ffml committed Mar 23, 2015
2 parents 737af02 + 1c135c0 commit 7f7a004
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hack/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ for version in "${kube_api_versions[@]}"; do
# Post-condition: valid-pod POD is running
kube::test::get_object_assert pods "{{range.items}}{{.$id_field}}:{{end}}" 'valid-pod:'
kube::test::get_object_assert 'pod valid-pod' "{{.$id_field}}" 'valid-pod'
# Describe command should print detailed information
kube::test::describe_object_assert pods 'valid-pod' "Name:" "Image(s):" "Host:" "Labels:" "Status:" "Replication Controllers"

### Dump current valid-pod POD
output_pod=$(kubectl get pod valid-pod -o yaml --output-version=v1beta1 "${kube_flags[@]}")
Expand Down Expand Up @@ -356,6 +358,8 @@ for version in "${kube_api_versions[@]}"; do
kubectl create -f examples/guestbook/redis-master-service.json "${kube_flags[@]}"
# Post-condition: redis-master service is running
kube::test::get_object_assert services "{{range.items}}{{.$id_field}}:{{end}}" 'kubernetes:kubernetes-ro:redis-master:'
# Describe command should print detailed information
kube::test::describe_object_assert services 'redis-master' "Name:" "Labels:" "Selector:" "IP:" "Port:" "Endpoints:" "Session Affinity:"

### Dump current redis-master service
output_service=$(kubectl get service redis-master -o json --output-version=v1beta3 "${kube_flags[@]}")
Expand Down Expand Up @@ -442,6 +446,8 @@ __EOF__
kubectl create -f examples/guestbook/frontend-controller.json "${kube_flags[@]}"
# Post-condition: frontend replication controller is running
kube::test::get_object_assert rc "{{range.items}}{{.$id_field}}:{{end}}" 'frontend-controller:'
# Describe command should print detailed information
kube::test::describe_object_assert rc 'frontend-controller' "Name:" "Image(s):" "Labels:" "Selector:" "Replicas:" "Pods Status:"

### Resize replication controller frontend with current-replicas and replicas
# Pre-condition: 3 replicas
Expand Down Expand Up @@ -501,7 +507,7 @@ __EOF__

kube::test::get_object_assert nodes "{{range.items}}{{.$id_field}}:{{end}}" '127.0.0.1:'

kube::test::describe_object_assert nodes "127.0.0.1" "Name:" "Conditions:" "Addresses:" "Capacity:" "Pods:"
kube::test::describe_object_assert nodes "127.0.0.1" "Name:" "Labels:" "CreationTimestamp:" "Conditions:" "Addresses:" "Capacity:" "Pods:"

###########
# Minions #
Expand Down
2 changes: 2 additions & 0 deletions pkg/kubectl/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ func (d *NodeDescriber) Describe(namespace, name string) (string, error) {
func describeNode(node *api.Node, pods []api.Pod, events *api.EventList) (string, error) {
return tabbedString(func(out io.Writer) error {
fmt.Fprintf(out, "Name:\t%s\n", node.Name)
fmt.Fprintf(out, "Labels:\t%s\n", formatLabels(node.Labels))
fmt.Fprintf(out, "CreationTimestamp:\t%s\n", node.CreationTimestamp.Time.Format(time.RFC1123Z))
if len(node.Status.Conditions) > 0 {
fmt.Fprint(out, "Conditions:\n Type\tStatus\tLastProbeTime\tLastTransitionTime\tReason\tMessage\n")
for _, c := range node.Status.Conditions {
Expand Down

0 comments on commit 7f7a004

Please sign in to comment.