Skip to content

Commit e13463d

Browse files
authored
Merge pull request kubernetes#87805 from zhouya0/add_kubectl_diff_exit_code_doc
Add kubectl diff exit code doc
2 parents 52fb02f + 527e66f commit e13463d

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

staging/src/k8s.io/kubectl/docs/book/pages/app_composition_and_deployment/diffing_local_and_remote_resources.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,17 @@ export KUBECTL_EXTERNAL_DIFF=meld; kubectl diff -k ./dir/
4242

4343
{% endmethod %}
4444

45+
{% method %}
46+
## Exit status
47+
The following exit values shall be returned:
48+
49+
`0`
50+
No differences were found.
51+
`1`
52+
Differences were found.
53+
`>1`
54+
Kubectl or diff failed with an error.
55+
56+
**Note:** `KUBECTL_EXTERNAL_DIFF`, if used, is expected to follow that convention.
57+
58+
{% endmethod %}

staging/src/k8s.io/kubectl/pkg/cmd/diff/diff.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,18 @@ var (
5656
5757
KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own
5858
diff command. By default, the "diff" command available in your path will be
59-
run with "-u" (unified diff) and "-N" (treat absent files as empty) options.`))
59+
run with "-u" (unified diff) and "-N" (treat absent files as empty) options.
60+
61+
Exit status:
62+
0
63+
No differences were found.
64+
1
65+
Differences were found.
66+
>1
67+
Kubectl or diff failed with an error.
68+
69+
Note: KUBECTL_EXTERNAL_DIFF, if used, is expected to follow that convention.`))
70+
6071
diffExample = templates.Examples(i18n.T(`
6172
# Diff resources included in pod.json.
6273
kubectl diff -f pod.json

0 commit comments

Comments
 (0)