diff --git a/contrib/completions/bash/kubectl b/contrib/completions/bash/kubectl index 107825c902d..08f18d5eb03 100644 --- a/contrib/completions/bash/kubectl +++ b/contrib/completions/bash/kubectl @@ -347,6 +347,7 @@ _kubectl_create() flags+=("-h") flags+=("--output=") two_word_flags+=("-o") + flags+=("--validate") must_have_one_flag=() must_have_one_flag+=("--filename=") @@ -378,6 +379,7 @@ _kubectl_replace() flags+=("--output=") two_word_flags+=("-o") flags+=("--timeout=") + flags+=("--validate") must_have_one_flag=() must_have_one_flag+=("--filename=") @@ -537,6 +539,7 @@ _kubectl_rolling-update() two_word_flags+=("-t") flags+=("--timeout=") flags+=("--update-period=") + flags+=("--validate") must_have_one_flag=() must_have_one_flag+=("--filename=") @@ -1149,7 +1152,6 @@ _kubectl() flags+=("--user=") flags+=("--username=") flags+=("--v=") - flags+=("--validate") flags+=("--vmodule=") must_have_one_flag=() diff --git a/docs/man/man1/kubectl-annotate.1 b/docs/man/man1/kubectl-annotate.1 index f6b9bf9b5f9..5d59e58d4e1 100644 --- a/docs/man/man1/kubectl-annotate.1 +++ b/docs/man/man1/kubectl-annotate.1 @@ -165,10 +165,6 @@ resourcequotas (quota) or secrets. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-api-versions.1 b/docs/man/man1/kubectl-api-versions.1 index c4212fd1d46..7ee68b2c2bd 100644 --- a/docs/man/man1/kubectl-api-versions.1 +++ b/docs/man/man1/kubectl-api-versions.1 @@ -111,10 +111,6 @@ Print available API versions. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-attach.1 b/docs/man/man1/kubectl-attach.1 index a245b11c1cb..c52d396b49d 100644 --- a/docs/man/man1/kubectl-attach.1 +++ b/docs/man/man1/kubectl-attach.1 @@ -123,10 +123,6 @@ Attach to a a process that is already running inside an existing container. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-cluster-info.1 b/docs/man/man1/kubectl-cluster-info.1 index 3f64ae37ab1..8d2c19a9a5f 100644 --- a/docs/man/man1/kubectl-cluster-info.1 +++ b/docs/man/man1/kubectl-cluster-info.1 @@ -111,10 +111,6 @@ Display addresses of the master and services with label kubernetes.io/cluster\-s \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-config-set-cluster.1 b/docs/man/man1/kubectl-config-set-cluster.1 index 79da9575417..f89e66e4971 100644 --- a/docs/man/man1/kubectl-config-set-cluster.1 +++ b/docs/man/man1/kubectl-config-set-cluster.1 @@ -116,10 +116,6 @@ Specifying a name that already exists will merge new fields on top of existing v \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-config-set-context.1 b/docs/man/man1/kubectl-config-set-context.1 index 82d4c897a46..389c0f0e311 100644 --- a/docs/man/man1/kubectl-config-set-context.1 +++ b/docs/man/man1/kubectl-config-set-context.1 @@ -112,10 +112,6 @@ Specifying a name that already exists will merge new fields on top of existing v \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-config-set-credentials.1 b/docs/man/man1/kubectl-config-set-credentials.1 index 04444998cbd..9e752ce55cc 100644 --- a/docs/man/man1/kubectl-config-set-credentials.1 +++ b/docs/man/man1/kubectl-config-set-credentials.1 @@ -131,10 +131,6 @@ Bearer token and basic auth are mutually exclusive. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-config-set.1 b/docs/man/man1/kubectl-config-set.1 index f83ea2edaa2..ccbd2645f55 100644 --- a/docs/man/man1/kubectl-config-set.1 +++ b/docs/man/man1/kubectl-config-set.1 @@ -113,10 +113,6 @@ PROPERTY\_VALUE is the new value you wish to set. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-config-unset.1 b/docs/man/man1/kubectl-config-unset.1 index cea12d2e81a..2e676d52901 100644 --- a/docs/man/man1/kubectl-config-unset.1 +++ b/docs/man/man1/kubectl-config-unset.1 @@ -112,10 +112,6 @@ PROPERTY\_NAME is a dot delimited name where each token represents either a attr \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-config-use-context.1 b/docs/man/man1/kubectl-config-use-context.1 index 4ae194bd2a6..35d7cc4a10b 100644 --- a/docs/man/man1/kubectl-config-use-context.1 +++ b/docs/man/man1/kubectl-config-use-context.1 @@ -111,10 +111,6 @@ Sets the current\-context in a kubeconfig file \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-config-view.1 b/docs/man/man1/kubectl-config-view.1 index eee772a414c..928ae6ff24f 100644 --- a/docs/man/man1/kubectl-config-view.1 +++ b/docs/man/man1/kubectl-config-view.1 @@ -156,10 +156,6 @@ You can use \-\-output=template \-\-template=TEMPLATE to extract specific values \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-config.1 b/docs/man/man1/kubectl-config.1 index a9965f35a18..88568368156 100644 --- a/docs/man/man1/kubectl-config.1 +++ b/docs/man/man1/kubectl-config.1 @@ -117,10 +117,6 @@ The loading order follows these rules: \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-create.1 b/docs/man/man1/kubectl-create.1 index 0f51003787e..7d991f9088e 100644 --- a/docs/man/man1/kubectl-create.1 +++ b/docs/man/man1/kubectl-create.1 @@ -32,6 +32,10 @@ JSON and YAML formats are accepted. \fB\-o\fP, \fB\-\-output\fP="" Output mode. Use "\-o name" for shorter output (resource/name). +.PP +\fB\-\-validate\fP=true + If true, use a schema to validate the input before sending it + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP @@ -122,10 +126,6 @@ JSON and YAML formats are accepted. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-delete.1 b/docs/man/man1/kubectl-delete.1 index d6ea5a00d24..f4d2fbe7568 100644 --- a/docs/man/man1/kubectl-delete.1 +++ b/docs/man/man1/kubectl-delete.1 @@ -154,10 +154,6 @@ will be lost along with the rest of the resource. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-describe.1 b/docs/man/man1/kubectl-describe.1 index 61dba11d7bd..bc4f4a1bbbf 100644 --- a/docs/man/man1/kubectl-describe.1 +++ b/docs/man/man1/kubectl-describe.1 @@ -136,10 +136,6 @@ namespaces (ns) or secrets. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-exec.1 b/docs/man/man1/kubectl-exec.1 index 706802a9079..53bca656b82 100644 --- a/docs/man/man1/kubectl-exec.1 +++ b/docs/man/man1/kubectl-exec.1 @@ -127,10 +127,6 @@ Execute a command in a container. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-expose.1 b/docs/man/man1/kubectl-expose.1 index 9ce2652a2ac..ad15489f809 100644 --- a/docs/man/man1/kubectl-expose.1 +++ b/docs/man/man1/kubectl-expose.1 @@ -202,10 +202,6 @@ re\-use the labels from the resource it exposes. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-get.1 b/docs/man/man1/kubectl-get.1 index 596a2906021..c8a7586d25b 100644 --- a/docs/man/man1/kubectl-get.1 +++ b/docs/man/man1/kubectl-get.1 @@ -171,10 +171,6 @@ of the \-\-template flag, you can filter the attributes of the fetched resource( \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-label.1 b/docs/man/man1/kubectl-label.1 index 8a80008cf9b..a922551019f 100644 --- a/docs/man/man1/kubectl-label.1 +++ b/docs/man/man1/kubectl-label.1 @@ -162,10 +162,6 @@ If \-\-resource\-version is specified, then updates will use this resource versi \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-logs.1 b/docs/man/man1/kubectl-logs.1 index d4cc5bdc466..c2ebb6943ae 100644 --- a/docs/man/man1/kubectl-logs.1 +++ b/docs/man/man1/kubectl-logs.1 @@ -127,10 +127,6 @@ Print the logs for a container in a pod. If the pod has only one container, the \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-namespace.1 b/docs/man/man1/kubectl-namespace.1 index 169b5219a3a..c2d0ab18efc 100644 --- a/docs/man/man1/kubectl-namespace.1 +++ b/docs/man/man1/kubectl-namespace.1 @@ -114,10 +114,6 @@ namespace has been superseded by the context.namespace field of .kubeconfig file \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-patch.1 b/docs/man/man1/kubectl-patch.1 index 6e6cf10bbec..ff692ad024d 100644 --- a/docs/man/man1/kubectl-patch.1 +++ b/docs/man/man1/kubectl-patch.1 @@ -130,10 +130,6 @@ Please refer to the models in \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-port-forward.1 b/docs/man/man1/kubectl-port-forward.1 index 2b0531261be..5cb224f00b1 100644 --- a/docs/man/man1/kubectl-port-forward.1 +++ b/docs/man/man1/kubectl-port-forward.1 @@ -115,10 +115,6 @@ Forward one or more local ports to a pod. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-proxy.1 b/docs/man/man1/kubectl-proxy.1 index 6f80e852476..8144e15e5df 100644 --- a/docs/man/man1/kubectl-proxy.1 +++ b/docs/man/man1/kubectl-proxy.1 @@ -172,10 +172,6 @@ The above lets you 'curl localhost:8001/custom/api/v1/pods' \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-replace.1 b/docs/man/man1/kubectl-replace.1 index 5eef26eb5cf..a60ddcd2e1e 100644 --- a/docs/man/man1/kubectl-replace.1 +++ b/docs/man/man1/kubectl-replace.1 @@ -54,6 +54,10 @@ Please refer to the models in \fB\-\-timeout\fP=0 Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object +.PP +\fB\-\-validate\fP=true + If true, use a schema to validate the input before sending it + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP @@ -144,10 +148,6 @@ Please refer to the models in \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-rolling-update.1 b/docs/man/man1/kubectl-rolling-update.1 index 954eb0c3dd3..58a55d755a8 100644 --- a/docs/man/man1/kubectl-rolling-update.1 +++ b/docs/man/man1/kubectl-rolling-update.1 @@ -84,6 +84,10 @@ existing replication controller and overwrite at least one (common) label in its \fB\-\-update\-period\fP=1m0s Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". +.PP +\fB\-\-validate\fP=true + If true, use a schema to validate the input before sending it + .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP @@ -174,10 +178,6 @@ existing replication controller and overwrite at least one (common) label in its \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-run.1 b/docs/man/man1/kubectl-run.1 index b28b60d606b..e32f2ee81bd 100644 --- a/docs/man/man1/kubectl-run.1 +++ b/docs/man/man1/kubectl-run.1 @@ -190,10 +190,6 @@ Creates a replication controller to manage the created container(s). \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-scale.1 b/docs/man/man1/kubectl-scale.1 index c1defb1c0e8..c0dea101f9b 100644 --- a/docs/man/man1/kubectl-scale.1 +++ b/docs/man/man1/kubectl-scale.1 @@ -141,10 +141,6 @@ scale is sent to the server. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-stop.1 b/docs/man/man1/kubectl-stop.1 index f0803b2a3f6..efb409c5ee7 100644 --- a/docs/man/man1/kubectl-stop.1 +++ b/docs/man/man1/kubectl-stop.1 @@ -147,10 +147,6 @@ If the resource is scalable it will be scaled to 0 before deletion. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl-version.1 b/docs/man/man1/kubectl-version.1 index d91fca6c10f..557f7687f9f 100644 --- a/docs/man/man1/kubectl-version.1 +++ b/docs/man/man1/kubectl-version.1 @@ -115,10 +115,6 @@ Print the client and server version information. \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/man/man1/kubectl.1 b/docs/man/man1/kubectl.1 index 36889d8056d..26db3cab4a7 100644 --- a/docs/man/man1/kubectl.1 +++ b/docs/man/man1/kubectl.1 @@ -113,10 +113,6 @@ Find more information at \fB\-\-v\fP=0 log level for V logs -.PP -\fB\-\-validate\fP=false - If true, use a schema to validate the input before sending it - .PP \fB\-\-vmodule\fP= comma\-separated list of pattern=N settings for file\-filtered logging diff --git a/docs/user-guide/kubectl/kubectl b/docs/user-guide/kubectl/kubectl new file mode 100644 index 00000000000..107825c902d --- /dev/null +++ b/docs/user-guide/kubectl/kubectl @@ -0,0 +1,1179 @@ +#!/bin/bash + + +__debug() +{ + if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then + echo "$*" >> "${BASH_COMP_DEBUG_FILE}" + fi +} + +__index_of_word() +{ + local w word=$1 + shift + index=0 + for w in "$@"; do + [[ $w = "$word" ]] && return + index=$((index+1)) + done + index=-1 +} + +__contains_word() +{ + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done + return 1 +} + +__handle_reply() +{ + __debug "${FUNCNAME}" + case $cur in + -*) + compopt -o nospace + local allflags + if [ ${#must_have_one_flag[@]} -ne 0 ]; then + allflags=("${must_have_one_flag[@]}") + else + allflags=("${flags[*]} ${two_word_flags[*]}") + fi + COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") ) + [[ $COMPREPLY == *= ]] || compopt +o nospace + return 0; + ;; + esac + + # check if we are handling a flag with special work handling + local index + __index_of_word "${prev}" "${flags_with_completion[@]}" + if [[ ${index} -ge 0 ]]; then + ${flags_completion[${index}]} + return + fi + + # we are parsing a flag and don't have a special handler, no completion + if [[ ${cur} != "${words[cword]}" ]]; then + return + fi + + local completions + if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then + completions=("${must_have_one_flag[@]}") + elif [[ ${#must_have_one_noun[@]} -ne 0 ]]; then + completions=("${must_have_one_noun[@]}") + else + completions=("${commands[@]}") + fi + COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") ) + + if [[ ${#COMPREPLY[@]} -eq 0 ]]; then + declare -F __custom_func >/dev/null && __custom_func + fi +} + +# The arguments should be in the form "ext1|ext2|extn" +__handle_filename_extension_flag() +{ + local ext="$1" + _filedir "@(${ext})" +} + +__handle_subdirs_in_dir_flag() +{ + local dir="$1" + pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 +} + +__handle_flag() +{ + __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}" + + # if a command required a flag, and we found it, unset must_have_one_flag() + local flagname=${words[c]} + # if the word contained an = + if [[ ${words[c]} == *"="* ]]; then + flagname=${flagname%=*} # strip everything after the = + flagname="${flagname}=" # but put the = back + fi + __debug "${FUNCNAME}: looking for ${flagname}" + if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then + must_have_one_flag=() + fi + + # skip the argument to a two word flag + if __contains_word "${words[c]}" "${two_word_flags[@]}"; then + c=$((c+1)) + # if we are looking for a flags value, don't show commands + if [[ $c -eq $cword ]]; then + commands=() + fi + fi + + # skip the flag itself + c=$((c+1)) + +} + +__handle_noun() +{ + __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}" + + if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then + must_have_one_noun=() + fi + + nouns+=("${words[c]}") + c=$((c+1)) +} + +__handle_command() +{ + __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}" + + local next_command + if [[ -n ${last_command} ]]; then + next_command="_${last_command}_${words[c]}" + else + next_command="_${words[c]}" + fi + c=$((c+1)) + __debug "${FUNCNAME}: looking for ${next_command}" + declare -F $next_command >/dev/null && $next_command +} + +__handle_word() +{ + if [[ $c -ge $cword ]]; then + __handle_reply + return + fi + __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}" + if [[ "${words[c]}" == -* ]]; then + __handle_flag + elif __contains_word "${words[c]}" "${commands[@]}"; then + __handle_command + else + __handle_noun + fi + __handle_word +} + +# call kubectl get $1, +__kubectl_parse_get() +{ + local template + template="{{ range .items }}{{ .metadata.name }} {{ end }}" + local kubectl_out + if kubectl_out=$(kubectl get -o template --template="${template}" "$1" 2>/dev/null); then + COMPREPLY=( $( compgen -W "${kubectl_out[*]}" -- "$cur" ) ) + fi +} + +__kubectl_get_resource() +{ + if [[ ${#nouns[@]} -eq 0 ]]; then + return 1 + fi + __kubectl_parse_get "${nouns[${#nouns[@]} -1]}" +} + +__kubectl_get_resource_pod() +{ + __kubectl_parse_get "pod" +} + +# $1 is the name of the pod we want to get the list of containers inside +__kubectl_get_containers() +{ + local template + template="{{ range .spec.containers }}{{ .name }} {{ end }}" + __debug "${FUNCNAME} nouns are ${nouns[*]}" + + local len="${#nouns[@]}" + if [[ ${len} -ne 1 ]]; then + return + fi + local last=${nouns[${len} -1]} + local kubectl_out + if kubectl_out=$(kubectl get -o template --template="${template}" pods "${last}" 2>/dev/null); then + COMPREPLY=( $( compgen -W "${kubectl_out[*]}" -- "$cur" ) ) + fi +} + +# Require both a pod and a container to be specified +__kubectl_require_pod_and_container() +{ + if [[ ${#nouns[@]} -eq 0 ]]; then + __kubectl_parse_get pods + return 0 + fi; + __kubectl_get_containers + return 0 +} + +__custom_func() { + case ${last_command} in + kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_stop) + __kubectl_get_resource + return + ;; + kubectl_logs) + __kubectl_require_pod_and_container + return + ;; + kubectl_exec) + __kubectl_get_resource_pod + return + ;; + *) + ;; + esac +} + +_kubectl_get() +{ + last_command="kubectl_get" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all-namespaces") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--help") + flags+=("-h") + flags+=("--label-columns=") + two_word_flags+=("-L") + flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--output-version=") + flags+=("--selector=") + two_word_flags+=("-l") + flags+=("--show-all") + flags+=("-a") + flags+=("--sort-by=") + flags+=("--template=") + two_word_flags+=("-t") + flags+=("--watch") + flags+=("-w") + flags+=("--watch-only") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("componentstatus") + must_have_one_noun+=("endpoints") + must_have_one_noun+=("event") + must_have_one_noun+=("limitrange") + must_have_one_noun+=("namespace") + must_have_one_noun+=("node") + must_have_one_noun+=("persistentvolume") + must_have_one_noun+=("persistentvolumeclaim") + must_have_one_noun+=("pod") + must_have_one_noun+=("podtemplate") + must_have_one_noun+=("replicationcontroller") + must_have_one_noun+=("resourcequota") + must_have_one_noun+=("secret") + must_have_one_noun+=("service") + must_have_one_noun+=("serviceaccount") + must_have_one_noun+=("thirdpartyresource") +} + +_kubectl_describe() +{ + last_command="kubectl_describe" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--help") + flags+=("-h") + flags+=("--selector=") + two_word_flags+=("-l") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("limitrange") + must_have_one_noun+=("minion") + must_have_one_noun+=("namespace") + must_have_one_noun+=("node") + must_have_one_noun+=("persistentvolume") + must_have_one_noun+=("persistentvolumeclaim") + must_have_one_noun+=("pod") + must_have_one_noun+=("replicationcontroller") + must_have_one_noun+=("resourcequota") + must_have_one_noun+=("secret") + must_have_one_noun+=("service") + must_have_one_noun+=("serviceaccount") +} + +_kubectl_create() +{ + last_command="kubectl_create" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--help") + flags+=("-h") + flags+=("--output=") + two_word_flags+=("-o") + + must_have_one_flag=() + must_have_one_flag+=("--filename=") + must_have_one_flag+=("-f") + must_have_one_noun=() +} + +_kubectl_replace() +{ + last_command="kubectl_replace" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--cascade") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--force") + flags+=("--grace-period=") + flags+=("--help") + flags+=("-h") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--timeout=") + + must_have_one_flag=() + must_have_one_flag+=("--filename=") + must_have_one_flag+=("-f") + must_have_one_noun=() +} + +_kubectl_patch() +{ + last_command="kubectl_patch" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--help") + flags+=("-h") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--patch=") + two_word_flags+=("-p") + + must_have_one_flag=() + must_have_one_flag+=("--patch=") + must_have_one_flag+=("-p") + must_have_one_noun=() +} + +_kubectl_delete() +{ + last_command="kubectl_delete" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + flags+=("--cascade") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--grace-period=") + flags+=("--help") + flags+=("-h") + flags+=("--ignore-not-found") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--selector=") + two_word_flags+=("-l") + flags+=("--timeout=") + + must_have_one_flag=() + must_have_one_noun=() + must_have_one_noun+=("componentstatus") + must_have_one_noun+=("endpoints") + must_have_one_noun+=("event") + must_have_one_noun+=("limitrange") + must_have_one_noun+=("namespace") + must_have_one_noun+=("node") + must_have_one_noun+=("persistentvolume") + must_have_one_noun+=("persistentvolumeclaim") + must_have_one_noun+=("pod") + must_have_one_noun+=("podtemplate") + must_have_one_noun+=("replicationcontroller") + must_have_one_noun+=("resourcequota") + must_have_one_noun+=("secret") + must_have_one_noun+=("service") + must_have_one_noun+=("serviceaccount") + must_have_one_noun+=("thirdpartyresource") +} + +_kubectl_namespace() +{ + last_command="kubectl_namespace" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_logs() +{ + last_command="kubectl_logs" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--container=") + two_word_flags+=("-c") + flags+=("--follow") + flags+=("-f") + flags+=("--help") + flags+=("-h") + flags+=("--interactive") + flags+=("--previous") + flags+=("-p") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_rolling-update() +{ + last_command="kubectl_rolling-update" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--deployment-label-key=") + flags+=("--dry-run") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--help") + flags+=("-h") + flags+=("--image=") + flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--output-version=") + flags+=("--poll-interval=") + flags+=("--rollback") + flags+=("--show-all") + flags+=("-a") + flags+=("--sort-by=") + flags+=("--template=") + two_word_flags+=("-t") + flags+=("--timeout=") + flags+=("--update-period=") + + must_have_one_flag=() + must_have_one_flag+=("--filename=") + must_have_one_flag+=("-f") + must_have_one_flag+=("--image=") + must_have_one_noun=() +} + +_kubectl_scale() +{ + last_command="kubectl_scale" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--current-replicas=") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--help") + flags+=("-h") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--replicas=") + flags+=("--resource-version=") + flags+=("--timeout=") + + must_have_one_flag=() + must_have_one_flag+=("--replicas=") + must_have_one_noun=() +} + +_kubectl_attach() +{ + last_command="kubectl_attach" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--container=") + two_word_flags+=("-c") + flags+=("--help") + flags+=("-h") + flags+=("--stdin") + flags+=("-i") + flags+=("--tty") + flags+=("-t") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_exec() +{ + last_command="kubectl_exec" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--container=") + two_word_flags+=("-c") + flags+=("--help") + flags+=("-h") + flags+=("--pod=") + two_word_flags+=("-p") + flags+=("--stdin") + flags+=("-i") + flags+=("--tty") + flags+=("-t") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_port-forward() +{ + last_command="kubectl_port-forward" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + flags+=("--pod=") + two_word_flags+=("-p") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_proxy() +{ + last_command="kubectl_proxy" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--accept-hosts=") + flags+=("--accept-paths=") + flags+=("--api-prefix=") + flags+=("--disable-filter") + flags+=("--help") + flags+=("-h") + flags+=("--port=") + two_word_flags+=("-p") + flags+=("--reject-methods=") + flags+=("--reject-paths=") + flags+=("--unix-socket=") + two_word_flags+=("-u") + flags+=("--www=") + two_word_flags+=("-w") + flags+=("--www-prefix=") + two_word_flags+=("-P") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_run() +{ + last_command="kubectl_run" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--attach") + flags+=("--command") + flags+=("--dry-run") + flags+=("--generator=") + flags+=("--help") + flags+=("-h") + flags+=("--hostport=") + flags+=("--image=") + flags+=("--labels=") + two_word_flags+=("-l") + flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--output-version=") + flags+=("--overrides=") + flags+=("--port=") + flags+=("--replicas=") + two_word_flags+=("-r") + flags+=("--restart=") + flags+=("--show-all") + flags+=("-a") + flags+=("--sort-by=") + flags+=("--stdin") + flags+=("-i") + flags+=("--template=") + two_word_flags+=("-t") + flags+=("--tty") + + must_have_one_flag=() + must_have_one_flag+=("--image=") + must_have_one_noun=() +} + +_kubectl_stop() +{ + last_command="kubectl_stop" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--grace-period=") + flags+=("--help") + flags+=("-h") + flags+=("--ignore-not-found") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--selector=") + two_word_flags+=("-l") + flags+=("--timeout=") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_expose() +{ + last_command="kubectl_expose" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--container-port=") + flags+=("--create-external-load-balancer") + flags+=("--dry-run") + flags+=("--external-ip=") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--generator=") + flags+=("--help") + flags+=("-h") + flags+=("--labels=") + two_word_flags+=("-l") + flags+=("--name=") + flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--output-version=") + flags+=("--overrides=") + flags+=("--port=") + flags+=("--protocol=") + flags+=("--selector=") + flags+=("--session-affinity=") + flags+=("--show-all") + flags+=("-a") + flags+=("--sort-by=") + flags+=("--target-port=") + flags+=("--template=") + two_word_flags+=("-t") + flags+=("--type=") + + must_have_one_flag=() + must_have_one_flag+=("--port=") + must_have_one_noun=() +} + +_kubectl_label() +{ + last_command="kubectl_label" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--help") + flags+=("-h") + flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--output-version=") + flags+=("--overwrite") + flags+=("--resource-version=") + flags+=("--selector=") + two_word_flags+=("-l") + flags+=("--show-all") + flags+=("-a") + flags+=("--sort-by=") + flags+=("--template=") + two_word_flags+=("-t") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_annotate() +{ + last_command="kubectl_annotate" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--all") + flags+=("--filename=") + flags_with_completion+=("--filename") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + two_word_flags+=("-f") + flags_with_completion+=("-f") + flags_completion+=("__handle_filename_extension_flag json|yaml|yml") + flags+=("--help") + flags+=("-h") + flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--output-version=") + flags+=("--overwrite") + flags+=("--resource-version=") + flags+=("--show-all") + flags+=("-a") + flags+=("--sort-by=") + flags+=("--template=") + two_word_flags+=("-t") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_config_view() +{ + last_command="kubectl_config_view" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--flatten") + flags+=("--help") + flags+=("-h") + flags+=("--merge") + flags+=("--minify") + flags+=("--no-headers") + flags+=("--output=") + two_word_flags+=("-o") + flags+=("--output-version=") + flags+=("--raw") + flags+=("--show-all") + flags+=("-a") + flags+=("--sort-by=") + flags+=("--template=") + two_word_flags+=("-t") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_config_set-cluster() +{ + last_command="kubectl_config_set-cluster" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--api-version=") + flags+=("--certificate-authority=") + flags+=("--embed-certs") + flags+=("--help") + flags+=("-h") + flags+=("--insecure-skip-tls-verify") + flags+=("--server=") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_config_set-credentials() +{ + last_command="kubectl_config_set-credentials" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--client-certificate=") + flags+=("--client-key=") + flags+=("--embed-certs") + flags+=("--help") + flags+=("-h") + flags+=("--password=") + flags+=("--token=") + flags+=("--username=") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_config_set-context() +{ + last_command="kubectl_config_set-context" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--cluster=") + flags+=("--help") + flags+=("-h") + flags+=("--namespace=") + flags+=("--user=") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_config_set() +{ + last_command="kubectl_config_set" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_config_unset() +{ + last_command="kubectl_config_unset" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_config_use-context() +{ + last_command="kubectl_config_use-context" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_config() +{ + last_command="kubectl_config" + commands=() + commands+=("view") + commands+=("set-cluster") + commands+=("set-credentials") + commands+=("set-context") + commands+=("set") + commands+=("unset") + commands+=("use-context") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + flags+=("--kubeconfig=") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_cluster-info() +{ + last_command="kubectl_cluster-info" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_api-versions() +{ + last_command="kubectl_api-versions" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--help") + flags+=("-h") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl_version() +{ + last_command="kubectl_version" + commands=() + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--client") + flags+=("-c") + flags+=("--help") + flags+=("-h") + + must_have_one_flag=() + must_have_one_noun=() +} + +_kubectl() +{ + last_command="kubectl" + commands=() + commands+=("get") + commands+=("describe") + commands+=("create") + commands+=("replace") + commands+=("patch") + commands+=("delete") + commands+=("namespace") + commands+=("logs") + commands+=("rolling-update") + commands+=("scale") + commands+=("attach") + commands+=("exec") + commands+=("port-forward") + commands+=("proxy") + commands+=("run") + commands+=("stop") + commands+=("expose") + commands+=("label") + commands+=("annotate") + commands+=("config") + commands+=("cluster-info") + commands+=("api-versions") + commands+=("version") + + flags=() + two_word_flags=() + flags_with_completion=() + flags_completion=() + + flags+=("--alsologtostderr") + flags+=("--api-version=") + flags+=("--certificate-authority=") + flags+=("--client-certificate=") + flags+=("--client-key=") + flags+=("--cluster=") + flags+=("--context=") + flags+=("--help") + flags+=("-h") + flags+=("--insecure-skip-tls-verify") + flags+=("--kubeconfig=") + flags+=("--log-backtrace-at=") + flags+=("--log-dir=") + flags+=("--log-flush-frequency=") + flags+=("--logtostderr") + flags+=("--match-server-version") + flags+=("--namespace=") + flags+=("--password=") + flags+=("--server=") + two_word_flags+=("-s") + flags+=("--stderrthreshold=") + flags+=("--token=") + flags+=("--user=") + flags+=("--username=") + flags+=("--v=") + flags+=("--validate") + flags+=("--vmodule=") + + must_have_one_flag=() + must_have_one_noun=() +} + +__start_kubectl() +{ + local cur prev words cword + _init_completion -s || return + + local c=0 + local flags=() + local two_word_flags=() + local flags_with_completion=() + local flags_completion=() + local commands=("kubectl") + local must_have_one_flag=() + local must_have_one_noun=() + local last_command + local nouns=() + + __handle_word +} + +complete -F __start_kubectl kubectl +# ex: ts=4 sw=4 et filetype=sh diff --git a/docs/user-guide/kubectl/kubectl.md b/docs/user-guide/kubectl/kubectl.md index 304c557bbf4..7b5e9f04f5a 100644 --- a/docs/user-guide/kubectl/kubectl.md +++ b/docs/user-guide/kubectl/kubectl.md @@ -72,7 +72,6 @@ kubectl --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -102,7 +101,7 @@ kubectl * [kubectl stop](kubectl_stop.md) - Deprecated: Gracefully shut down a resource by name or filename. * [kubectl version](kubectl_version.md) - Print the client and server version information. -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.481555644 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.169032754 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_annotate.md b/docs/user-guide/kubectl/kubectl_annotate.md index 46871cab143..6bc9f457311 100644 --- a/docs/user-guide/kubectl/kubectl_annotate.md +++ b/docs/user-guide/kubectl/kubectl_annotate.md @@ -119,7 +119,6 @@ $ kubectl annotate pods foo description- --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` diff --git a/docs/user-guide/kubectl/kubectl_api-versions.md b/docs/user-guide/kubectl/kubectl_api-versions.md index 7f6e229376a..a2f22363446 100644 --- a/docs/user-guide/kubectl/kubectl_api-versions.md +++ b/docs/user-guide/kubectl/kubectl_api-versions.md @@ -75,7 +75,6 @@ kubectl api-versions --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -83,7 +82,7 @@ kubectl api-versions * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.481201276 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.168773226 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_api-versions.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_attach.md b/docs/user-guide/kubectl/kubectl_attach.md index edd63acc922..14856822d7e 100644 --- a/docs/user-guide/kubectl/kubectl_attach.md +++ b/docs/user-guide/kubectl/kubectl_attach.md @@ -92,7 +92,6 @@ $ kubectl attach 123456-7890 -c ruby-container -i -t --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -100,7 +99,7 @@ $ kubectl attach 123456-7890 -c ruby-container -i -t * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.477447179 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.165905157 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_attach.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_cluster-info.md b/docs/user-guide/kubectl/kubectl_cluster-info.md index aaf27291800..9a4b821eb20 100644 --- a/docs/user-guide/kubectl/kubectl_cluster-info.md +++ b/docs/user-guide/kubectl/kubectl_cluster-info.md @@ -75,7 +75,6 @@ kubectl cluster-info --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -83,7 +82,7 @@ kubectl cluster-info * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.481057477 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.168659453 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_cluster-info.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config.md b/docs/user-guide/kubectl/kubectl_config.md index 9c19eea12b7..c44a1656e01 100644 --- a/docs/user-guide/kubectl/kubectl_config.md +++ b/docs/user-guide/kubectl/kubectl_config.md @@ -81,7 +81,6 @@ kubectl config SUBCOMMAND --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -96,7 +95,7 @@ kubectl config SUBCOMMAND * [kubectl config use-context](kubectl_config_use-context.md) - Sets the current-context in a kubeconfig file * [kubectl config view](kubectl_config_view.md) - displays Merged kubeconfig settings or a specified kubeconfig file. -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.480913444 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.16853102 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config_set-cluster.md b/docs/user-guide/kubectl/kubectl_config_set-cluster.md index 6316ff98475..03d96efde53 100644 --- a/docs/user-guide/kubectl/kubectl_config_set-cluster.md +++ b/docs/user-guide/kubectl/kubectl_config_set-cluster.md @@ -90,7 +90,6 @@ $ kubectl config set-cluster e2e --insecure-skip-tls-verify=true --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -98,7 +97,7 @@ $ kubectl config set-cluster e2e --insecure-skip-tls-verify=true * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.479946549 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.167359915 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-cluster.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config_set-context.md b/docs/user-guide/kubectl/kubectl_config_set-context.md index 5bba7845c00..fb5f519a2aa 100644 --- a/docs/user-guide/kubectl/kubectl_config_set-context.md +++ b/docs/user-guide/kubectl/kubectl_config_set-context.md @@ -83,7 +83,6 @@ $ kubectl config set-context gce --user=cluster-admin --token="": Bearer token for authentication to the API server. --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -91,7 +90,7 @@ $ kubectl config set-context gce --user=cluster-admin * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.480303261 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.168034038 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-context.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config_set-credentials.md b/docs/user-guide/kubectl/kubectl_config_set-credentials.md index 5c40501f531..dc6d3da6bef 100644 --- a/docs/user-guide/kubectl/kubectl_config_set-credentials.md +++ b/docs/user-guide/kubectl/kubectl_config_set-credentials.md @@ -103,7 +103,6 @@ $ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admi --stderrthreshold=2: logs at or above this threshold go to stderr --user="": The name of the kubeconfig user to use --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -111,7 +110,7 @@ $ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admi * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.480107057 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.167500874 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-credentials.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config_set.md b/docs/user-guide/kubectl/kubectl_config_set.md index 1564ee2b13a..6c15b3a31f7 100644 --- a/docs/user-guide/kubectl/kubectl_config_set.md +++ b/docs/user-guide/kubectl/kubectl_config_set.md @@ -77,7 +77,6 @@ kubectl config set PROPERTY_NAME PROPERTY_VALUE --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -85,7 +84,7 @@ kubectl config set PROPERTY_NAME PROPERTY_VALUE * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.480452342 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.16816699 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config_unset.md b/docs/user-guide/kubectl/kubectl_config_unset.md index 42e39438f51..a78b673632a 100644 --- a/docs/user-guide/kubectl/kubectl_config_unset.md +++ b/docs/user-guide/kubectl/kubectl_config_unset.md @@ -76,7 +76,6 @@ kubectl config unset PROPERTY_NAME --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -84,7 +83,7 @@ kubectl config unset PROPERTY_NAME * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.480598704 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.168279315 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_unset.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config_use-context.md b/docs/user-guide/kubectl/kubectl_config_use-context.md index 4ba8b725a69..5247161b5f8 100644 --- a/docs/user-guide/kubectl/kubectl_config_use-context.md +++ b/docs/user-guide/kubectl/kubectl_config_use-context.md @@ -75,7 +75,6 @@ kubectl config use-context CONTEXT_NAME --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -83,7 +82,7 @@ kubectl config use-context CONTEXT_NAME * [kubectl config](kubectl_config.md) - config modifies kubeconfig files -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.480752945 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.168411074 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_use-context.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_config_view.md b/docs/user-guide/kubectl/kubectl_config_view.md index 82c47552a07..8e96a3ad6ff 100644 --- a/docs/user-guide/kubectl/kubectl_config_view.md +++ b/docs/user-guide/kubectl/kubectl_config_view.md @@ -97,7 +97,6 @@ $ kubectl config view -o template --template='{{range .users}}{{ if eq .name "e2 --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -105,7 +104,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-08-21 17:04:52.393094162 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-25 10:17:24.594231276 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_view.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_create.md b/docs/user-guide/kubectl/kubectl_create.md index cf1e6efbd19..0fced5bf559 100644 --- a/docs/user-guide/kubectl/kubectl_create.md +++ b/docs/user-guide/kubectl/kubectl_create.md @@ -62,6 +62,7 @@ $ cat pod.json | kubectl create -f - -f, --filename=[]: Filename, directory, or URL to file to use to create the resource -h, --help[=false]: help for create -o, --output="": Output mode. Use "-o name" for shorter output (resource/name). + --validate[=true]: If true, use a schema to validate the input before sending it ``` ### Options inherited from parent commands @@ -89,7 +90,6 @@ $ cat pod.json | kubectl create -f - --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -97,7 +97,7 @@ $ cat pod.json | kubectl create -f - * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.475503857 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.164310684 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_create.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_delete.md b/docs/user-guide/kubectl/kubectl_delete.md index fef5d5d0631..9a9b596ec26 100644 --- a/docs/user-guide/kubectl/kubectl_delete.md +++ b/docs/user-guide/kubectl/kubectl_delete.md @@ -113,7 +113,6 @@ $ kubectl delete pods --all --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -121,7 +120,7 @@ $ kubectl delete pods --all * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-21 06:18:47.444397685 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-25 10:17:24.591839542 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_delete.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_describe.md b/docs/user-guide/kubectl/kubectl_describe.md index 074aa0bda2f..015860bc4b0 100644 --- a/docs/user-guide/kubectl/kubectl_describe.md +++ b/docs/user-guide/kubectl/kubectl_describe.md @@ -113,7 +113,6 @@ $ kubectl describe pods frontend --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` diff --git a/docs/user-guide/kubectl/kubectl_exec.md b/docs/user-guide/kubectl/kubectl_exec.md index 32fe1647898..14d6ae0e74c 100644 --- a/docs/user-guide/kubectl/kubectl_exec.md +++ b/docs/user-guide/kubectl/kubectl_exec.md @@ -93,7 +93,6 @@ $ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -101,7 +100,7 @@ $ kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.477614406 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.166032952 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_exec.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_expose.md b/docs/user-guide/kubectl/kubectl_expose.md index 86b53d31cb9..f03ae9ad441 100644 --- a/docs/user-guide/kubectl/kubectl_expose.md +++ b/docs/user-guide/kubectl/kubectl_expose.md @@ -116,7 +116,6 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -124,7 +123,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-08-21 17:04:52.392625597 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-25 10:17:24.593785768 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_expose.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_get.md b/docs/user-guide/kubectl/kubectl_get.md index 034ddf1fa62..fd98fcec139 100644 --- a/docs/user-guide/kubectl/kubectl_get.md +++ b/docs/user-guide/kubectl/kubectl_get.md @@ -123,7 +123,6 @@ $ kubectl get rc/web service/frontend pods/web-pod-13je7 --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -131,7 +130,7 @@ $ kubectl get rc/web service/frontend pods/web-pod-13je7 * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-21 17:04:52.389792296 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-25 10:17:24.591177912 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_get.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_label.md b/docs/user-guide/kubectl/kubectl_label.md index 43bd9f32b91..8367510e497 100644 --- a/docs/user-guide/kubectl/kubectl_label.md +++ b/docs/user-guide/kubectl/kubectl_label.md @@ -113,7 +113,6 @@ $ kubectl label pods foo bar- --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -121,7 +120,7 @@ $ kubectl label pods foo bar- * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-21 17:04:52.392784742 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-25 10:17:24.593929691 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_label.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_logs.md b/docs/user-guide/kubectl/kubectl_logs.md index 327aa1e0ee8..e28dc9116e3 100644 --- a/docs/user-guide/kubectl/kubectl_logs.md +++ b/docs/user-guide/kubectl/kubectl_logs.md @@ -92,7 +92,6 @@ $ kubectl logs -f 123456-7890 ruby-container --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -100,7 +99,7 @@ $ kubectl logs -f 123456-7890 ruby-container * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.476847461 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.165044878 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_logs.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_namespace.md b/docs/user-guide/kubectl/kubectl_namespace.md index b72060824c4..da011d2bd93 100644 --- a/docs/user-guide/kubectl/kubectl_namespace.md +++ b/docs/user-guide/kubectl/kubectl_namespace.md @@ -78,7 +78,6 @@ kubectl namespace [namespace] --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -86,7 +85,7 @@ kubectl namespace [namespace] * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.476203071 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.164903046 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_namespace.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_patch.md b/docs/user-guide/kubectl/kubectl_patch.md index 1e0b1c47256..04b4a2c6ed3 100644 --- a/docs/user-guide/kubectl/kubectl_patch.md +++ b/docs/user-guide/kubectl/kubectl_patch.md @@ -96,7 +96,6 @@ kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -104,7 +103,7 @@ kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.475848256 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.164613432 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_patch.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_port-forward.md b/docs/user-guide/kubectl/kubectl_port-forward.md index 688435b93c6..1800978db3c 100644 --- a/docs/user-guide/kubectl/kubectl_port-forward.md +++ b/docs/user-guide/kubectl/kubectl_port-forward.md @@ -93,7 +93,6 @@ $ kubectl port-forward mypod 0:5000 --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -101,7 +100,7 @@ $ kubectl port-forward mypod 0:5000 * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.47778769 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.166148947 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_port-forward.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_proxy.md b/docs/user-guide/kubectl/kubectl_proxy.md index 19a3773e7d2..4aa613ced45 100644 --- a/docs/user-guide/kubectl/kubectl_proxy.md +++ b/docs/user-guide/kubectl/kubectl_proxy.md @@ -115,7 +115,6 @@ $ kubectl proxy --api-prefix=/k8s-api --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -123,7 +122,7 @@ $ kubectl proxy --api-prefix=/k8s-api * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.477994494 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.166284754 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_proxy.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_replace.md b/docs/user-guide/kubectl/kubectl_replace.md index 94e51341d7a..c4e58c165ea 100644 --- a/docs/user-guide/kubectl/kubectl_replace.md +++ b/docs/user-guide/kubectl/kubectl_replace.md @@ -76,6 +76,7 @@ kubectl replace --force -f ./pod.json -h, --help[=false]: help for replace -o, --output="": Output mode. Use "-o name" for shorter output (resource/name). --timeout=0: Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object + --validate[=true]: If true, use a schema to validate the input before sending it ``` ### Options inherited from parent commands @@ -103,7 +104,6 @@ kubectl replace --force -f ./pod.json --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -111,7 +111,7 @@ kubectl replace --force -f ./pod.json * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.475684757 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.164469074 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_replace.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_rolling-update.md b/docs/user-guide/kubectl/kubectl_rolling-update.md index 30eb1b45cb5..2d4f6e07619 100644 --- a/docs/user-guide/kubectl/kubectl_rolling-update.md +++ b/docs/user-guide/kubectl/kubectl_rolling-update.md @@ -84,6 +84,7 @@ $ kubectl rolling-update frontend --image=image:v2 --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] --timeout=5m0s: Max time to wait for a replication controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". --update-period=1m0s: Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". + --validate[=true]: If true, use a schema to validate the input before sending it ``` ### Options inherited from parent commands @@ -111,7 +112,6 @@ $ kubectl rolling-update frontend --image=image:v2 --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -119,7 +119,7 @@ $ kubectl rolling-update frontend --image=image:v2 * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-21 17:04:52.390982319 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-25 10:17:24.592687096 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_rolling-update.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_run.md b/docs/user-guide/kubectl/kubectl_run.md index f35f55b639b..92db13f132b 100644 --- a/docs/user-guide/kubectl/kubectl_run.md +++ b/docs/user-guide/kubectl/kubectl_run.md @@ -120,7 +120,6 @@ $ kubectl run nginx --image=nginx --command -- ... --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -128,7 +127,7 @@ $ kubectl run nginx --image=nginx --command -- ... * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-21 17:04:52.392255386 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-25 10:17:24.593489492 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_run.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_scale.md b/docs/user-guide/kubectl/kubectl_scale.md index 8ac54ac7be4..fcb061bdd82 100644 --- a/docs/user-guide/kubectl/kubectl_scale.md +++ b/docs/user-guide/kubectl/kubectl_scale.md @@ -102,7 +102,6 @@ $ kubectl scale --replicas=5 rc/foo rc/bar --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -110,7 +109,7 @@ $ kubectl scale --replicas=5 rc/foo rc/bar * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.477281515 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.165785015 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_scale.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_stop.md b/docs/user-guide/kubectl/kubectl_stop.md index b409aac797a..90144527f83 100644 --- a/docs/user-guide/kubectl/kubectl_stop.md +++ b/docs/user-guide/kubectl/kubectl_stop.md @@ -104,7 +104,6 @@ $ kubectl stop -f path/to/resources --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -112,7 +111,7 @@ $ kubectl stop -f path/to/resources * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.478408029 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.166601667 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_stop.md?pixel)]() diff --git a/docs/user-guide/kubectl/kubectl_version.md b/docs/user-guide/kubectl/kubectl_version.md index b59fec6b1ab..5bc9266e2d2 100644 --- a/docs/user-guide/kubectl/kubectl_version.md +++ b/docs/user-guide/kubectl/kubectl_version.md @@ -76,7 +76,6 @@ kubectl version --user="": The name of the kubeconfig user to use --username="": Username for basic authentication to the API server. --v=0: log level for V logs - --validate[=false]: If true, use a schema to validate the input before sending it --vmodule=: comma-separated list of pattern=N settings for file-filtered logging ``` @@ -84,7 +83,7 @@ kubectl version * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-20 22:01:12.48136046 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-21 17:18:05.1688832 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_version.md?pixel)]() diff --git a/examples/guestbook-go/redis-master-controller.json b/examples/guestbook-go/redis-master-controller.json index 40eb186bce7..51f835a2e28 100644 --- a/examples/guestbook-go/redis-master-controller.json +++ b/examples/guestbook-go/redis-master-controller.json @@ -1,7 +1,6 @@ { "kind":"ReplicationController", "apiVersion":"v1", - "id":"redis-master", "metadata":{ "name":"redis-master", "labels":{ diff --git a/pkg/api/validation/schema.go b/pkg/api/validation/schema.go index ec3bd23a38d..8b1cf674b6b 100644 --- a/pkg/api/validation/schema.go +++ b/pkg/api/validation/schema.go @@ -141,7 +141,6 @@ func (s *SwaggerSchema) ValidateObject(obj interface{}, apiVersion, fieldName, t } errs := s.validateField(value, apiVersion, fieldName+key, fieldType, &details) if len(errs) > 0 { - glog.Errorf("Validation failed for: %s, %v", key, value) allErrs = append(allErrs, errs...) } } diff --git a/pkg/kubectl/cmd/cmd_test.go b/pkg/kubectl/cmd/cmd_test.go index 70cffd78a2b..5f95a00ca68 100644 --- a/pkg/kubectl/cmd/cmd_test.go +++ b/pkg/kubectl/cmd/cmd_test.go @@ -155,7 +155,7 @@ func NewTestFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) { Printer: func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, columnLabels []string) (kubectl.ResourcePrinter, error) { return t.Printer, t.Err }, - Validator: func() (validation.Schema, error) { + Validator: func(validate bool) (validation.Schema, error) { return t.Validator, t.Err }, DefaultNamespace: func() (string, bool, error) { @@ -210,7 +210,7 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) { Printer: func(mapping *meta.RESTMapping, noHeaders, withNamespace bool, wide bool, showAll bool, columnLabels []string) (kubectl.ResourcePrinter, error) { return t.Printer, t.Err }, - Validator: func() (validation.Schema, error) { + Validator: func(validate bool) (validation.Schema, error) { return t.Validator, t.Err }, DefaultNamespace: func() (string, bool, error) { diff --git a/pkg/kubectl/cmd/create.go b/pkg/kubectl/cmd/create.go index a0c5a6bd459..0ef66c7e579 100644 --- a/pkg/kubectl/cmd/create.go +++ b/pkg/kubectl/cmd/create.go @@ -57,7 +57,7 @@ func NewCmdCreate(f *cmdutil.Factory, out io.Writer) *cobra.Command { usage := "Filename, directory, or URL to file to use to create the resource" kubectl.AddJsonFilenameFlag(cmd, usage) cmd.MarkFlagRequired("filename") - + cmdutil.AddValidateFlag(cmd) cmdutil.AddOutputFlagsForMutation(cmd) return cmd } @@ -70,8 +70,7 @@ func ValidateArgs(cmd *cobra.Command, args []string) error { } func RunCreate(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer) error { - - schema, err := f.Validator() + schema, err := f.Validator(cmdutil.GetFlagBool(cmd, "validate")) if err != nil { return err } diff --git a/pkg/kubectl/cmd/replace.go b/pkg/kubectl/cmd/replace.go index cdad1857757..8ae4f572e84 100644 --- a/pkg/kubectl/cmd/replace.go +++ b/pkg/kubectl/cmd/replace.go @@ -73,6 +73,7 @@ func NewCmdReplace(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd.Flags().Bool("cascade", false, "Only relevant during a force replace. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController).") cmd.Flags().Int("grace-period", -1, "Only relevant during a force replace. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative.") cmd.Flags().Duration("timeout", 0, "Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object") + cmdutil.AddValidateFlag(cmd) cmdutil.AddOutputFlagsForMutation(cmd) return cmd } @@ -81,7 +82,7 @@ func RunReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []st if len(os.Args) > 1 && os.Args[1] == "update" { printDeprecationWarning("replace", "update") } - schema, err := f.Validator() + schema, err := f.Validator(cmdutil.GetFlagBool(cmd, "validate")) if err != nil { return err } @@ -135,7 +136,7 @@ func RunReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []st } func forceReplace(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, filenames []string, shortOutput bool) error { - schema, err := f.Validator() + schema, err := f.Validator(cmdutil.GetFlagBool(cmd, "validate")) if err != nil { return err } diff --git a/pkg/kubectl/cmd/rollingupdate.go b/pkg/kubectl/cmd/rollingupdate.go index 8f2b4087fa3..d2e8ef0c23d 100644 --- a/pkg/kubectl/cmd/rollingupdate.go +++ b/pkg/kubectl/cmd/rollingupdate.go @@ -85,6 +85,7 @@ func NewCmdRollingUpdate(f *cmdutil.Factory, out io.Writer) *cobra.Command { cmd.Flags().String("deployment-label-key", "deployment", "The key to use to differentiate between two different controllers, default 'deployment'. Only relevant when --image is specified, ignored otherwise") cmd.Flags().Bool("dry-run", false, "If true, print out the changes that would be made, but don't actually make them.") cmd.Flags().Bool("rollback", false, "If true, this is a request to abort an existing rollout that is partially rolled out. It effectively reverses current and next and runs a rollout") + cmdutil.AddValidateFlag(cmd) cmdutil.AddPrinterFlags(cmd) return cmd } @@ -163,7 +164,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg mapper, typer := f.Object() if len(filename) != 0 { - schema, err := f.Validator() + schema, err := f.Validator(cmdutil.GetFlagBool(cmd, "validate")) if err != nil { return err } diff --git a/pkg/kubectl/cmd/util/factory.go b/pkg/kubectl/cmd/util/factory.go index 3fa6bbe51d7..49c9be8de4c 100644 --- a/pkg/kubectl/cmd/util/factory.go +++ b/pkg/kubectl/cmd/util/factory.go @@ -79,7 +79,7 @@ type Factory struct { // LabelsForObject returns the labels associated with the provided object LabelsForObject func(object runtime.Object) (map[string]string, error) // Returns a schema that can validate objects stored on disk. - Validator func() (validation.Schema, error) + Validator func(validate bool) (validation.Schema, error) // Returns the default namespace to use in cases where no // other namespace is specified and whether the namespace was // overriden. @@ -247,8 +247,8 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory { } return kubectl.ReaperFor(mapping.Kind, client, expClient) }, - Validator: func() (validation.Schema, error) { - if flags.Lookup("validate").Value.String() == "true" { + Validator: func(validate bool) (validation.Schema, error) { + if validate { client, err := clients.ClientForVersion("") if err != nil { return nil, err @@ -273,12 +273,6 @@ func (f *Factory) BindFlags(flags *pflag.FlagSet) { // any flags defined by external projects (not part of pflags) flags.AddGoFlagSet(flag.CommandLine) - // Hack for global access to validation flag. - // TODO: Refactor out after configuration flag overhaul. - if f.flags.Lookup("validate") == nil { - f.flags.Bool("validate", false, "If true, use a schema to validate the input before sending it") - } - // Merge factory's flags flags.AddFlagSet(f.flags) diff --git a/pkg/kubectl/cmd/util/helpers.go b/pkg/kubectl/cmd/util/helpers.go index cd9e1a49e10..2adb8113e44 100644 --- a/pkg/kubectl/cmd/util/helpers.go +++ b/pkg/kubectl/cmd/util/helpers.go @@ -259,6 +259,10 @@ func GetFlagDuration(cmd *cobra.Command, flag string) time.Duration { return d } +func AddValidateFlag(cmd *cobra.Command) { + cmd.Flags().Bool("validate", true, "If true, use a schema to validate the input before sending it") +} + func ReadConfigDataFromReader(reader io.Reader, source string) ([]byte, error) { data, err := ioutil.ReadAll(reader) if err != nil { diff --git a/pkg/kubectl/resource/visitor.go b/pkg/kubectl/resource/visitor.go index f085d63df8d..e2491821e08 100644 --- a/pkg/kubectl/resource/visitor.go +++ b/pkg/kubectl/resource/visitor.go @@ -34,7 +34,10 @@ import ( "k8s.io/kubernetes/pkg/watch" ) -const constSTDINstr string = "STDIN" +const ( + constSTDINstr string = "STDIN" + stopValidateMessage = "if you choose to ignore these errors, turn validation off with --validate=false" +) // Visitor lets clients walk a list of resources. type Visitor interface { @@ -205,7 +208,7 @@ func ValidateSchema(data []byte, schema validation.Schema) error { return fmt.Errorf("error converting to YAML: %v", err) } if err := schema.ValidateBytes(data); err != nil { - return fmt.Errorf("error validating data: %v", err) + return fmt.Errorf("error validating data: %v; %s", err, stopValidateMessage) } return nil }