Skip to content

Commit

Permalink
change -o template to -o go-template=...
Browse files Browse the repository at this point in the history
  • Loading branch information
daizuozhuo committed Sep 5, 2015
1 parent 9ccceac commit 2e2ef3e
Show file tree
Hide file tree
Showing 30 changed files with 124 additions and 74 deletions.
2 changes: 1 addition & 1 deletion cluster/libvirt-coreos/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function wait-cluster-readiness {

local timeout=120
while [[ $timeout -ne 0 ]]; do
nb_ready_minions=$("${kubectl}" get nodes -o template -t "{{range.items}}{{range.status.conditions}}{{.type}}{{end}}:{{end}}" --api-version=v1 2>/dev/null | tr ':' '\n' | grep -c Ready || true)
nb_ready_minions=$("${kubectl}" get nodes -o go-template="{{range.items}}{{range.status.conditions}}{{.type}}{{end}}:{{end}}" --api-version=v1 2>/dev/null | tr ':' '\n' | grep -c Ready || true)
echo "Nb ready minions: $nb_ready_minions / $NUM_MINIONS"
if [[ "$nb_ready_minions" -eq "$NUM_MINIONS" ]]; then
return 0
Expand Down
2 changes: 1 addition & 1 deletion cluster/saltbase/salt/kube-addons/kube-addon-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function run-until-success() {
# returns a list of <namespace>/<name> pairs (nsnames)
function get-addon-nsnames-from-server() {
local -r obj_type=$1
"${KUBECTL}" get "${obj_type}" --all-namespaces -o template -t "{{range.items}}{{.metadata.namespace}}/{{.metadata.name}} {{end}}" --api-version=v1 -l kubernetes.io/cluster-service=true
"${KUBECTL}" get "${obj_type}" --all-namespaces -o go-template="{{range.items}}{{.metadata.namespace}}/{{.metadata.name}} {{end}}" --api-version=v1 -l kubernetes.io/cluster-service=true
}

# returns the characters after the last separator (including)
Expand Down
2 changes: 1 addition & 1 deletion cluster/saltbase/salt/kube-addons/kube-addons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ start_addon /etc/kubernetes/addons/namespace.yaml 100 10 "" &
token_found=""
while [ -z "${token_found}" ]; do
sleep .5
token_found=$(${KUBECTL} get --namespace="${SYSTEM_NAMESPACE}" serviceaccount default -o template -t "{{with index .secrets 0}}{{.name}}{{end}}" || true)
token_found=$(${KUBECTL} get --namespace="${SYSTEM_NAMESPACE}" serviceaccount default -o go-template="{{with index .secrets 0}}{{.name}}{{end}}" || true)
done

echo "== default service account in the ${SYSTEM_NAMESPACE} namespace has token ${token_found} =="
Expand Down
4 changes: 2 additions & 2 deletions cluster/update-storage-objects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ declare -a resources=(
)

# Find all the namespaces.
namespaces=( $("${KUBECTL}" get namespaces -o template -t "{{range.items}}{{.metadata.name}} {{end}}"))
namespaces=( $("${KUBECTL}" get namespaces -o go-template="{{range.items}}{{.metadata.name}} {{end}}"))
if [ -z "${namespaces:-}" ]
then
echo "Unexpected: No namespace found. Nothing to do."
Expand All @@ -59,7 +59,7 @@ for resource in "${resources[@]}"
do
for namespace in "${namespaces[@]}"
do
instances=( $("${KUBECTL}" get "${resource}" --namespace="${namespace}" -o template -t "{{range.items}}{{.metadata.name}} {{end}}"))
instances=( $("${KUBECTL}" get "${resource}" --namespace="${namespace}" -o go-template="{{range.items}}{{.metadata.name}} {{end}}"))
# Nothing to do if there is no instance of that resource.
if [[ -z "${instances:-}" ]]
then
Expand Down
2 changes: 1 addition & 1 deletion cluster/vagrant/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function verify-cluster {
local count="0"
until [[ "$count" == "1" ]]; do
local minions
minions=$("${KUBE_ROOT}/cluster/kubectl.sh" get nodes -o template --template '{{range.items}}{{.metadata.name}}:{{end}}' --api-version=v1)
minions=$("${KUBE_ROOT}/cluster/kubectl.sh" get nodes -o go-template='{{range.items}}{{.metadata.name}}:{{end}}' --api-version=v1)
count=$(echo $minions | grep -c "${MINION_IPS[i]}") || {
printf "."
sleep 2
Expand Down
9 changes: 5 additions & 4 deletions docs/man/man1/kubectl-config-view.1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ You can use \-\-output=template \-\-template=TEMPLATE to extract specific values

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name.
Output format. One of: json|yaml|wide|name|go\-template=...|go\-template\-file=...|jsonpath=...|jsonpath\-file=... See golang template [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]] and jsonpath template [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]].

.PP
\fB\-\-output\-version\fP=""
Expand All @@ -58,9 +60,8 @@ You can use \-\-output=template \-\-template=TEMPLATE to extract specific values

.PP
\fB\-t\fP, \fB\-\-template\fP=""
Template string or path to template file to use when \-o=template, \-o=templatefile or \-o=jsonpath. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. The jsonpath template is composed of jsonpath expressions enclosed by {} [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]]
Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]].


