Commit Graph

266 Commits

Author SHA1 Message Date
Sergey Yedrikov a2bdd9d806 Fix for kubectl issue 834:
"kubectl help api-resources --sort-by" text mentions nodes, not API resources

Kubernetes-commit: e5370afba2842b844699b239f3f14306f9923eb6
2020-03-06 15:26:06 -05:00
Jordan Liggitt fe32c3454c Add support for v1 CSRs to kubectl certificate commands
Kubernetes-commit: ca234db60151ccffdd4dc8ceb2ec3c69fd83af69
2020-06-04 11:39:02 -04:00
Brian Pursley 683f5c08eb Added --privileged flag to kubectl run
Kubernetes-commit: cd005c1da41e54971319030687cecafec4884868
2020-04-28 16:30:59 -04:00
Maciej Szulik f5762887af Fix --save-config for kubectl create commands, where it was missing
Kubernetes-commit: 42ee2068384dd47d684121db8f92e593af1f50fc
2020-06-08 14:02:33 +02:00
zhouya0 c825cb5a2f Support kubectl create deployment with replicas
Kubernetes-commit: b6213ed931930eba27b4a53db54b4b4d224a1c59
2020-05-29 14:52:07 +08:00
Jordan Liggitt 695c3d2c06 Make kubectl tolerate other versions of the CSR API
Kubernetes-commit: ea6e5e53de03b791c2d30781e29ba9a0c5e0cbf6
2020-06-02 13:53:26 -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
zhouya0 635dca932f Fix create deployment port not working
Kubernetes-commit: 24766024c17e6090b694b0f57d0b051884a2dac1
2020-05-27 15:56:35 +08: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
Zhou Peng 27261dabef [kubectl/pkg/cmd/rollout]: fix typo & tidy imports
Signed-off-by: Zhou Peng <p@ctriple.cn>

Kubernetes-commit: ef1deb8b40ca3033309f2ba875560a7a49d3c486
2020-05-25 09:37:18 +08:00
Maciej Szulik 0fc32c9e63 Refactor create deployment and add --port flag
Kubernetes-commit: ed1a0e945649095618bd3484c82b58046bcbd60c
2020-05-14 18:34:40 +02:00
Maciej Szulik 731925c63c Set schedule and image flags required for create cronjob
Kubernetes-commit: 9e7ca872b4e2c9c95f7e7c224bc79c1b698789b9
2020-05-14 18:34:27 +02:00
zhouya0 c027f981b2 Fix kubectl create secret docker-registry
Kubernetes-commit: bbf41448f6c5494d5adabc4954d7230522b28d2e
2020-05-11 11:05:37 +08:00
Aurélien Baumann 3c8dea227e Refactor kubectl create deploy: isolate obj construction logic
Kubernetes-commit: c43f62c10b55a8722f1cd5c0547307da388d6b23
2020-05-18 11:32:23 +02:00
Brian Pursley 7ed1bb5485 Changed kubectl config set-cluster and set-credentials to support process substitution for filenames
Kubernetes-commit: 84d5e664afb809b92c31a4c36acb2baa1fc8649e
2020-05-15 09:22:59 -04:00
zhouya0 2ece9ead67 Fix dry run client ignore namespace
Kubernetes-commit: 2f117260fb50926cf0967dfa2817728eb75e1e90
2020-04-26 15:13:20 +08:00
zhouya0 4a94a16b14 Fix kubectl run ignore namespace
Kubernetes-commit: b3c830d4bf260c68d4299cd1879dbe9ce9913bc6
2020-05-04 22:35:03 +08:00
Aurélien Baumann d55dfd5661 Remove the dependency between create deploy command and generators
Kubernetes-commit: 0cbb2087dab0791956ac9233d9554399fd472bb5
2020-05-01 18:04:37 +02: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
Maciej Szulik 9f4fb540db Set appropriate owner references when creating a job from cronjob
Kubernetes-commit: b1a068b0fcfeac586df28a8b3d65db33dc3e1aa5
2020-05-13 12:59:49 +02:00
Maciej Szulik b0e673d0df Fix create cronjob help message
Kubernetes-commit: b2b59527964a3629f5d50e4b724aa027b4c36cc5
2020-05-12 10:35:50 +02:00
张潇 41c5cfa5d2 Kubectl Taint now also accepts short forms for "node","nodes","no"
Kubernetes-commit: 8fda1f361c73aafa441e5a8b503cbf2a781fa019
2020-03-02 20:15:34 +08:00
zhouya0 425b3d2e14 Remove *cobra.command from options
Kubernetes-commit: 1ef5732c436463f405b8224c6885a50716bfc39b
2020-04-09 12:15:43 +08:00
Maciej Szulik d727dabb7d waitForPod should use different exitCondition depending on restart policy
Kubernetes-commit: 6f1484256db9579361d218aef7f7960446fd541d
2020-04-24 13:04:42 +02:00
wojtekt 5b27ac0ca2 Fix the flaky kubectl tests at scale
Kubernetes-commit: 98058a1b68da3726e1110dc8bba3838459d03b29
2020-04-23 22:05:55 +02:00
gavinfish 454ffd5141 Staticcheck: vendor/k8s.io/pkg/cmd/set|edit
Kubernetes-commit: 2b8e60bb21358608cfa46942e0b3210eee263ea8
2020-01-21 11:16:03 +08:00
Maru Newby 2cd642e11a kubectl: Update run's --restart help to reflect generator removal
PR #87077 ensured that only pods would created by `kubectl run`. This
change updates the help text for the `--restart` parameter to no longer
reference the removed job and deployment generators.

