Commit Graph

73 Commits

Author SHA1 Message Date
Anish Shah b22c40d47c kubectl: remove subresource restrictions from all commands
Removing this restrictions will allow us to use these commands with the
new resize subresource.

Kubernetes-commit: e1ca63489f2b788f893ab37a27242ce319e1eaf6
2024-10-31 16:00:52 -07:00
David Eads d6ad8b12b7 add --subresource to kubectl apply
Kubernetes-commit: 55ba8b2cbb375aaedcd01dd5d4dd0f81ef0415bf
2024-09-25 17:23:09 -04:00
Jordan Liggitt 81ad0ffc39 Prune explicit nulls from client-side apply create
Kubernetes-commit: 8483b9c08763c8f615216e95efdde46d5c7f6ef7
2024-05-29 01:14:18 -04:00
yulng 4afdc439d1 remove PruneWhitelist, use prune-allowlist instead
Signed-off-by: yulng <wei.yang@daocloud.io>
Signed-off-by: Paco Xu <paco.xu@daocloud.io>

Kubernetes-commit: 06679402e75d001d54770c9ec67cacbf28794009
2023-07-05 11:38:20 +08:00
Jefftree 351ba8bb1c Lazy load OpenAPIV2
Kubernetes-commit: eb32969ab8f3d1455c33a595bba5b3ce4d8a03b8
2023-10-30 15:42:22 -04:00
Jefftree 8c8a04f6d0 Add feature toggle for OpenAPI V3 apply in kubectl
Kubernetes-commit: f23ab829bee7951188d3196c16794cc489d0348c
2023-10-27 01:23:19 -04:00
Jefftree 8b0ab9a40e Use OpenAPI V3 for client side SMP
Kubernetes-commit: 4f3b0b15182d80b02d7a7bd2c210c145b7552f82
2023-09-15 16:46:53 -04:00
Andrea Hoffer b676723184 Update CLI help text for grammar and consistency
Kubernetes-commit: a86380c7813a6d0cfa248c9165c878038730526a
2023-06-12 15:55:59 -04:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
justinsb 62b0fbdb7a kubectl prunev2: Refactor the applyset to be more reusable
This enables sharing with diff.

