Commit Graph

23 Commits

Author SHA1 Message Date
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
ZhengYuan Loo c155b7bb87 feat: masked secrets in kubectl diff output (#96084)
* fix tests

* add changes

Kubernetes-commit: 0cbf00ad018d5104e438b5693fde435fa06e30c9
2021-05-18 14:19:27 +00:00
Masashi Honma c011a4ab83 Fix a unit test failure in non English languages
This is a result in Japanese language.

$ make test WHAT=./staging/src/k8s.io/kubectl/pkg/cmd/diff
[0402 07:24:05] Running tests without code coverage
FAIL: TestDiffProgram (0.00s)
    diff_test.go:73: stdout = "ファイル /dev/zero と /dev/zero は同一です\n", expected = Files /dev/zero and /dev/zero are identical
        "
FAIL
FAIL	k8s.io/kubernetes/staging/src/k8s.io/kubectl/pkg/cmd/diff	0.045s
FAIL
make: *** [Makefile:184: test] エラー 1

Kubernetes-commit: 6b9ff98dd72503e0cad5c626f67c716d465d18b2
2021-04-02 15:59:47 +09:00
Julian V. Modesto 04f62ffb0b Cache the OpenAPI schema for server-side dry-run.
Currently, server-side dry-run fetches the OpenAPI schema for every
single object.

This change fetches the OpenAPI schema only once.

Kubernetes-commit: caa158610dfb53de3582ed6df0eb37359206fc66
2021-01-19 16:36:14 -05:00
Douglas Schilling Landgraf 2560231a8d kubectl diff: update regex to allow equal param
When using GNU diffutils, some commands (e.g. --color[=WHEN])
requires an equal sign.

Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>

Kubernetes-commit: 722751accf7607f4d0573778e85027c63e1802ce
2021-01-18 23:22:36 -05:00
Sai Harsha Kottapalli 61b85bce7c warn user about resource being deleted
Kubernetes-commit: 7b0ef888f3205f06c871cff901ef0f5b8fdb250c
2020-10-11 02:21:32 +05:30
Douglas Schilling Landgraf bafd13fd9f kubectl: allow users to use args with KUBECTL_EXTERNAL_DIFF
Currently, if users try to use external diff command with arguments
will fail because the entire command won't be available through $PATH.
This patch allow users to use external diff tools with args (or not)
via KUBECTL_EXTERNAL_DIFF env.

Reference: https://github.com/kubernetes/kubectl/issues/937

Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>

Kubernetes-commit: a6158c01b9add5b580059d24cb66e54c37ea2531
2020-10-04 23:29:27 -04:00
Seth Pollack b55288a363 add labels to diff command
Kubernetes-commit: 75af2fca6125516dff42e9825ceea89367986f78
2020-05-07 14:30:00 -04:00
Julian V. Modesto 0d395d7c98 Make client-side apply safer
- Remove the ServerDryRun field and delegate it entirely to the resource.Helper
- Use resource.Helper for deletions (as in `kubectl apply --force`)
instead of using the pruner's method that uses a dynamic client
- Reduce the resource.Helpers and times we check for server-side dry-run
in apply

Kubernetes-commit: f0eb68c0cfcff6d50d9d5ec278f96820e3cb3f9a
2020-04-02 18:26:32 -04:00
Davanum Srinivas 445ad1366b switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
Julian V. Modesto 415a73888a Set kubectl field manager names
Kubernetes-commit: 360c348d0eb5be8c7c9720d5bfda16dbe04e8d15
2020-03-04 22:04:01 -05:00
Julian V. Modesto 1cfa7c66b3 Ensure diff doesn't persist patches
Kubernetes-commit: 9c0320f1bfd8edfb11c283b3fd422dc6e49360c5
2020-04-02 17:14:17 -04:00
Julian V. Modesto 87fc988437 Set field manager for kubectl diff --server-side.
Bonus: check diff only dry-runs without persisting.

Co-authored-by: Takahiro HATORI <tahatori@zlab.co.jp>

Kubernetes-commit: bacc2c49605f608d3f919109e0c37ebf6e1d7036
2020-03-02 14:06:50 -05:00
zhouya0 9c14935e27 Add kubectl diff exit code doc
Kubernetes-commit: 527e66fc2829917444d874771142fdd834feb8d6
2020-02-04 17:22:23 +08:00
Antoine Pelisse 4c36396b35 kubectl-diff: Return non-1 errors on kubectl failures
Currently, diff AND kubectl can return 1 errors either when diff finds
differences, or when kubectl fails something. It also prints an ugly
error when diff finds a differences, since 1 is treated as an error.

Two things this PR does:

1. If diff returns 1, then do not treat it as an error, and exit with
exit code 1. It no longer prints the ugly error.

2. Kubectl errors are +1'd so that they never return 1 which shouldn't
be considered an error.

We need to update the documentation accordingly, to mention that
`KUBECTL_EXTERNAL_DIFF` programs must also follow the convention of
using one as their exit code for changes detected.

Kubernetes-commit: f2b21f08d95291212ba8987aa9d446c02a96089a
2020-01-21 13:52:41 -08:00
Julian V. Modesto a3f7877cd1 Support DryRun in cli-runtime REST Helper.
- Move TestSupportsDryRun to cli-runtime
- Move TestDryRunVerifier to cli-runtime
- Add OpenAPI schema for testdata to cli-runtime
- Use Helper.DryRun and DryRunVerifier for Apply
- Add WithOptions methods to Helper

Kubernetes-commit: 6bea0e469bcfe4967cbf2656a998d60e0b684747
2019-12-18 22:00:34 -05:00
Antoine Pelisse 104e4d1e7a Improve error message when diff binary is not in PATH
Kubernetes-commit: c1a4cd9c75b4ed476ec3ed1b27a785dd1685a6e3
2020-01-17 16:17:41 -08:00
louisgong ae926dc56e fix kubectl diff panic
Kubernetes-commit: 4f13f2739a3a33c7ed4b86b98054972c0fde4579
2019-11-09 20:34:51 +08:00
David Symonds deabbd435b Fix description of diff flags.
Running `diff -u` produces a unified diff. It isn't related to Unicode.
Also, `diff -N` treats _absent_ files as empty, not new files.

Kubernetes-commit: 0af2dedd96e973f4ed59af0cc325a70ca0b9100a
2019-05-22 13:34:30 +10:00
Antoine Pelisse 4574b365f9 Rename --experimental-* flags to --* for server-side apply
Kubernetes-commit: a3f4e6e933d3292b3921cdc7b60d7ae019ca1580
2019-08-26 09:09:40 -07:00
Sean Sullivan 1483769081 Update gofmt
Kubernetes-commit: e2cae2344486af198f8ab38e4dd97d4f24dfd190
2019-08-01 13:14:06 -07:00
Sean Sullivan 5b48717f2d Update import statements to reflect code move
Kubernetes-commit: acece3c2964115a4f29a43e368ad5de59dbbc258
2019-08-01 11:10:05 -07:00
Sean Sullivan c6063dd846 Move pkg/kubectl/cmd/{command} to staging
Kubernetes-commit: 0e0ea523392f1121f61f99ac30a9bc2043eaed90
2019-08-01 11:01:40 -07:00