Kubernetes-commit: ab8b69b54eed552845c0548a30909f97ceaf0457
2020-04-02 21:30:25 -07:00
Maciej Szulik 6a446d6097 Re-use podAttachTimeout when waiting for pod readiness
Kubernetes-commit: c2bb76ebc902ea5172aa56db78d1fb59f4f88bec
2020-04-22 17:01:13 +02:00
knight42 b9bc004f47 fix(kubectl): explain crds with the same resource name with builtin objects
Kubernetes-commit: 397f107a0886999e0d45955dfe460112edd9ac5e
2020-03-26 16:07:06 +08:00
Maciej Szulik e6776b41f6 Fix kubectl version test to tolerate Run error coming from default
localhost:8080

Kubernetes-commit: 34865774a89db5f5b8684d5dd1042f6f4c2b21d0
2020-04-17 17:50:24 +02:00
Kazuki Suda 736b43aee9 Fix missing a shorthand for container flag of kubectl alpha debug
Kubernetes-commit: fca1027dd6d69ca7c5b3dd54059c29b2c8d04762
2020-03-31 12:15:17 +09:00
Riccardo Piccoli 9fae31af80 Change not found output when getting non namespaced resources
Signed-off-by: Riccardo Piccoli <riccardo.piccoli@gmail.com>

Kubernetes-commit: 818f011a2e7e1a05923f06c57ef6089e3a048fba
2020-02-13 17:28:06 +01:00
zhouya0 9d73fd8f3c Fix kubectl version should print version info
Kubernetes-commit: 948f4de2dbba3affca2de460d836158cbde5db78
2020-04-07 15:18:38 +08:00
Lee Verberne c401716d75 kubectl debug: support different kinds
This is a refactor ahead of adding support for supporting `kubectl debug` of nodes.

Kubernetes-commit: 8414d180feb9ddb0d4b9b80ea8e570dcacf98703
2020-04-03 14:31:18 +02:00
tipok b096826165 fix BusyBox sed
BusyBox sed works the same way as GNU sed

Kubernetes-commit: 6885919986250c33af63933d95b30d1896a8dd07
2020-02-28 11:06:30 +01:00
knight42 4e70f2b1a7 fix(kubectl): remove trailing space when completing file path
Kubernetes-commit: 2fefd9eea4db910eae2b3b86f4834d0892b659dc
2020-03-25 22:54:33 +08:00
Julian V. Modesto 489b062728 Support kubectl scale --dry-run=server|client
Kubernetes-commit: efed958779d564357a9965fccf43f64ee1feb972
2020-03-30 17:33:15 -04:00
Tatsuhiro Tsujikawa e7bb62301f Restore the ability to `kubectl apply --prune` without -n flag
Before https://github.com/kubernetes/kubernetes/pull/83084, `kubectl
apply --prune` can prune resources in all namespaces specified in
config files.  After that PR got merged, only a single namespace is
considered for pruning.  It is OK if namespace is explicitly specified
by --namespace option, but what the PR does is use the default
namespace (or from kubeconfig) if not overridden by command line flag.
That breaks the existing usage of `kubectl apply --prune` without
--namespace option.  If --namespace is not used, there is no error,
and no one notices this issue unless they actually check that pruning
happens.  This issue also prevents resources in multiple namespaces in
config file from being pruned.

kubectl 1.16 does not have this bug.  Let's see the difference between
kubectl 1.16 and kubectl 1.17.  Suppose the following config file:

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: foo
  namespace: a
  labels:
    pl: foo
data:
  foo: bar
---
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: bar
  namespace: a
  labels:
    pl: foo
data:
  foo: bar
```