Kubernetes-commit: d016fdcc834099dee721f42a384e1bc1f710e599
2023-03-14 12:12:00 +00:00
Katrina Verey a038484b5c Allow conformant CRDs to be ApplySet parents
Kubernetes-commit: 923d9b63fd87e9446f5746f544237c7e0de009a0
2023-03-07 11:29:50 -05:00
Katrina Verey ca98377c3e Applyset dry run tests + ID value (#116265)
* Test for ApplySet with --dry-run=client|server

* Use the real format for ApplySet ID

* Incorporate feedback

* Adjustments from rebase

Kubernetes-commit: 6a31757f45693fec5ea4723bcb405ce4437e31ca
2023-03-15 11:17:56 +00:00
Justin SB 0567f1e464 prunev2: Implement basic pruning
Implement the basic prune strategy where we find-by-label and then
delete unknown objects.

Kubernetes-commit: f17a319dc60374a46be1b37a453227d134ac479e
2023-02-22 21:40:25 -05:00
Katrina Verey 250ef6fa54 Feedback and linter
Kubernetes-commit: 3b0e13482e4459f9cb6a006cac2da76333992efd
2023-03-03 11:50:16 -05:00
Katrina Verey a04ac8a907 Create and update the ApplySet parent object
Kubernetes-commit: 7f874c91017eefd12df3d824793ab7e9b0be088e
2023-02-27 18:40:59 -05:00
Justin SB a7db218701 cleanup: replace deprecated sets.String
Replace with generics, including using the more-accurate type
types.UID for visitedUids.

Kubernetes-commit: 0b5fa1934250307c4df7c6bcabf6a6b1b00e73d9
2023-03-01 09:05:59 -05:00
Justin SB 78b973156e prunev2: Add labels for objects that we apply
As we apply objects when using apply/prune v2, we want to be sure they
include the label that ties them back to the applyset they are part
of.

Co-Authored-By: Katrina Verey <katrina.verey@shopify.com>

Kubernetes-commit: ab058308401b35b4865424cfa43ed75a554af2a3
2023-02-22 22:06:48 -05:00
Katrina Verey 530dea246b Introduce CLI for ApplySet-based pruning (#115979)
* Introduce CLI for ApplySet-based pruning

* Address feedback from justinsb

* Fix parent namespace sourcing and restrict types. Increase test coverage.

Kubernetes-commit: 0dd346673c00158247c8232f9e81a308fb741463
2023-02-27 12:20:40 -05:00
Sean Sullivan 7efcc7e0ac Fixes prune for server-side applied objects
Kubernetes-commit: 21393f1b1d859cecdcc9aeee01f7dbf9aab71120
2022-10-25 21:59:31 +00:00
Chok Yip Lau de2d479b98 fixed error
Kubernetes-commit: 65eb7f1e0c452a0ce00d9db874c54a5de2932564
2022-12-18 22:58:23 -05:00
Chok Yip Lau 3fea4735ad Removed factory from apply command flag struct
Kubernetes-commit: cdd84a28bfc2e1e7ad552de128cd1644c7deeae7
2022-11-20 15:53:05 -05:00
Sean Sullivan e5c05deb7b Refactor to simplify factory Validator
Kubernetes-commit: 5e8648b9f1cdbcbb10f22fd46b6ac40dbc471de2
2022-12-11 18:20:28 -08:00
Sean Sullivan 6dde41fea6 Removes unnecessary dry run verifier
Kubernetes-commit: 530f65d6fd5af81c0691143fbf2c00d440476bb9
2022-12-05 16:25:12 -08:00
Brian Pursley 41407b14e8 kubectl apply: Deprecate --prune-whitelist in favor of --prune-allowlist
Changes in kubectl apply --prune to support k8s Inclusive Naming Initiative:
* Deprecated the --prune-whitelist flag.
* Deprecated the PruneWhitelist field on ApplyFlags struct.
* Removed PruneWhitelist field (not used anywhere) from ApplyOptions struct.
* Added --prune-allowlist flag.
* Added PruneAllowlist field on ApplyFlags struct.
* Added unit tests for prune with allowlist

This commit also fixes a bug where the command would fail if you specified
the sameGVK multiple times for --allow-whitelist. Now it only attempts to
prune the unique set of allowed GVKs.

Kubernetes-commit: f7ebf4d8852d4500f24100ca9a4ca665efc1fada
2022-10-30 20:50:19 -04:00
Alexander Zielenski 4f1b2184e0 add kubectl server-side apply migrate managedfields
in discussion with SIG, there is a strong interest in keeping the last-applied-configuration around for a bit longer as other tools transition for of it. This is OK since SSA maintains the annotation on kubectl's behalf on the server-side if it exists

migrate client-side-apply fields to SSA when --serverside-side is used

https://github.com/kubernetes/kubernetes/issues/107980

https://github.com/kubernetes/kubernetes/issues/108081

https://github.com/kubernetes/kubernetes/issues/107417

https://github.com/kubernetes/kubernetes/issues/112826

add test to make sure only one apply is needed after migration

Kubernetes-commit: 33b9552e708154c20144c7aca921ad239527fb2f
2022-11-03 20:14:37 -07:00
peizhouyu 975bff8512 fix that beginning of help text is cut off for apply and replace --filename flag
Kubernetes-commit: d216b3433d018fae95efdf987002dd8c4d006ae6
2022-07-28 11:33:34 +08:00
Sean Sullivan acec06e5c9 disallow --force and --prune in client-side apply
Kubernetes-commit: e02a26d74a2e346b4a5607c99180e5b748923e5f
2022-07-24 16:26:57 -07:00
Arda Güçlü 81a25f37b5 Set validate functions requiring no parameters for all commands
Validate function is used to validate command options and should not get
any additional parameter. To preserve compatibility across all
kubectl commands, this PR removes all parameters in validate functions.

Kubernetes-commit: 8fb423bfabe0d53934cc94c154c7da2dc3ce1332
2022-05-17 11:38:20 +03:00
Daniel 12ebe4811f Fix: kubectl create -f and kubectl delete -f are not glob friendly (#102265)
* Fix: kubectl create -f and kubectl delete -f are not glob friendly

* gofmt fix

* removing unused receiver

* adding extra test

* log paths used

* fixing bad merge

* klog/v2 mod

* rebase fixes

* better error fmt

* error fmt unit test

* PR comments and tests

* Add reference to globbing to help snippets

Kubernetes-commit: 2cb3c7f706dbf266820fbde2e1b23a320e5d3de7
2022-03-28 05:45:26 +00:00
Kevin Delgado 61f42e595f add server-side validation support to kubectl
Kubernetes-commit: fe3772890f650f9bcf020b43dc5a51fab0fa17f4
2022-03-09 14:52:32 +00: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
Arda Güçlü ab3928acd9 Refactor diff/prune
This PR does some refactors for diff/prune;

- GetRESTMappings takes value array instead reference
- Move getObjectName into diff instead prune
- License, etc. changes

Kubernetes-commit: 6c449dd272c95f2aeb3bb77e67d312d8df21bd62
2021-11-08 11:22:10 +03:00
Arda Güçlü 3f914a34f1 Add new unit tests for diff/prune
Kubernetes-commit: 17de414905fb3463ec17ec63f40180fa09965d98
2021-09-24 09:40:26 +03:00
Sai Harsha Kottapalli 8165f83007 Refactor Apply cmd to split flags from options (#102240)
* Refactor Apply cmd to split flags from options

* refactor code

* fix subcommands

Kubernetes-commit: 17919b184153b2d123a7c75f5b0dc7e486a724db
2021-11-08 17:17:08 +00: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
caodonghui b709633a6c update url
Kubernetes-commit: a2c1b284da29ec07eaf6a0403d75cf9d881d45b8
2021-07-06 14:55:38 +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
Guangwen Feng dec49d660e Fix typo in comment
Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>

Kubernetes-commit: 23adf46008aaef329375d5bbfbc9568dc6494a5b
2020-12-25 13:58:13 +08:00
wangyamei d67b96c166 Fix the wrong link to server-side-apply conflicts
Kubernetes-commit: 958411f452377fda0e3e69a212fe339e73ff499b
2020-12-05 22:59:43 +08:00
Sai Harsha Kottapalli 61b85bce7c warn user about resource being deleted
Kubernetes-commit: 7b0ef888f3205f06c871cff901ef0f5b8fdb250c
2020-10-11 02:21:32 +05:30
SataQiu 7a93b067f4 kubectl: improve the warning message when doing kubectl apply to the resource without expected annotation
Signed-off-by: SataQiu <1527062125@qq.com>

Kubernetes-commit: 9c163f0a0a97a9bcf10c3f91d2cee02567700d84
2020-07-29 10:39:59 +08:00
zhouya0 8411619cbf Support kubectl delete foreground
Kubernetes-commit: 383b5f676670d99dc1fba4254ba7f6a81a052ba3
2020-07-23 18:45:59 +08:00
Yuvaraj Kakaraparthi 36c221e3cf kubectl: cannot use --force with --server-side
Kubernetes-commit: f93ad0204eeeb21e567df3d5841847373bf7a646
2020-07-06 10:07:26 -07:00
zhouya0 7b9fac0696 Add kubectl apply generate name error message
Kubernetes-commit: c91ef266973904c82894492b887deb2a04b6d998
2020-03-10 15:51:41 +08:00
Brian Pursley b4594b0812 Added kubectl apply check to prevent using --dry-run=server with --force
Kubernetes-commit: 99f6dca1a8d1ea64d22a68263c77bcafd6fedc48
2020-04-16 21:23:36 -04:00
Julian V. Modesto df62cad179 Remove deprecated --server-dry-run.
For the beta server-side dry-run feature, `kubectl apply` provided the
`--server-dry-run` flag.

As of 1.18, this flag was deprecated and marked to be removed after 1
release.

Kubernetes-commit: 3e93f9926279db8a4d064d615c4ad7cfdc7ab38b
2020-05-20 16:53:53 -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