Commit Graph

17 Commits

Author SHA1 Message Date
Jefftree 03a47d93ec use OpenAPIV3 for kubectl diff
Kubernetes-commit: e7216c6623049d713fbf7cc04e2c42eb957a607e
2023-09-15 17:53:10 -04:00
Jefftree 8b0ab9a40e Use OpenAPI V3 for client side SMP
Kubernetes-commit: 4f3b0b15182d80b02d7a7bd2c210c145b7552f82
2023-09-15 16:46:53 -04:00
Sean Sullivan 99206f74b9 Removes kube-openapi dependency from Patcher
Kubernetes-commit: 34aa661eed606fd049f79a12ab3344f5093811fa
2023-01-09 19:13:30 -08:00
Arda Güçlü 89edfadfa3 Use OpenAPI to determine patch type in kubectl apply patching
Currently `kubectl apply` determines correct patch type for given
GVKs by trying to register schema and if it succeeds, it uses
strategic-merge-patch.

But OpenAPI endpoint already stores which patch types are supported
by GVKs. This PR checks OpenAPI endpoint to retrieve patch type,
if OpenAPI is enabled. If it is not enabled, patch type determination
will be done as conventional registration method.

Kubernetes-commit: cddbb0c56397448ac0489f0473a26601c1feece8
2022-06-08 13:12:16 +03:00
Arda Güçlü f95d534f9d Move resource lookup into its own function
Kubernetes-commit: 66c2f6069ebbfa41d0bef0f3959abda59b8483f1
2022-06-28 09:30:06 +03:00
Arda Güçlü df792c788b Use error wrapping in patchSimple
Kubernetes-commit: 22b43d4edbee4f89984d1b905adb1f905f3ab90b
2022-06-22 10:22:27 +03:00
Arda Güçlü b19c7e78f3 Move getPatchType logic back to main function
Kubernetes-commit: 4ed5653a0bc8ca53ca6a917e634457bd7a2d8dae
2022-06-22 09:35:49 +03:00
Arda Güçlü 351ebce2c4 Stop passing source as parameter
This commit removes passing source field as parameter. Instead,
this commit returns error verb and error functions to caller function.
Caller function can add source field by generating correct message.

Kubernetes-commit: d336f7df874dc978ebd97971e1fc93d891c21e7d
2022-06-20 10:04:18 +03:00
Arda Güçlü 2ca41173d3 (kubectl apply): Split patching types into functions and refactorings
Patch type determination is done by checking existence
of resource in schema and if it exists, it uses strategic merge patch.
Otherwise, like for CRDs, it uses merge patch type.

Currently, this code portion is not easily extensible and this PR
splits required checks into their own function to increase extensibility.

Kubernetes-commit: 15512210e3e14b0c827d13334394d658dc7ddc88
2022-06-16 11:12:17 +03:00
zhouya0 8411619cbf Support kubectl delete foreground
Kubernetes-commit: 383b5f676670d99dc1fba4254ba7f6a81a052ba3
2020-07-23 18:45:59 +08:00
Naoki Oketani 404318cdbc Remove --export flag from kubectl get command.
Kubernetes-commit: c0562815fada455daf4826f59df895942dad8df0
2020-02-28 17:41:00 +09: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
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 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 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
Sean Sullivan 42da131431 Move patch functionality for apply into its own file.
Kubernetes-commit: 670369f2a4a7a7d9dad3a1ae1a334317a135f6c7
2019-12-16 16:41:49 -08:00