Apply it with `kubectl apply -f file`.  Then comment out ConfigMap foo
in this file.  kubectl 1.16 prunes ConfigMap foo with the following
command:

$ kubectl-1.16 apply -f file -l pl=foo --prune
configmap/bar configured
configmap/foo pruned

But kubectl 1.17 does not prune ConfigMap foo with the same command:

$ kubectl-1.17 apply -f file -l pl=foo --prune
configmap/bar configured

With this patch, kubectl once again can prune the resource as before.

Kubernetes-commit: 7af3b01f24edfde34e42640ee565a5a6bb66ce26
2020-03-27 01:11:36 +00:00
Morten Hauberg 84b55fb518 Remove double `kubectl` from output
Kubernetes-commit: 5fe57c61482611361502544f36e9df3d17898449
2020-04-07 12:54:26 +02:00
Sean R. Sullivan 34abefcfa8 Even with build error, kubectl apply should apply all valid resources
Kubernetes-commit: 748ad74245778a93a68652cd7e804d6a1e13ad9d
2020-04-03 19:50:25 -07:00
Julian V. Modesto 1cfa7c66b3 Ensure diff doesn't persist patches
Kubernetes-commit: 9c0320f1bfd8edfb11c283b3fd422dc6e49360c5
2020-04-02 17:14:17 -04:00
Sean R. Sullivan 26ca5b3402 Fixes problem where kubectl apply stops after first error
Kubernetes-commit: b75990cc7bccc5693df34e29745eea0c98d095d1
2020-03-26 13:24:33 -07:00
Marek Siarkowicz 809652a24f Deprecate heapster related kubelet flags and remove their implementation
Heapster is retired since 1.11.
Having kubectl top mention Heapster is confusing for users.

Kubernetes-commit: 6d9fbd2d9f2fa77da20ebdf800d129e70ee7b932
2018-03-02 17:08:11 +01:00
Jordan Liggitt 53a6dfe9f1 Simplify dual or single port logic
Kubernetes-commit: dfeb617cc0e6a7b4c595eb5f7e927e9ceec1e18d
2020-03-23 22:04:14 -04:00
Marius Ziemke a45347152c fix kubectl port-forward for services with explicit local port
Kubernetes-commit: ef2eaa4f8f7ce85478310775a134047a77a8e310
2020-03-08 17:49:18 +01:00
Davanum Srinivas 196f0c117a Move k8s.io/apiserver/pkg/util/term to k8s.io/component-base/term
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 1d057da2f73118893b5cc27c15d59ff03beb271e
2020-03-16 16:27:44 -04:00
d-kuro 3cbb4ef3ee Fix ownerReferences.apiVersion for kubectl create job --from=cronjob
Kubernetes-commit: b78ab3515e85bb391e6cadc3374da7ac1992db1f
2020-02-28 14:28:27 +09:00
Brian Pursley 6464f40812 Removed unnecessary _complete call which was silently failing and causing zsh completion to return a nonzero exit code
Removed unnecessary _complete and _expand aliases for zsh completion

Kubernetes-commit: 04741b150effc1c963c1d1b6b2a8d9ce2019d375
2020-02-21 09:11:44 -05:00
Brian Pursley 1a80e2e210 Changed kubectl config view to redact token
Kubernetes-commit: 6fad4ee5e5f5fa6fbf38e88f165b012fa0ae5795
2020-03-17 15:13:50 -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
Jordan Liggitt cfef71236e client-go: update expansions callers
Kubernetes-commit: d8abacba40a63395cc064452b09a244555536fca
2020-03-06 16:29:23 -05:00
Jordan Liggitt 0c62c9a83a client-go dynamic client: add context to callers
Kubernetes-commit: b7c2faf26c2a25427794478c6265e6d55e8acb5a
2020-03-06 10:17:41 -05:00
Jordan Liggitt 1de89515de client-go dynamic client: update DeleteOptions callers
Kubernetes-commit: b19dc3a474e840340cb357f5ea9f4e575bad888d
2020-03-06 10:20:40 -05:00
Lee Verberne c3d84a9e1c Add kubectl debug alpha command
This first version of `kubectl alpha debug` is an import of the existing
kubectl-debug plugin, which supports adding ephemeral containers to
running pods. This attempts to follow patterns used by other kubectl
commands such as run, exec and scale.

