Commit Graph

32 Commits

Author SHA1 Message Date
Maciej Szulik 5eeba3a134 Remove deprecated kubectl drain flag
delete-local-data was deprecated back in v1.20 with this commit:
625e47aaa2

It's about time we entirely drop the support for this flag. Users should
be already using delete-emptydir-data instead.

Kubernetes-commit: 4b5cf0a2766c02ba88b5d104a79c16b1f1f367b6
2024-07-02 15:48:40 +02:00
TessaIO 3d99e3ab7e fix: add whitespace for drain error message
Signed-off-by: ahmed.g <ahmed.g@adjoe.io>

Kubernetes-commit: 487f83500faadc8ec972aa164b07940476288e2f
2024-04-28 17:51:06 +02:00
adil ghaffar e112354038 adding more callbacks in kubedrain helper
Kubernetes-commit: 0323fe42e23aee176ff14f3385bc15e81216c7bb
2023-04-20 16:16:11 +03: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
Sean Sullivan d545780f6d Exports WarningPrinter field in DeleteOptions
Kubernetes-commit: 75ff830ab198348b0c727d05e54754d5f73a7286
2023-01-09 17:14:16 -08:00
Sean Sullivan 6dde41fea6 Removes unnecessary dry run verifier
Kubernetes-commit: 530f65d6fd5af81c0691143fbf2c00d440476bb9
2022-12-05 16:25:12 -08:00
jlsong01 ec9d0484e5 add a warning printer in cli-runtime to coordinate warning style
modified:   staging/src/k8s.io/kubectl/pkg/cmd/auth/auth.go

Kubernetes-commit: 272e245f06e425fc912b1e477e8b6763850b161e
2022-02-18 20:33:38 +08: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
W. Trevor King 5ff8356c5b kubectl drain: Generic "declare a controller" message
When it initially landed in kubernetes/kubernetes@c6e9ad066e (Initial
node drain implementation for #3885, 2015-08-30,
kubernetes/kubernetes#16698), the drain logic looked in a created-by
annotation for recognized kinds [1], so listing the set of recognized
kinds was a clear approach.

Sometime later, the source moved into ownerReferences, but the
hard-coded set of recognized controller kinds remained.

When kubernetes/kubernetes@2f1108451f (Remove hard-coded
pod-controller check, 2017-12-05, kubernetes/kubernetes#56864) removed
the hard-coded set of recognized controller kinds, it should have also
updated these messages to remove stale references to the previous
hard-coded values.  This commit catches the message strings up with
that commit.

[1]: c6e9ad066e (diff-211259b8a8ec42f105264c10897dad48029badb538684e60e43eaead68c3d219R216)

Kubernetes-commit: 587f4f04cc5fc18f4e85ed6a4a06bbf1bfee0496
2022-02-23 16:26:59 -08:00
Aram Peres 8e80d8fd7e Cleanup kubectl label selectors with 'cmdutil.AddLabelSelectorFlagVar'
Kubernetes-commit: 8f8138bc35f59ef04b77a3520d8d1065603ccdb7
2022-01-06 23:28:44 -05:00
yuzhiquan b2f4fe7648 move remainingNodes outof drain loop
Kubernetes-commit: 0c66b43d7a7d82a5ff7e330aeecd2aa7f3c092e1
2021-10-12 09:26:22 +08:00
yuzhiquan c74a1185c3 remove ignore error flag for drain, and set this feature as default
Kubernetes-commit: f54d2a0dd1dd5c143fb32dae5c627dba87d6df7e
2021-10-08 19:44:26 +08:00
Ross Peoples dc5f5d4011 drain node output should say drained not evicted
Kubernetes-commit: 0cf3dba1f1df9555a46f2a086e48dcfe3c9ad6b2
2021-10-18 11:05:28 -05:00
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
yuzhiquan 160799c289 add deprecated message for igonre-errors flag, and fix unsafety http link
Kubernetes-commit: 0a38b2804d9b665627bc1bf899d711ba4adfa1b0
2021-06-08 10:49:23 +08: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 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
Katrina Verey ea308b60b6 Add --chunk-size flag to kubectl drain
Kubernetes-commit: 5200ff86d0983e42c3d2d5c0d830e96495516347
2021-03-19 08:32:37 -07:00
yuzhiquan 0ca8bbb1ad remove --ignore-errors flag deprecated warning message
Kubernetes-commit: 01d0d15562ccb7377176f72fb70a3cf18d0d7666
2021-02-24 19:02:24 +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
yuzhiquan 7e8ba7c82e add ignore-errors flag, support none break drain in group
add warning msg

Kubernetes-commit: db264eaa6e2db5f344ec40dc6dd632ece8fe5768
2021-01-20 15:02:00 +08:00
Douglas Schilling Landgraf 56ea9621b7 kubectl: deprecate --delete-local-data
The option --delete-local-data according with users is not clear.
This patch deprecate --delete-local-data in favor of --delete-emptydir-data.

Reference:
https://github.com/kubernetes/kubernetes/issues/80228

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

Kubernetes-commit: 625e47aaa2769d221c59e5b9b05b4ac97212719b
2020-09-25 17:33:45 -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 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
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
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
Justin SB 3989dccd8b Make drain library more reusable
Move more functionality from the kubectl cmd to a package with
fewer dependencies.

Kubernetes-commit: c74f2f6a72bf6fe2718d1e386e4e08747f34fe7b
2019-07-11 13:28:25 -04:00
Sean Sullivan c6063dd846 Move pkg/kubectl/cmd/{command} to staging
Kubernetes-commit: 0e0ea523392f1121f61f99ac30a9bc2043eaed90
2019-08-01 11:01:40 -07:00