.SH OPTIONS INHERITED FROM PARENT COMMANDS
Expand Down
9 changes: 5 additions & 4 deletions docs/man/man1/kubectl-expose.1
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ re\-use the labels from the resource it exposes.

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name.
Output format. One of: json|yaml|wide|name|go\-template=...|go\-template\-file=...|jsonpath=...|jsonpath\-file=... See golang template [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]] and jsonpath template [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]].

.PP
\fB\-\-output\-version\fP=""
Expand Down Expand Up @@ -100,9 +102,8 @@ re\-use the labels from the resource it exposes.

.PP
\fB\-t\fP, \fB\-\-template\fP=""
Template string or path to template file to use when \-o=template, \-o=templatefile or \-o=jsonpath. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. The jsonpath template is composed of jsonpath expressions enclosed by {} [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]]
Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]].

.PP
\fB\-\-type\fP=""
Expand Down
9 changes: 5 additions & 4 deletions docs/man/man1/kubectl-get.1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ of the \-\-template flag, you can filter the attributes of the fetched resource(

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name.
Output format. One of: json|yaml|wide|name|go\-template=...|go\-template\-file=...|jsonpath=...|jsonpath\-file=... See golang template [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]] and jsonpath template [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]].

.PP
\fB\-\-output\-version\fP=""
Expand All @@ -65,9 +67,8 @@ of the \-\-template flag, you can filter the attributes of the fetched resource(

.PP
\fB\-t\fP, \fB\-\-template\fP=""
Template string or path to template file to use when \-o=template, \-o=templatefile or \-o=jsonpath. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. The jsonpath template is composed of jsonpath expressions enclosed by {} [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]]
Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]].

.PP
\fB\-w\fP, \fB\-\-watch\fP=false
Expand Down
9 changes: 5 additions & 4 deletions docs/man/man1/kubectl-label.1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ If \-\-resource\-version is specified, then updates will use this resource versi

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name.
Output format. One of: json|yaml|wide|name|go\-template=...|go\-template\-file=...|jsonpath=...|jsonpath\-file=... See golang template [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]] and jsonpath template [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]].

.PP
\fB\-\-output\-version\fP=""
Expand Down Expand Up @@ -68,9 +70,8 @@ If \-\-resource\-version is specified, then updates will use this resource versi

.PP
\fB\-t\fP, \fB\-\-template\fP=""
Template string or path to template file to use when \-o=template, \-o=templatefile or \-o=jsonpath. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. The jsonpath template is composed of jsonpath expressions enclosed by {} [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]]
Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]].


.SH OPTIONS INHERITED FROM PARENT COMMANDS
Expand Down
9 changes: 5 additions & 4 deletions docs/man/man1/kubectl-rolling-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ existing replication controller and overwrite at least one (common) label in its

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name.
Output format. One of: json|yaml|wide|name|go\-template=...|go\-template\-file=...|jsonpath=...|jsonpath\-file=... See golang template [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]] and jsonpath template [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]].

.PP
\fB\-\-output\-version\fP=""
Expand All @@ -68,9 +70,8 @@ existing replication controller and overwrite at least one (common) label in its

.PP
\fB\-t\fP, \fB\-\-template\fP=""
Template string or path to template file to use when \-o=template, \-o=templatefile or \-o=jsonpath. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. The jsonpath template is composed of jsonpath expressions enclosed by {} [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]]
Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]].

.PP
\fB\-\-timeout\fP=5m0s
Expand Down
9 changes: 5 additions & 4 deletions docs/man/man1/kubectl-run.1
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ Creates a replication controller to manage the created container(s).

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name.
Output format. One of: json|yaml|wide|name|go\-template=...|go\-template\-file=...|jsonpath=...|jsonpath\-file=... See golang template [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]] and jsonpath template [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]].

.PP
\fB\-\-output\-version\fP=""
Expand Down Expand Up @@ -88,9 +90,8 @@ Creates a replication controller to manage the created container(s).