Kubernetes-commit: e5b655938e55e0404545ff73e9239593a27a3272
2020-01-31 15:29:31 +01:00
Brian Pursley 4f87593204 Changed kubectl cluster-info dump to not display "Cluster info dumped to standard output" message when output is stdout
Kubernetes-commit: 6de140567b37f6f41404237860a1c17e45e45296
2020-03-03 09:18:16 -05:00
Maciej Szulik ed686e3fbe Wire --filename flag to exec
Kubernetes-commit: 9dac1699bfdb0ff2b8bcfd76c42815b033b3cce0
2020-02-24 14:35:37 +01:00
David Eads 257e232d28 update override behavior for kubectl --tls-server-name
Kubernetes-commit: 9dcbc0bf909a794cf77a801bfd29e306791b1e24
2020-03-03 13:16:50 -05:00
Suresh Kumar Ponnusamy 55c8634c3c Support TLS Server Name overrides in kubeconfig file
Signed-off-by: Suresh Kumar Ponnusamy <suresh.ponnusamy@freshworks.com>

Kubernetes-commit: 37c81ed79ac6836bce4b96f888aa407dc18d747c
2019-08-28 10:51:14 +05:30
Maciej Szulik e034e09126 Squash pkg/describe/versioned/ into pkg/describe/
Kubernetes-commit: 02cd65d7bb5e4aea84a4f466186bcbbe604c4b27
2020-03-03 13:06:26 +01:00
Maciej Szulik e576e735d4 Deprecate --generator flag from kubectl create commands
Kubernetes-commit: be6ac856f13b994251b3c8e54b2251cf75c6847d
2020-02-28 11:58:53 +01:00
drfish 5aa1be61e1 Staticcheck: vendor/k8s.io/kubectl/pkg/cmd/exec|config|certificates
Kubernetes-commit: a14ceeb2c00d8048ce05ad199c919bdab6fb6954
2020-01-23 14:03:11 +08:00
Julian V. Modesto 5db847388b Hide deprecated --server-dry-run for kubectl apply
Kubernetes-commit: 7b214c96b01bf34345d4d7d82fcf5a85fd8318dd
2020-02-28 16:19:51 -05:00
Julian V. Modesto b6cbb3bd6c Clean up --dry-run values.
- Clean up --dry-run values in tests, docs, and scripts
- Fix --dry-run for auth reconcile and add a test

Kubernetes-commit: d97169f59ad11f2d2ffd8ef14446bbec5ffc881b
2020-02-13 16:28:22 -05:00
Brian Pursley 04c3dd17ff Default grace period to 0 when --force is used to delete an object
Kubernetes-commit: 0f31bef94c46b735bb7b1fe2a7d49d58fb93ed11
2020-02-24 09:30:56 -05:00
Cornelius Weig e54c7dba6a Add documentation around plugins
Documentation is added in several areas:
1. `kubectl plugin` now prints a note that plugins are best discovered
   with krew.dev and how to install it.
2. The kubectl book now has a new section about plugins, featuring
   - a very brief introduction to the kubectl plugin mechanism
   - a section about krew

Kubernetes-commit: ed0e0350854e34bad65de4db44c0f661a5851870
2020-02-26 14:50:50 +01:00
zhouya0 d23f51983a Add init containers to dump info
Kubernetes-commit: a024ac14ef14da1c972edc6589de81405f17bc76
2020-02-19 20:47:34 +08:00
Julian V. Modesto d3af7e0862 Remove deprecated rolling-update command
Kubernetes-commit: 932500c0151a4f0926cf07e63068248540b22f90
2020-02-11 23:27:01 -05:00
Julian V. Modesto 9c1c5e4f10 Add --dry-run to more kubectl commands.
- delete
- taint
- replace

