Commit Graph

42 Commits

Author SHA1 Message Date
Stephen Kitt 713b7e79c0 Use canonical json-patch v4 import
The canonical import for json-patch v4 is
gopkg.in/evanphx/json-patch.v4 (see
https://github.com/evanphx/json-patch/blob/master/README.md#get-it for
reference).

Using the v4-specific path should also reduce the risk of unwanted v5
upgrade attempts, because they won't be offered as automated upgrades
by dependency upgrade management tools, and they won't happen through
indirect dependencies (see
https://github.com/kubernetes/kubernetes/pull/120327 for context).

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: 5300466a5c8988b479a151ceb77f49dd00065c83
2024-02-16 13:57:24 +01:00
Arda Güçlü 5691f5e6f9 Gracefully handle empty config error when local flag is used
`f.ToRawKubeConfigLoader().Namespace()` throws `ErrEmptyConfig` when
default configuration file can not be found, even if it invalid.

However, when user explicitly passes `--local` flag, that means
we can gracefully handle this error and continue. This commit does that
for the commands having `--local` flag.

Kubernetes-commit: ba49ccdbc9b4761d0c9589ab7ca9f41029a99568
2023-06-15 10:13:52 +03:00
TommyStarK e88f1b3589 kubectl: use bytes.Buffer.String
Signed-off-by: TommyStarK <thomasmilox@gmail.com>

Kubernetes-commit: da4a8d831b933475cfdb20cb7e6d0ed027d516eb
2023-06-04 15:45:24 +02:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
Sean Sullivan 7c10c1c878 Unexport OpenAPIGetter factory method
Kubernetes-commit: 1da46b2f28267421dad9a8e5164e6bce16ae9fcb
2022-12-12 16:01:05 -08:00
Sean Sullivan 6dde41fea6 Removes unnecessary dry run verifier
Kubernetes-commit: 530f65d6fd5af81c0691143fbf2c00d440476bb9
2022-12-05 16:25:12 -08:00
inosato 8272d71ba6 Remove ioutil from kubectl
Signed-off-by: inosato <si17_21@yahoo.co.jp>

Kubernetes-commit: 774ab1349bfd553c97a99b992e9f38659f541c84
2022-07-30 22:31:16 +09:00
weikhor 992e246451 Clean up testing code of kubectl cmd section
Kubernetes-commit: 69b0b731e9dcfaa3960581165e4550758b0403c6
2022-10-27 22:18:42 -04:00
Brian Pursley 2861433ddd Fix label output bug where dry run message was not printed
Kubernetes-commit: 2efe97fa6cfa99512b3b101de4c23ce7a4100b05
2022-07-30 09:27:42 -04:00
xiaopeng bc02b7b600 add setErr
Signed-off-by: xiaopeng <hanxiaop8@outlook.com>

Kubernetes-commit: 8839609868d4b2b5887eefdbb216c1ed5b848edc
2022-06-21 17:57:48 +08:00
xiaopeng a833054047 replace deprecated setoutput
Kubernetes-commit: 48629bcc0588773bc837d1cc69cab8b21a2057e0
2022-04-05 14:04:22 +08:00
Alexandre Garnier 459942a56d Do not raise an error proposing to use '--overwrite' when labeling with the same value (#105936)
* Do not propose to use '--overwrite' when labeling with the same value

* Check expected error value in label_test.TestLabelFunc

Kubernetes-commit: 10eb7092f854c71122c03752465e868bce23c0b6
2022-05-04 02:17:49 +02:00
Marc Khouzam cd5b039b42 Refactor completion code into its own package
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: c4f8c57b43843abd13bae677b73c622e1c30b46f
2022-03-24 09:06:05 -04:00
Kevin Delgado 7e681490ec Generalize dry run verify to arbitrary query param
Kubernetes-commit: d6c83281bc696474a76365a879f2255b8b568786
2022-03-09 14:51:50 +00:00
Aram Peres 8e80d8fd7e Cleanup kubectl label selectors with 'cmdutil.AddLabelSelectorFlagVar'
Kubernetes-commit: 8f8138bc35f59ef04b77a3520d8d1065603ccdb7
2022-01-06 23:28:44 -05:00
astraw99 7f5c2f206a fix label msg
Kubernetes-commit: 83fe357f3e45423662f461f7cfd66bb18c122d33
2022-01-20 10:56:46 +08:00
astraw99 2ad6554e1e fix kubectl unlabel msg
Kubernetes-commit: cec30fdbedc326ef0abcbd8475b89840ae0f776d
2021-08-15 14:56:07 +08:00
Di Xu f106a734e3 cleanup description on deprecated include-uninitialized flag
Kubernetes-commit: ae7b9787ee7b46bb83b05d3769ed54374c0337a7
2021-07-26 11:14:55 +08:00
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
Marc Khouzam 724356168b Revert "Add Go tests for custom completions"
This reverts commit 0e18f0380042b652996d795559bfb818698abec3.

Kubernetes-commit: 1babceac650cfe8ec7ac71b34ed1ecf118b50f9d
2021-05-22 20:47:14 -04:00
Marc Khouzam 5c679b006e Join common functions for completion
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 9625872d1e4fd0d4d397b3ab732c6969a3a376fe
2021-05-15 21:22:42 -04:00
Marc Khouzam af40736fcc Add Go tests for custom completions
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: c0b3a698fa15265eecdec0bd8776658c40d8d151
2021-03-05 15:44:30 -05:00
Marc Khouzam 1946af5761 Move all completion bash code to Go code
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 879cdc5fa9e518ce76b9e1dc7e795132457966f3
2021-03-05 15:43:31 -05:00
David Eads f1feb4b0d5 add --all-namespaces to kubectl annotate,label
Kubernetes-commit: ad0cff7b61515e481098a1dfbe785066d655da97
2021-04-26 11:13:01 -04:00
xiongzhongliang 4c524fcbeb fix kubectl patch command error message
Kubernetes-commit: 99f0369f9d9110dbe5d36c20e067e25077a50d9d
2021-02-04 19:15:18 +08: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
xiongzhongliang 13d5d50660 fix kubectl label error when local=true is set.
fix kubectl label error when local=true is set.

fix kubectl label error when local=true is set.

Kubernetes-commit: cb7009a63bbc90569493f070463ae6715088d46a
2020-12-23 00:03:48 +08:00
zhouya0 384af9bcb2 Change kubectl list option stdout
Kubernetes-commit: abad08d915531a6f8686f58a8cb41395ed77c714
2020-07-01 17:00:25 +08: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 9c04919f3b Error if --local and --dry-run=server are passed
Kubernetes-commit: 5fcd9c7c7ec432dd27e770e49e0e6872335c765d
2020-02-13 16:44:14 -05:00
Julian V. Modesto f9460c5333 Use --dry-run=client,server in kubectl.
- Support --dry-run=server for subcommands apply, run, create, annotate,
expose, patch, label, autoscale, apply set-last-applied, drain, rollout undo
- Support --dry-run=server for set subcommands
  - image
  - resources
  - serviceaccount
  - selector
  - env
  - subject
- Support --dry-run=server for create subcommands.
  - clusterrole
  - clusterrolebinding
  - configmap
  - cronjob
  - job
  - deployment
  - namespace
  - poddisruptionbudget
  - priorityclass
  - quota
  - role
  - rolebinding
  - service
  - secret
  - serviceaccount
- Remove GetClientSideDryRun

Kubernetes-commit: 13b80b48cd02b8263d910f2423a1f5b92cdf7644
2020-01-30 20:23:33 -05:00
Julian V. Modesto c0b11fa131 Extend --dry-run to support string values.
* Extend --dry-run to support string values for dry run strategies
  'client', 'server', and 'none'
* Ensure --dry-run is set and accessed via cmdutil
* Deprecate --dry-run (unset), --dry-run=true, and --dry-run=false

Kubernetes-commit: af52beda260257e81cc9e19e9e5108b682ee93d6
2019-12-15 18:29:27 -05:00
Jordan Liggitt 25e7825a5b Fix --resource-version handling in kubectl
Kubernetes-commit: 0ac8345d3a4c5ee38fd3fc2c40976ba876d815e7
2019-11-14 09:24:42 -05:00
clarklee92 87db492820 Modify the status code number to HTTP status semantics
Signed-off-by: clarklee92 <clarklee1992@hotmail.com>

Kubernetes-commit: f86f5ee14ef3c8adf9855ce16dcc57beca949719
2019-11-06 00:45:35 +08:00
Sean Sullivan 3ec9685c39 Rename test/data directory to testdata
Kubernetes-commit: 4ce97d6c48ae4735463f020430dd20539a03e8c5
2019-10-31 13:40:02 -07:00
haoshuwei 4dd9f90e6e fix some missing errors return statements
Signed-off-by: haoshuwei <haoshuwei24@gmail.com>

Kubernetes-commit: c4fe8f11b200d0a97e8ce447e5af592b5c4870d0
2019-09-09 13:54:14 +08:00
draveness a61556981e feat: remove deprecated include uninitialized flag
Kubernetes-commit: f18f86ad9a16335e44b2799a419f51c9b606526b
2019-07-19 10:01:17 +08:00
Sean Sullivan 1cba7858ad Update test data to reflect code move to staging
Kubernetes-commit: 58b59ae4e07f9d3718271a43740a4de9508d8688
2019-08-01 15:17:53 -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