.PP
\fB\-t\fP, \fB\-\-template\fP=""
Template string or path to template file to use when \-o=template, \-o=templatefile or \-o=jsonpath. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. The jsonpath template is composed of jsonpath expressions enclosed by {} [
\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]]
Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]].

.PP
\fB\-\-tty\fP=false
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/compute-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ Events:

The `Restart Count: 5` indicates that the `simmemleak` container in this pod was terminated and restarted 5 times.

You can call `get pod` with the `-o template -t ...` option to fetch the status of previously terminated containers:
You can call `get pod` with the `-o go-template=...` option to fetch the status of previously terminated containers:

```console
[13:59:01] $ ./cluster/kubectl.sh get pod -o template -t '{{range.status.containerStatuses}}{{"Container Name: "}}{{.name}}{{"\r\nLastState: "}}{{.lastState}}{{end}}' simmemleak-60xbc
[13:59:01] $ ./cluster/kubectl.sh get pod -o go-template='{{range.status.containerStatuses}}{{"Container Name: "}}{{.name}}{{"\r\nLastState: "}}{{.lastState}}{{end}}' simmemleak-60xbc
Container Name: simmemleak
LastState: map[terminated:map[exitCode:137 reason:OOM Killed startedAt:2015-07-07T20:58:43Z finishedAt:2015-07-07T20:58:43Z containerID:docker://0e4095bba1feccdfe7ef9fb6ebffe972b4b14285d5acdec6f0d3ae8a22fad8b2]][13:59:03] clusterScaleDoc ~/go/src/github.com/kubernetes/kubernetes $
```
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/kubectl/kubectl_annotate.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ $ kubectl annotate pods foo description-

* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager

###### Auto generated by spf13/cobra at 2015-09-03 21:06:22.474197531 +0000 UTC
###### Auto generated by spf13/cobra at 2015-09-02 06:24:17.720533039 +0000 UTC

<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_annotate.md?pixel)]()
Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide/kubectl/kubectl_config_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ $ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2
--merge=true: merge together the full hierarchy of kubeconfig files
--minify[=false]: remove all information not used by current-context from the output
--no-headers[=false]: When using the default output, don't print headers.
-o, --output="": Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name.
-o, --output="": Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
--output-version="": Output the formatted object with the given version (default api-version).
--raw[=false]: display raw byte data
-a, --show-all[=false]: When printing, show all resources (default hide terminated pods.)
--sort-by="": If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. 'ObjectMeta.Name'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
--template="": Template string or path to template file to use when -o=template, -o=templatefile or -o=jsonpath. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. The jsonpath template is composed of jsonpath expressions enclosed by {} [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md]
--template="": Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```

### Options inherited from parent commands
Expand Down Expand Up @@ -103,7 +103,7 @@ $ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2

* [kubectl config](kubectl_config.md) - config modifies kubeconfig files

###### Auto generated by spf13/cobra at 2015-09-03 21:06:22.474467216 +0000 UTC
###### Auto generated by spf13/cobra at 2015-08-29 13:01:26.775349034 +0000 UTC

<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_view.md?pixel)]()
Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide/kubectl/kubectl_expose.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
-l, --labels="": Labels to apply to the service created by this call.
--name="": The name for the newly created object.
--no-headers[=false]: When using the default output, don't print headers.
-o, --output="": Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name.
-o, --output="": Output format. One of: json|yaml|wide|name|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md].
--output-version="": Output the formatted object with the given version (default api-version).
--overrides="": An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.
--port=-1: The port that the service should serve on. Copied from the resource being exposed, if unspecified
Expand All @@ -85,7 +85,7 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
-a, --show-all[=false]: When printing, show all resources (default hide terminated pods.)
--sort-by="": If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. 'ObjectMeta.Name'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
--target-port="": Name or number for the port on the container that the service should direct traffic to. Optional.
--template="": Template string or path to template file to use when -o=template, -o=templatefile or -o=jsonpath. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. The jsonpath template is composed of jsonpath expressions enclosed by {} [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md]
--template="": Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--type="": Type for this service: ClusterIP, NodePort, or LoadBalancer. Default is 'ClusterIP'.
```

Expand Down Expand Up @@ -121,7 +121,7 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream

* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager

###### Auto generated by spf13/cobra at 2015-09-03 21:06:22.473647619 +0000 UTC
###### Auto generated by spf13/cobra at 2015-09-03 09:05:42.928698484 +0000 UTC

<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_expose.md?pixel)]()
Expand Down
Loading

0 comments on commit 2e2ef3e

Please sign in to comment.