Kubernetes-commit: a9ec444d743940fd93b31313a6f3f857e5c5f048
2020-02-18 18:08:25 -05:00
zhouya0 dcc99c8f57 optimize kubectl version help info
Kubernetes-commit: f85e079147b65fe444ee60b9c302173ae169990a
2020-02-19 16:45:37 +08: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
Hidetake Iwata 0f70b0c27b Fix example of kubectl config set-credentials
Kubernetes-commit: 0368a7d5f7acea476f4adcd85ea037cfe24ccd3f
2020-02-12 21:11:24 +09:00
Olivier Lemasle e7018f8673 kubectl cluster-info dump: use file extension according to output format
Kubernetes-commit: d6fcc224f17f2fe4bb45e731ea3d50a26539fc54
2019-08-28 11:51:39 +02: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
Maciej Szulik e10402e591 Don't show flags in api-versions help
Kubernetes-commit: 8ff6b24c5736d7b2ce31319ae950a806f2325327
2020-02-12 18:31:05 +01:00
gavinfish 275513cb52 Staticcheck: vendor/k8s.io/kubectl/pkg/scale|describe/versioned|cmd/top|cmd/util/editor|cmd/top
Kubernetes-commit: f4940cf55fd7c2787b370464d491a764c4febd78
2020-01-21 10:13:10 +08:00
zhouya0 94b91c1d51 fix kubectl drain ignore daemonsets and others
Kubernetes-commit: e3c8add683a095f1bffef1b0ca413f1e42be7fe0
2020-01-19 14:28:53 +08:00
zhouya0 9c14935e27 Add kubectl diff exit code doc
Kubernetes-commit: 527e66fc2829917444d874771142fdd834feb8d6
2020-02-04 17:22:23 +08:00
Brian Pursley 09eaf230cc Fixed code formatting issues discovered by verify-gofmt
Kubernetes-commit: 78248d0c2aaca258b4210446dc38c096e83a1eb6
2020-02-04 10:11:18 -05:00
Brian Pursley 445baa99d2 Added 'No resources found' message to describe and top pod commands
Kubernetes-commit: e70a630dac6c0158a5f9bb571223ed5759096dc1
2020-01-24 10:42:08 -05:00
Odin Ugedal 4e367c0f16 Add error check in kubectl proxy on server setup
If "NewServer" returns an error, it will result in a nil pointer
dereference segfault.

A simple way to test the behavior is to prefix the server url with a
colon, ":".

