Merge pull request #87805 from zhouya0/add_kubectl_diff_exit_code_doc

Add kubectl diff exit code doc

Kubernetes-commit: e13463d755bd906b513103d533a25a84b382c8ff
This commit is contained in:
Kubernetes Publisher 2020-02-11 23:14:45 -08:00
commit 10f05fa5df
5 changed files with 30 additions and 5 deletions

2
Godeps/Godeps.json generated
View File

@ -580,7 +580,7 @@
}, },
{ {
"ImportPath": "k8s.io/client-go", "ImportPath": "k8s.io/client-go",
"Rev": "0ff5a65499e6" "Rev": "bf78b1a1f3d2"
}, },
{ {
"ImportPath": "k8s.io/code-generator", "ImportPath": "k8s.io/code-generator",

View File

@ -42,3 +42,17 @@ export KUBECTL_EXTERNAL_DIFF=meld; kubectl diff -k ./dir/
{% endmethod %} {% endmethod %}
{% method %}
## Exit status
The following exit values shall be returned:
`0`
No differences were found.
`1`
Differences were found.
`>1`
Kubectl or diff failed with an error.
**Note:** `KUBECTL_EXTERNAL_DIFF`, if used, is expected to follow that convention.
{% endmethod %}

4
go.mod
View File

@ -39,7 +39,7 @@ require (
k8s.io/api v0.0.0-20200209065837-d5ab0ddd8b73 k8s.io/api v0.0.0-20200209065837-d5ab0ddd8b73
k8s.io/apimachinery v0.0.0-20200209065656-fb45917aae8b k8s.io/apimachinery v0.0.0-20200209065656-fb45917aae8b
k8s.io/cli-runtime v0.0.0-20200209071941-a3380550112a k8s.io/cli-runtime v0.0.0-20200209071941-a3380550112a
k8s.io/client-go v0.0.0-20200210225353-0ff5a65499e6 k8s.io/client-go v0.0.0-20200214082304-bf78b1a1f3d2
k8s.io/component-base v0.0.0-20200209110224-e34e74d72164 k8s.io/component-base v0.0.0-20200209110224-e34e74d72164
k8s.io/klog v1.0.0 k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c
@ -56,7 +56,7 @@ replace (
k8s.io/api => k8s.io/api v0.0.0-20200209065837-d5ab0ddd8b73 k8s.io/api => k8s.io/api v0.0.0-20200209065837-d5ab0ddd8b73
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200209065656-fb45917aae8b k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200209065656-fb45917aae8b
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20200209071941-a3380550112a k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20200209071941-a3380550112a
k8s.io/client-go => k8s.io/client-go v0.0.0-20200210225353-0ff5a65499e6 k8s.io/client-go => k8s.io/client-go v0.0.0-20200214082304-bf78b1a1f3d2
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200209044353-396603da40fa k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200209044353-396603da40fa
k8s.io/component-base => k8s.io/component-base v0.0.0-20200209110224-e34e74d72164 k8s.io/component-base => k8s.io/component-base v0.0.0-20200209110224-e34e74d72164
k8s.io/metrics => k8s.io/metrics v0.0.0-20200209071824-48c4e2ddad0b k8s.io/metrics => k8s.io/metrics v0.0.0-20200209071824-48c4e2ddad0b

2
go.sum
View File

@ -315,7 +315,7 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
k8s.io/api v0.0.0-20200209065837-d5ab0ddd8b73/go.mod h1:p/XFTiuxjo+0OlHcql2jDLBO6mxwx4J9xy7Sq9vRtnY= k8s.io/api v0.0.0-20200209065837-d5ab0ddd8b73/go.mod h1:p/XFTiuxjo+0OlHcql2jDLBO6mxwx4J9xy7Sq9vRtnY=
k8s.io/apimachinery v0.0.0-20200209065656-fb45917aae8b/go.mod h1:5X8oEhnd931nEg6/Nkumo00nT6ZsCLp2h7Xwd7Ym6P4= k8s.io/apimachinery v0.0.0-20200209065656-fb45917aae8b/go.mod h1:5X8oEhnd931nEg6/Nkumo00nT6ZsCLp2h7Xwd7Ym6P4=
k8s.io/cli-runtime v0.0.0-20200209071941-a3380550112a/go.mod h1:STmitnuF1Wn7OiGEN67PnaK8WXHx76SPGZgZKsIdtr8= k8s.io/cli-runtime v0.0.0-20200209071941-a3380550112a/go.mod h1:STmitnuF1Wn7OiGEN67PnaK8WXHx76SPGZgZKsIdtr8=
k8s.io/client-go v0.0.0-20200210225353-0ff5a65499e6/go.mod h1:lrXl4vvqm+n6jlzJDxwcfMx2obCLSV1hYD1HuaL7WEc= k8s.io/client-go v0.0.0-20200214082304-bf78b1a1f3d2/go.mod h1:lrXl4vvqm+n6jlzJDxwcfMx2obCLSV1hYD1HuaL7WEc=
k8s.io/code-generator v0.0.0-20200209044353-396603da40fa/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/code-generator v0.0.0-20200209044353-396603da40fa/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc=
k8s.io/component-base v0.0.0-20200209110224-e34e74d72164/go.mod h1:D0o0vo4rsOSZ/RBsvwDaBwyF8JBQwfUEhO8nnx89q9Y= k8s.io/component-base v0.0.0-20200209110224-e34e74d72164/go.mod h1:D0o0vo4rsOSZ/RBsvwDaBwyF8JBQwfUEhO8nnx89q9Y=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=

View File

@ -56,7 +56,18 @@ var (
KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own
diff command. By default, the "diff" command available in your path will be diff command. By default, the "diff" command available in your path will be
run with "-u" (unified diff) and "-N" (treat absent files as empty) options.`)) run with "-u" (unified diff) and "-N" (treat absent files as empty) options.
Exit status:
0
No differences were found.
1
Differences were found.
>1
Kubectl or diff failed with an error.
Note: KUBECTL_EXTERNAL_DIFF, if used, is expected to follow that convention.`))
diffExample = templates.Examples(i18n.T(` diffExample = templates.Examples(i18n.T(`
# Diff resources included in pod.json. # Diff resources included in pod.json.
kubectl diff -f pod.json kubectl diff -f pod.json