Kubernetes-commit: 1e50bc2d094410f3848b4dbc5f0442440d8f7d77
2019-07-26 20:06:46 +02:00
Mike Danese 29cd24b6cc generated: run refactor
Kubernetes-commit: 25651408aeadf38c3df7ea8c760e7519fd37d625
2020-02-08 12:30:21 -05:00
Mike Danese 71d8052cb0 generated: run refactor
Kubernetes-commit: 3aa59f7f3077642592dc8a864fcef8ba98699894
2020-02-07 18:16:47 -08:00
Brian Pursley 1777c19079 Fixed code formatting issues discovered by verify-gofmt
Kubernetes-commit: 2d21f16c38e704eaaa42d7d583ddd103c16d0d6b
2020-02-04 10:16:06 -05:00
Brian Pursley e9f1eb93f4 Fixed problem in unit test where error expected/actual comparison was not being performed
Kubernetes-commit: 97185e97529ef7c006f26bb3190805ad28f15ffe
2020-02-03 12:17:51 -05:00
Brian Pursley b69c2a4389 Removed unneeded newline (moved to end of directory not found message)
Kubernetes-commit: 48ee18b516b267ba062a1dd00a21e7ae10ecd805
2020-01-28 20:51:24 -05:00
Brian Pursley 346cf3d4f4 Ignore empty or blank string in path when listing plugins
Kubernetes-commit: f60c0af97710a5dca6f55f3c4a1480412ad50ec8
2020-01-28 17:04:31 -05:00
wojtekt 4f3723dc40 Register conversions for kubectl testing types
Kubernetes-commit: ea140f5e1a1a297e251cc28a40e2bbf77dfd02e4
2020-01-09 14:16:33 +01:00
Tim Allclair 6fca42a14a Ensure testing credentials are labeled as such
Kubernetes-commit: 9d3670f3586c98c02cdca93b7c98dd91fc0b87bd
2020-02-04 10:36:05 -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 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
Mike Danese 4524edecce cleanup req.Context() and ResponseWrapper
Kubernetes-commit: 968adfa99362f733ef82f4aabb34a59dbbd6e56a
2020-01-27 18:52:27 -08:00
Maciej Szulik c6c7c0dfb8 Remove kubectl run generators
Kubernetes-commit: 82f97775b7c2317a8ca45e616a09e447da987ab2
2020-01-09 17:09:51 +01:00
Maciej Szulik 72f1da0b87 Fix kubectl taint's Complete parsing
Kubernetes-commit: 6972d6f33af6b04a9f436fc0858b27d3b9249ea2
2020-01-21 14:36:16 +01: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
martinkaburu 50f26dd951 fix apply --prune to check cli specified namespace
Kubernetes-commit: f2518347f3dbe36586367c94aa98d5096f74a742
2019-11-25 23:21:43 +03:00
Name Surname b21179860f Fix kubectl top sort-by cpu and sort-by memory options
Kubernetes-commit: 824af9e3072d9d68071fec291ac3f5f89362e4ab
2019-09-04 16:28:21 +02:00
yuzhiquan baaee7d515 cleanup(kubectl taint): fix Errorf and comment error, and remove unnecessary bool flag
Kubernetes-commit: 87e8137c18ab27308617e83a18fde5de3edc64d7
2019-12-17 19:41:18 +08:00
Maciej Szulik 51c0d83068 Allow embedding logs command
Kubernetes-commit: 925be295fb09655ae668842e42aab2ea919c5ef2
2020-01-13 14:54:54 +01:00
zhouya0 cbbf8d8bf6 fix kubectl annotate local error
Kubernetes-commit: 568edf72ec1fc10368a19be8184b201265e6c39e
2020-01-08 17:10:08 +08:00
zhouya0 65d1aa5d00 fix apply set last applied namespace
Kubernetes-commit: 4291a03e39559d10eab0253f9cd431d6a375e235
2019-12-20 16:09:49 +08:00
danielqsj 4b914450ab unify alias of api errors under pkg and staging
Kubernetes-commit: 5bc0e26c1902e7e28abfc828de19a2dbb3e492c2
2019-11-12 16:26:59 +08:00
hbceylan f0cc26a729 fix kubectl run help image name
Kubernetes-commit: 5b4a7744fad614732de87e032f5d4dba743fddf9
2019-12-23 21:49:37 +00:00
Sean Sullivan 2598a9eb6d Adds PreProcessor and PostProcessor functions for modifying apply behavior
Kubernetes-commit: 79bc63fb4b79caea4b141d318b11a0892ca14c95
2019-12-17 14:58:54 -08:00
Sean Sullivan 641631dfad Moves visitedUids and visitedNamespaces (used for pruning) into ApplyOptions
Kubernetes-commit: 4e45421f610eb881a03c0d82fca038788db12b08
2019-12-17 14:19:00 -08:00
Sean Sullivan 42da131431 Move patch functionality for apply into its own file.
Kubernetes-commit: 670369f2a4a7a7d9dad3a1ae1a334317a135f6c7
2019-12-16 16:41:49 -08:00
Sean Sullivan 65d873e277 Moved prune functionality into its own file.
Kubernetes-commit: e38e320222a1f44373ab3eaea8713f4772b26f6b
2019-12-16 16:13:39 -08:00
Sean Sullivan dfcc649b05 Refactored some apply printing functionality; removed unneeded count and objs variables
Kubernetes-commit: 07cb2fda5dada5c5145216bcab90e38426cf68e8
2019-12-16 15:21:57 -08:00
Sean Sullivan dd819b3425 Created GetObjects() method for ApplyOptions and integrated into apply
Kubernetes-commit: 02af4c9be20db201f2a2069816e97004a96bf760
2019-12-16 13:56:52 -08:00
Sean Sullivan 395bc6fc90 Changes Visit() to Infos() in apply to keep slice of objects
Kubernetes-commit: 2103ea4ddedc59d14322fd0fc34c8a9928256551
2019-12-16 13:00:33 -08:00
Anish Shah 3c43664ced Refactor `kubectl proxy` command to have similar design pattern as other kubectl commands.
Few days ago I watched this kubectl code base tour on Youtube
(https://www.youtube.com/watch?v=uz8TS3V9qqY). It talks about a design
pattern that almost every command follows. But I found out that
`kubectl proxy` command does not follow this pattern. So, I'm
refactoring this command to use similar design pattern as other kubectl
commands.

Kubernetes-commit: 0bd41a300f12b1dbaec19fc94b868f91640542df
2019-09-21 10:52:42 -07:00
Haosdent Huang 08def252f7 fix static check in kubectl/pkg/cmd/annotate.
Kubernetes-commit: 303c1a40bcee81fe14845d2af9dae2073f86ec52
2019-12-08 23:25:50 +08:00
Naoki Oketani fe07b19cb4 Fix a bug in port-forward: named port not working with service
Kubernetes-commit: 73c1ab71e27eee0066ba637575e60093952f3ff1
2019-11-22 02:59:26 +09:00
zhouya0 0833d7cba2 kubectl change podSecurityPolicy group
Kubernetes-commit: 7947b6ce6d8a498000d81b68fa674f88b1d7680a
2019-11-18 15:00:33 +08:00
Michael Gugino ebda9f6262 kubectl/drain: add option skip-wait-for-delete-timeout
Currently, some circumstances may cause waitForDelete to
never succeed after the pod has been marked for deletion.
In particular, Nodes that are unresponsive and have
pods with local-storage will not be able to
successfully drain.

We should allow drain to ignore pods that have a
DeletionTimestamp older than a user-provided age.
This will allow controllers utilizing kubectl/drain
to optionally account for a pod that cannot be
removed due to a misbehaving node.

Kubernetes-commit: da53044abdf8c8a9771a5c3dfd861f0c4ec78c40
2019-11-23 20:00:06 -05:00
Sally O'Malley 6d309ed99e When running `kubectl drain` in dry-run, list warnings and pods that would be deleted.
Kubernetes-commit: 909300b8be909c48a68900c407de03be95555409
2019-09-12 14:31:09 -04:00
Michael Gugino feccbe3c28 kubectl/drain: add disable-eviction option
Currently, if eviction is supported during a drain operation,
eviction is always used.

This commit allows the user to specify disabling eviction.
This is particularly useful when you wish to ignore
PodDisruptionBudgets after a normal drain has failed for
some time.

Kubernetes-commit: 6c1d587d5142b95e6c169a198a086332a7e4d8ad
2019-11-23 11:18:52 -05:00
Jordan Liggitt 1d31df4756 fixup kubectl test
Kubernetes-commit: deb75da17bb1fa95e5b56fb1207ba247cd9953dd
2019-11-26 13:13:38 -05:00
Jordan Liggitt 74e4737411 Switch TableGenerator/TableConvertor interfaces to metav1
Kubernetes-commit: 36eb250cbb441984260ded6f7abeb796974031c3
2019-11-26 13:13:25 -05:00
Sally O'Malley de3d4fcc02 don't error if set-resources patch is empty
Kubernetes-commit: ecd1c0747272ab908daa64b0f4b2b18a8cb18362
2019-11-20 19:22:18 -05:00
zhouya0 6d82c82d12 add test coverage with kubectl get components
Kubernetes-commit: 07806d4300c5f410194c0dcd2da86c40bef42e1b
2019-11-25 17:57:56 +08:00
Jordan Liggitt 25e7825a5b Fix --resource-version handling in kubectl
Kubernetes-commit: 0ac8345d3a4c5ee38fd3fc2c40976ba876d815e7
2019-11-14 09:24:42 -05:00
Maciej Szulik dfa60c7722 Drop job from scale description
Kubernetes-commit: c3964927f758be88a65f833595a0b0d5456ce729
2019-10-23 12:25:42 +02:00
louisgong ae926dc56e fix kubectl diff panic
Kubernetes-commit: 4f13f2739a3a33c7ed4b86b98054972c0fde4579
2019-11-09 20:34:51 +08:00
Clayton Coleman 4ca8f5ecfe test: kubectl unit tests should be using codecs without conversion
Tests are also refactored to use the simpler RESTClient code path.

Kubernetes-commit: 8a9b8c87c40ee65751828d9dd02f4f642588f0ce
2019-11-03 15:20:10 -05:00
Ted Yu eb7c1bf189 Only put un-filtered pod in podDeleteList
Kubernetes-commit: 65c2f61806468d25795516d6077ce0c31c83adcd
2019-10-30 09:55:34 -07:00
Maciej Szulik 89d9f2ef29 Set TypeSetter in get print flags, like we do everywhere else
Kubernetes-commit: 626b9081fbee1eeae3f96a99f40da6c665d5753f
2019-10-31 18:25:46 +01:00
ritho b0cd1c2290 Do some Kubectl optimizations suggested by the golangci linter
The tool golangci-lint gives a bunch of warnings. This PR solves the easier/less controversial ones, so the code is simpler and a little bit more optimal, since it removes some if conditions.

Kubernetes-commit: cd2adbe760641f844d84d411f9adcf17fb6982ff
2019-06-04 01:25:43 -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
Sean Sullivan 7965551001 Moves kubectl get subcommand to staging
Kubernetes-commit: 2a3f28863baa804a05d35c3958a107f9210b4c9e
2019-10-29 15:51:00 -07:00
Pablo Mercado 6b77b0790a Kubectl certificate signing: fix certificate deny message (#84400)
* add certificate deny flag message

* bring back NewCertificateOptions with operation parameter

Kubernetes-commit: e528c2f2925d61fa7a12313a895af5a312d36dd6
2019-10-27 03:24:33 +00:00
Ted Yu 587c053a55 Add note on the applicability of --grace-period
Kubernetes-commit: abc9a9f8369c220ee3a1de2e1917edef3d7d680e
2019-10-24 16:07:02 -07:00
Sean Sullivan c6a8c8a72e Removes duplicate TabWriter. Several updates to reference the one remaining TabWriter in cli-runtime.
Kubernetes-commit: 958d7d3b6e74b8648fb897ce09f52049eb9823a1
2019-10-17 13:32:40 -07:00
David Eads 3fa753054c add option to skip verifying kubelet certificates for logs
Kubernetes-commit: f0931cbf48cb4f170177d42c1a3c75b9d8792c52
2019-10-23 14:33:37 -04:00
Ivan Shvedunov 6bf46a2bba Fix crash in kubectl drain
When there's a pod that can't be evicted/deleted, and apiserver
connection breaks at a wrong moment, kubectl can panic due
to nil pointer dereference. This PR also improves drain tests
to avoid confusing panics with fatal errors.

Kubernetes-commit: 37226f8e8306475895d7e68eb52c57e57f00ee28
2019-10-11 22:12:26 +03:00
Niclas Ladd 72381882b1 Add a new --sort-by flag to kubectl api-resources command
Kubernetes-commit: cf492e95ebbe5f58c5988ddb69ff58c823c96ac1
2019-10-07 10:17:34 -07:00
Mikalai Radchuk a38258b351 Adds --prefix flag to the kubectl log command
Kubernetes-commit: 8cadd185d67e84dd186728669d6e72e9e415db70
2019-09-04 16:23:02 +01:00
tanjunchen 588a48c6ab remove the repeat word in documents
Kubernetes-commit: de3cf23414efb2eb4d94e821996cd4c93e6534e4
2019-10-04 15:32:48 +08:00
fang duan 28ba3d4e95 Fix help text in kubectl top -h
close https://github.com/kubernetes/kubernetes/issues/82843

[heapster deprecation timeline](https://github.com/kubernetes-retired/heapster/blob/master/docs/deprecation.md)

Kubernetes-commit: 13a37abb8bca75e7cad8952da1145bd980aa05a1
2019-09-27 23:05:02 +08:00
Ted Yu 04c0c6e8db Prune should respect namespace
Kubernetes-commit: 88e2f8e04fa310e848f07d0a2ab801aa0917e408
2019-09-25 16:43:08 -07:00
wojtekt 52d3bfc415 Minor cleanup of jsonFallbackEncoder
Kubernetes-commit: cd24a0e5fa7af1bd921386cf80c90cd535954e6c
2019-09-22 13:50:05 +02:00
Lantao Liu 7c6594395c Fix kubectl panic when handling invalid error.
Kubernetes-commit: 12d944b860e4872085fa1155590c7fcef58e6bb8
2019-09-19 21:48:50 -07:00
ZP-AlwaysWin b3895b0e0e fix kubectl run --generator=xxx bug
Kubernetes-commit: 860845b58216fa7fa058bacd06b4be5caefa6251
2019-09-15 14:27:33 +08:00
ZP-AlwaysWin a376c2df78 replace 200 with http.StatusOK
Kubernetes-commit: cfa77048f9b7fa96bad4eebb059cf60acc9dfd29
2019-09-12 22:35:19 +08:00
Han Kang 010c893f0a remove pkg/version and some of redundant copies of it
Change-Id: Ia58367c1b1274bfb49c8a4784051463abaf795de

Kubernetes-commit: 866ea74326fba45241cbccd3ca4624b68ba7022f
2019-09-10 14:42:55 -07: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
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