Commit Graph

1052 Commits

Author SHA1 Message Date
Daein Park 5acf82be0d Add a flag to enable "Capacity" instead of "Allocatable" for an actual node memory total usage.
If "Allocatable" is used to a node total memory size, under high memory pressure or pre-reserved memory value is bigger, the "MEMORY%" can be bigger than 100%.
For suppressing the confusing, add a option to show node real memory usage based on "Capacity".
* Reference: https://github.com/kubernetes/kubernetes/issues/86499

Kubernetes-commit: 862937bf1c7975d3f54ae47a2958e47f2c50150f
2021-06-16 21:25:52 +09:00
brianpursley 07f77100fc Add --override-type flag to kubectl run and kubectl expose to allow the choice of using a JSON Patch or Strategic Merge Patch to apply the override to the generated output.
Kubernetes-commit: 0e697e19ac9f73e2efa0e60157730ba8731e3847
2021-11-05 07:10:47 -04:00
Shin'ya UEOKA 791e7f9d0b test: Assert max unavailable for PDB test cases
Kubernetes-commit: 5c76507c3f9dd84dd3a56b39a45f99da1735bfed
2021-10-28 05:20:03 +00:00
astraw99 2ad6554e1e fix kubectl unlabel msg
Kubernetes-commit: cec30fdbedc326ef0abcbd8475b89840ae0f776d
2021-08-15 14:56:07 +08:00
卢振兴10069964 165827de9c code cleanup for kubectl
Kubernetes-commit: 17993020cdca7eea2fb96a993e048d2d0624fa40
2021-04-12 10:45:08 +08:00
Paco Xu 4cb63581c6 cleanup: add update notice in origin file & make it diff cleanly
Kubernetes-commit: b74214ebcb2acbd3b188bda6f856d9a851b1ea96
2021-09-15 13:43:00 +08:00
thomassong 6847974534 fix: include init containers when determining pod QoS that keep consistent with kubelet
Signed-off-by: thomassong <thomassong2012@gmail.com>
Co-authored-by: Paco Xu <paco.xu@daocloud.io>

Kubernetes-commit: 285e43d208a29acc9d19c47099699fe13d012f8a
2021-02-05 09:30:00 +08:00
Bryan Boreham 0a152f103a 'kubectl events' command (#99557)
* Basic scaffolding for kubectl events command

* Simple implementation of 'kubectl events'

* Print event fields

Borrowing code from 'kubectl describe'

* Sort events before printing

* Make output more like 'kubectl get events'

Print namespace if fetching from all

* Refactor: extract print functions

To make it easier to add watch function next.

* Implement watch for new events

Run the list function same as before, so those events come out in order,
then watch from the ResourceVersion after the last event.

* Clear up some lint warnings

* Update description and example text

* refactor: introduce a listOptions variable

* Implement --for option

splitResourceTypeName() function borrowed from cli-runtime because we
need similar behaviour to Builder.ResourceNames(), but applying to
Event.InvolvedObject.

* Add kubectl/pkg/cmd/events to vendor/modules.txt

* Add back cmdutil.Factory

Needed in NewCmdAlpha to construct the 'events' command

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Fix lint

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Make package alias go-cromulent

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use genericclioptions.RESTClientGetter instead of cmdutil.Factory

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Decode object parameter to GroupVersionKind and name

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Merge two files into one

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Include example for --for option

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Fix inconsistent option name in error message

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Remove unnecessary Validate call

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use fields from event series

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Support chunking of list of events

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use watchtools utility to receive watch events

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Split struct into flags and options

Flags represents the inputs from the CLI; options are what the running
command needs. This structure parallels the 'wait' command, and should
be easier to write tests for.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Add some parameters to usage string

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Do only one of list or watch

We tried to print the list first then start a watch after the last
event, but sometimes the server will return "watch is too old" on that
ResourceVersion.
Instead, if we need to watch just start it from the beginning.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Print message if no events found

Also, if watching, don't print the headings until the first event
arrives.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Kubernetes-commit: a988182f595af64bc007ba9162509e089c36fd89
2021-10-29 17:13:38 +00:00
Aldo Culquicondor def56a58a5 Add ready field to Job status
to keep a count of the pods that have the ready condition.

Also:
- Add feature gate JobReadyPods.
- Add Ready to describe.

Change-Id: Ib934730a430a8e2a2f485671e345fe2330006939

Kubernetes-commit: 1bff5eb44d9897e12aff3ea10f5a856580158278
2021-09-08 14:31:59 -04:00
Ross Peoples dc5f5d4011 drain node output should say drained not evicted
Kubernetes-commit: 0cf3dba1f1df9555a46f2a086e48dcfe3c9ad6b2
2021-10-18 11:05:28 -05:00
Marc Khouzam b111bee570 Complete multiple resource names
This commit teaches the completion function to repeat resource names
when supported by the command. The logic checks if a resource name
has already been specified by the user and does not include it again
when repeating the completion.

For example, the get command can receive multiple pods names, therefore
with this commit we have:
  kubectl get pod pod1 [tab]
will provide completion of pod names again, but not show 'pod1' since
it is already part of the command-line.

The improvement affects the following commands:
- annotate
- apply edit-last-applied
- apply view-last-applied
- autoscale
- delete
- describe
- edit
- expose
- get
- label
- patch
- rollout history
- rollout pause
- rollout restart
- rollout resume
- rollout undo
- scale
- taint

Note that "rollout status" only accepts a single resource name, unlike
the other "rollout ..." commands; this required the creation of a
special completion function that did not repeat just for that case.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 7aa5cb40316dbeb970250ee0835fbd597fd19a20
2021-10-15 15:36:09 -04:00
Marc Khouzam b9e380aef5 Add completion to the --output/-o flag
For example:
$ kubectl get -o json<TAB>
json   jsonpath   jsonpath-as-json  jsonpath-file

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 5f22baeaf1f662d0fe90ea41e453883cb726323c
2021-10-22 15:15:23 -04:00
zc 7f3d19c990 add unit tests for updateEnv
Kubernetes-commit: f79183f2918446907da08325066a334466146711
2021-09-08 10:49:15 +08:00
Jérôme Petazzoni eadcbb187a Minor improvements in 'kubectl run' flag help
I initially noticed a minor typo in --tty, and while fixing it,
I noticed small discrepancies in some other flags. These minor
changes should make the 'kubectl run' flag help slightly more
correct (hopefully). 🙂

Kubernetes-commit: 7ca336caf383bca9848cab64657a92b025f34312
2021-10-06 16:57:47 +02:00
Maciej Szulik fe89be9c6f Use separate pathSpec for local and remote to properly handle cleaning paths
Kubernetes-commit: 0fb6815f08f39c8af814fa733d5235681a124b81
2020-08-21 19:24:19 +02:00
Arda Güçlü 8307ca4a3c Add diff command return status code greater than 1 when flags invalid
This PR adds flagerror handler function to detect when flags are invalid.
Default flag handler returns status code 1. However, diff command embraces
this status code as changes are found. By overriding flag errors,
this PR shows same message with default case and returns status code 2.

Kubernetes-commit: 4f0848520d4cdd679c76479949546002c5935e3c
2021-10-04 13:02:34 +03:00
Marc Khouzam e6118325f3 Ignore flags that could precede the Cobra command
See https://github.com/kubernetes/kubectl/issues/1119

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: d41c2685b67317fea1d1a3843d8f5870bc724b3b
2021-09-20 18:20:49 -04:00
Marc Khouzam 10504c18ad Do not try to load plugins for cobra commands
Cobra adds the commands 'help', '__complete' and '__completeNoDesc'
inside rootCmd.Execute(), however, when kubectl decides if it should
lookup plugins, rootCmd.Execute() had not been called yet.  Therefore,
the call to cmd.Find(cmdPathPieces) done by kubectl does not find the
commands added by Cobra.  To fix this we must check for them explicitly.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: e703b3d25377e763b117805b3d88fe7236f3ff76
2021-09-19 14:34:10 -04:00
Sean Sullivan 8a45e525e5 Fixes kubectl command headers which hangs on kubectl run
Kubernetes-commit: 1d1a5499e717b928c6b2782fdcad9fa4052a38a1
2021-09-30 13:53:00 -07:00
Patrick Ohly 466b483531 initialize logging after flag parsing
It wasn't documented that InitLogs already uses the log flush frequency, so
some commands have called it before parsing (for example, kubectl in the
original code for logs.go). The flag never had an effect in such commands.

Fixing this turned into a major refactoring of how commands set up flags and
run their Cobra command:

- component-base/logs: implicitely registering flags during package init is an
  anti-pattern that makes it impossible to use the package in commands which
  want full control over their command line. Logging flags must be added
  explicitly now, something that the new cli.Run does automatically.

- component-base/logs: AddFlags would have crashed in kubectl-convert if it
  had been called because it relied on the global pflag.CommandLine. This
  has been fixed and kubectl-convert now has the same --log-flush-frequency
  flag as other commands.

- component-base/logs/testinit: an exception are tests where flag.CommandLine has
  to be used. This new package can be imported to add flags to that
  once per test program.

- Normalization of the klog command line flags was inconsistent. Some commands
  unintentionally didn't normalize to the recommended format with hyphens. This
  gets fixed for sample programs, but not for production programs because
  it would be a breaking change.

This refactoring has the following user-visible effects:

- The validation error for `go run ./cmd/kube-apiserver --logging-format=json
  --add-dir-header` now references `add-dir-header` instead of `add_dir_header`.

- `staging/src/k8s.io/cloud-provider/sample` uses flags with hyphen instead of
  underscore.

- `--log-flush-frequency` is not listed anymore in the --logging-format flag's
  `non-default formats don't honor these flags` usage text because it will also
  work for non-default formats once it is needed.

- `cmd/kubelet`: the description of `--logging-format` uses hyphens instead of
  underscores for the flags, which now matches what the command is using.

- `staging/src/k8s.io/component-base/logs/example/cmd`: added logging flags.

- `apiextensions-apiserver` no longer prints a useless stack trace for `main`
  when command line parsing raises an error.

Kubernetes-commit: 21d1bcd6b8498370832fa76f680d3de56837bc83
2021-09-16 18:18:35 +02:00
wujiangfa-xlauncher cadea4d691 fix top node output format incorrect
#105112

Kubernetes-commit: e838017f11dae4bc1c0a12c9703d0153661bd27d
2021-09-18 09:41:51 +08:00
caozhiyuan 0cf1a18bec handle error when parse Quantity
Kubernetes-commit: b9d7584c3a838d83c6c8c6e405907bf05addc850
2021-09-18 15:05:21 +08:00
Julian V. Modesto f9ab824bc9 Remove deprecated kubectl --dry-run values.
The boolean values for --dry-run have been deprecated for removal since
1.18, more than 2 releases.

The default value for --dry-run with the flag set and unspecified has
been deprecated for removal since 1.18, more than 2 releases.

Both values are now removed in this change. Any kubectl --dry-run
usage no longer accepts --dry-run=(true|false) boolean values and usage
now requires that a value of (client|server|none) is specified.

Kubernetes-commit: e0b7a85ee5b5d546bec2dc0e8cbf5cd4c0c684d8
2021-09-28 10:03:20 -04:00
Chok Yip Lau fad6761bba Improve configmap test
Kubernetes-commit: fa7ad6e4657769f767e3a34407cb6ad327d5259c
2021-09-03 15:54:11 -04:00
Harjas 809211b6c8 kubectl: Use fields from event series when computing describe events for a object (#104482)
* take into account new fields for event

* add event with old event fields for test

* fix: remove unnecessary "+1" from event series count

* fix: update the assertion for failing test case

Kubernetes-commit: c6935ad50e0809c1dc2d3ac9000abda0ecb49bcc
2021-09-14 00:18:50 +00:00
Eddie Zaneski 20604e9e21 Remove functionality from deprecated kubectl run flags
Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>

Kubernetes-commit: da8f404ae09823ff5fa214397215263f095e90f2
2021-09-09 15:22:28 -06:00
jaehnri 72b220068c Fix typo in kubectl describe pods example
Signed-off-by: jaehnri <joao.henri.cr@gmail.com>

Kubernetes-commit: bf1b75f165d0afde7fe9bc810425b488b5c1659e
2021-08-26 21:00:18 -03:00
Zovin Khanmohammed 723266d145 Adds the PowerShell completion generation (#103758)
* Adds the powershell completion generation

* Fixes formatting based on verification script

* Changes generation to include descriptions

* Adjusts formatting and Adds startup information

* Fix build

Kubernetes-commit: dec8528abaa58a4c7fc190df2cad8848799f9891
2021-08-25 22:29:23 -05:00
Wei Lun cdae2c3d88 fix indentation
Kubernetes-commit: 8a1987f0da1d6d881272f9609cadc03fa32c6f11
2021-08-10 16:31:32 +08:00
Wei Lun cb657f63a2 add kubectl fish shell completion
Kubernetes-commit: 3f5176c26512fdb9154a0bd1d34ee61196874251
2020-07-11 22:07:05 +08:00
Stephen Augustus 55e15b6165 generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>

Kubernetes-commit: 481cf6fbe753b9eb2a47ced179211206b0a99540
2021-08-12 17:13:11 -04:00
Chok Yip Lau 5d2f1d8a56 Added support for multiple --from-env flags
Kubernetes-commit: 9a13bae5108beb113dd0ca5605f4adeeac127915
2021-08-09 00:05:43 -04:00
fabiankramm 3d34311c79 kubectl proxy: append context host path to request path
Signed-off-by: fabiankramm <fab.kramm@googlemail.com>

Kubernetes-commit: b1a6f8cdf90c0a3861157fea24dcfa89c2aafcf9
2020-12-16 17:37:44 +01:00
Senthil Kumaran 5f6099143c Provide reference to impersonation options for kubectl auth can-i command.
Kubernetes-commit: ef181c14e128fd70c9d95193d676e1019601556c
2021-07-19 21:08:04 -07:00
Di Xu f106a734e3 cleanup description on deprecated include-uninitialized flag
Kubernetes-commit: ae7b9787ee7b46bb83b05d3769ed54374c0337a7
2021-07-26 11:14:55 +08:00
Eddie Zaneski 3e89fad72d Fix kubectl version unit test
Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>

Kubernetes-commit: 93ef5acb35f40e6cb5aae3297858371349fed10a
2021-07-27 11:46:45 -06:00
huiwq1990 de9043d5d2 use already defined variable
Kubernetes-commit: 7aab5df381fb58814afdc0bba1b7352332d53edb
2021-03-13 15:49:44 +08:00
kabab 3e3ae2747f kubectl: Add labels to ingress describe
Kubernetes-commit: 2ad2bc6844318034dd3296a0b0d5a7ce97e51962
2021-07-24 22:56:36 +02:00
Manu Gupta 2e61cacc45 fix: 81134: display conflicted taint without a json representation.
1. string is formatted as unsafe json. Since this is created on the fly;
TaintKey and Effect are formatted as a 'key=effect' instead of '{key=effect}'
eliminating unsafe json representation.

2. Adds a fail test case for the case where a taint with same key and effect is added
and removed together.

Manual Testing

```
▶ ./_output/bin/kubectl taint nodes kind-control-plane key1=:NoSchedule key1=:NoSchedule-
error: can not both modify and remove the following taint(s) in the same command: key1=NoSchedule
```

Kubernetes-commit: 1a3eda9394b7ff473434506f2756cc9df6288cea
2021-07-29 23:26:07 +00:00
novahe 95ce5a060b remove stack trace log when sorting with a bad unsortable field
Kubernetes-commit: abf735daa83f1d931614292664c2df1c6735aebb
2021-07-03 21:34:41 +08:00
Chok Yip Lau 95dc04b3b3 Added support for multiple --from-env flags
Kubernetes-commit: 99bc2b077fd208885e76281ab8865f1e85f0abb8
2021-04-29 19:16:59 -04:00
Zhou Peng 7454a6489e [k8s.io/kubectl/pkg/drain/drain]: minor typo fixup
Signed-off-by: Zhou Peng <p@ctriple.cn>

Kubernetes-commit: 7e2d6301bf95893ea74116871d2c2f6392217105
2021-08-01 07:07:31 +08:00
Kebe 316e6d8845 Fix the code is leaking the defaulting between unrelated pod instances
Kubernetes-commit: 412962204ffdfcbe6407e66125b1b499d86d49ed
2021-07-09 09:57:05 +08:00
atiratree 1c26c91ee7 kubectl: show consistent unit format in quota describe
API returns unit format in a non deterministic manner; ie it
chooses a unit format according to a resource that gets counted first

Kubernetes-commit: 3f0b64ec9597488be6365f89cc82338bcb7a9feb
2021-05-20 15:36:04 +02:00
navist2020 2128ec58c8 remove Factory that not used
Kubernetes-commit: 0a83041d4d3698d36ade2a310184248c61eec64f
2021-05-17 16:56:12 +08:00
nobuhikosawai 1e8e38ace7 kubectl: update set command description to include cronjob resource (#102503)
* kubectl: update set command description to include cronjob resource

* kubectl: update set command description to include statefulset resource

* kubectl: update set env description to remove job from resources that can update container env

* kubectl set tests: add cronjob resource and remove job resource

* go fmt

Kubernetes-commit: 41c5bca3496b516ddf52618deb44a421b89a49f1
2021-07-09 00:50:54 +09:00
atiratree 9a63531dee update translations
Kubernetes-commit: 33e6ebc8f8df47864a77c867d78216adb70cd79d
2021-07-06 20:43:49 +02:00
Natasha Sarkar b29f07c93e Manually update kustomize attachment points.
Kubernetes-commit: a46b42a92b87c04f22c77df6d57149ad34b0ee6d
2021-07-01 17:10:28 -07: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
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
wawa0210 11174082b3 fix kubectl alpha debug node does not work on tainted nodes
Kubernetes-commit: 3ec63238c53ae3a7185db210e94494d850def3d4
2021-01-26 23:36:35 +08:00
Lee Verberne 7b8558da71 Add backwards compatibility for kubectl debug
The ephemeral containers API changed in 1.22. As a result, kubectl
debug (currently) cannot create ephemeral containers in clusters prior
to 1.22.

This change causes kubectl to retry the request using the old API when
it receives a specific error message from the server.

Kubernetes-commit: 06124c1d1c68ec4a30406bf585df2ec83231cb65
2021-06-28 18:19:50 +02:00
Chok Yip Lau 03baccf059 Added field-selector option for kubectl top pod
Kubernetes-commit: 1331c76aa3d7e5db730dc008b2ee94173ca51293
2021-05-19 15:54:39 -04:00
atiratree 9fd6965f54 update translations
- update template.pot
- reformat .po files
- regenerate .mo files
- regenarate and mark obsolete translations
- remove obsolete default/english translations

Kubernetes-commit: 194ed1408dd75ab2765d1b884128c3b7bf7c6823
2021-05-17 15:40:46 +02:00
atiratree 868d0f1252 fix update-translations.sh
Kubernetes-commit: 079d8aeb1e47f8907aa6d3760424047dccfc8279
2021-05-17 15:37:36 +02:00
Lee Verberne 119802affe Warn user for runtime support of debug targeting
Add a warning message to `kubectl debug` when using the `--target`
option as many runtimes don't support it yet.

Kubernetes-commit: 968185e1f7c4aee739d5abe6133a690c70e87d5e
2021-04-13 15:50:26 +02:00
Monis Khan 82734c256a csr: add expirationSeconds field to control cert lifetime
This change updates the CSR API to add a new, optional field called
expirationSeconds.  This field is a request to the signer for the
maximum duration the client wishes the cert to have.  The signer is
free to ignore this request based on its own internal policy.  The
signers built-in to KCM will honor this field if it is not set to a
value greater than --cluster-signing-duration.  The minimum allowed
value for this field is 600 seconds (ten minutes).

This change will help enforce safer durations for certificates in
the Kube ecosystem and will help related projects such as
cert-manager with their migration to the Kube CSR API.

Future enhancements may update the Kubelet to take advantage of this
field when it is configured in a way that can tolerate shorter
certificate lifespans with regular rotation.

Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: cd91e59f7c351fce47c064a5162c2cb79075159c
2021-06-25 22:08:10 -04:00
Nabarun Pal c4de100b6e hack: remove bindata generation logic for translations
also, remove generated bindata

Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>

Kubernetes-commit: 43c2e454a059da5cfce0430534b289dd21a0599e
2021-03-04 10:28:08 +05:30
Nabarun Pal e99a037812 kubectl: use embedded translations instead of generated bindata
Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>

Kubernetes-commit: eb75b34394964fbc325ca08a5d0b126c5ea16b6f
2021-03-04 10:26:41 +05:30
Nabarun Pal f52da0a0a3 kubectl: move translations to i18n package to kubectl staging directory
Go 1.16's embed directive doesn't allow embeding files from parent
directories. Hence, moving the translations data to inside the i18n package.

Logically speaking as well, kubectl related artifacts should be inside
the kubectl package.

Signed-off-by: Nabarun Pal <pal.nabarun95@gmail.com>

Kubernetes-commit: 5ece28b77a284b24b674278378630373196789ac
2021-03-04 09:55:12 +05:30
Chris Henzie cb8bf2d275 Update helper methods to print and parse ReadWriteOncePod access mode
Kubernetes-commit: 5f98f6cfa47e2fcfad46822638b4fd167d8c41df
2021-03-10 20:51:43 -08:00
Chris Henzie 8bd9f6c9c6 Export contains access mode helper method
Will be used during validation of PVs and PVCs

Kubernetes-commit: 358d2e0bd1ffd475274ea08494bc8d39ef0e80cc
2021-06-14 19:31:57 -07:00
Sean Sullivan 42a8170920 kubectl command headers as default in beta
Kubernetes-commit: 4add8ed910654087683444ac7f8e441e8d32baa3
2021-06-26 20:53:49 -07:00
Marc Khouzam 4338c5bc89 Use native zsh completion
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 77bb053102cbe1581857dd35e9c095888d2c85d3
2021-06-05 22:09:03 -04:00
Marc Khouzam ef4c461bd5 Add tests for completion utility functions
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 46aa6045e4c383db2106307ee687abce2910153a
2021-06-05 21:11:34 -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 b817d296dd Update staging/src/k8s.io/kubectl/pkg/cmd/config/config.go
Co-authored-by: Philipp Stehle <philipp.stehle@sap.com>

Kubernetes-commit: 9d03185d3c12a0b3f2f36a5096d4a9658bba5472
2021-05-03 14:18:00 -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
knight42 6c78436886 refactor: implement custom completions for some flags using Go
Only --context, --cluster, --user and --namespace are included.

Signed-off-by: knight42 <anonymousknight96@gmail.com>
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 663b13e814909070e83642c42969174ce03a0e1e
2020-08-06 23:48:33 +08:00
Shiming Zhang 7dc4f46322 Close the used file
Kubernetes-commit: b87ad95fec3eb82c2b2d08466cd985f4fcae1e23
2021-06-03 15:36:20 +08:00
Andrew Keesler d9980eb6ca kubectl: don't fight for stdin with exec plugins
Signed-off-by: Andrew Keesler <akeesler@vmware.com>

Kubernetes-commit: 60246f69cc0fcc6f5cfd0a36eb069187a4bd9e98
2021-06-14 17:16:54 -04:00
navist2020 537227dc43 Simply modify the Kubectl logs information
Kubernetes-commit: 1995f28c64a73c8a60fb21e89b0b3d98b544df58
2021-03-01 14:56:27 +08:00
Huy Pham 274bb14190 doc: remove the description `socat` is required
This is no longer true as of `containerd` v1.4.0 because [0] removes `socat` dependency for port-forwarding. For lower versions of `containerd`, the error message is descriptive i.e. `"socat": executable file not found in $PATH`.

[0] https://github.com/containerd/cri/pull/1470

Kubernetes-commit: 64fca6bda7d36b9cc1667aa317896b540d4dcf8c
2021-03-30 09:56:23 -07:00
Maciej Szulik 0173fa9c51 Clean apply's prune and kube addons with batch/v1 CronJob
Kubernetes-commit: 1619e8eb953042facabc448bf6cbc67eeb46d5cc
2021-06-02 14:27:29 +02:00
Mengjiao Liu 27a118e81a Promote cronjob to batch/v1: kubectl sparse_test prune
Kubernetes-commit: 363b78fe883b58460a1191bb19a760fb86f7140e
2021-05-26 20:08:36 +08:00
Marek Siarkowicz bf8f151ce7 Enable protocol-buffers by default
Kubernetes-commit: c7111515c5bc68589d8b5c440ff0da5c5ca6bf2f
2021-05-16 18:28:46 +02:00
Chok Yip Lau 8a6f838eea Fixed sort-by not sorting Resources as expected
Kubernetes-commit: e43e9696cc69d835c98b5d590af702677675419a
2021-03-21 17:44:52 -04:00
Maciej Szulik e78cfb08d1 Drop PDB's beta from create command
Kubernetes-commit: 628321130b2b754621eabdd0ec32aa7ef34814fe
2021-04-29 15:07:07 +02:00
Maciej Szulik 156befb4d8 Drop cronjob beta API from create command
Kubernetes-commit: 8b90dbdd4410e94fb5e45cf28a84c8e9527429b6
2021-04-29 15:06:41 +02:00
Chok Yip Lau 16d54ee18b Added BinaryData description to kubectl describe
Kubernetes-commit: cc28c6dba4d703f3ced1cb32394597252483b8bb
2021-03-25 16:54:44 -04:00
David Eads 8f3ebd40ae prevent restmapper lookup for kubectl reconcile
Kubernetes-commit: d3e702fa9938e645c2bc852b0239887ec645ffe5
2021-05-07 11:53:37 -04:00
carlory 1e2ad00b4d fix kubectl set env or resources not working for initcontainers
Kubernetes-commit: fb2fe697e3863a79fbe33cb8075cc164433bbb40
2021-04-30 22:41:13 +08:00
Kenjiro Nakayama cd8eea6e31 Fix error handling for kubectl create configmap
This patch changes to return when `createConfigMap()` returns error.

Kubernetes-commit: 6caf4d66bda3b9e4efaa45f3479c11ed70ae0100
2021-05-07 18:03:03 +09:00
Ling Samuel cf01e4558b fix kubectl wait --for=delete ignore not found
Signed-off-by: Ling Samuel <lingsamuelgrace@gmail.com>

Kubernetes-commit: 99cdc37e2a89df1f86045f295916c00266e4d034
2020-11-19 14:48:28 +08:00
c00522440 961082a1c3 clean true judge
del annotation

reback change

reback change

fix ci

Kubernetes-commit: 082aa9328f8f97f27be6e477df217b7265e8f260
2021-04-27 20:11:36 +08:00
ZhengYuan Loo c155b7bb87 feat: masked secrets in kubectl diff output (#96084)
* fix tests

* add changes

Kubernetes-commit: 0cbf00ad018d5104e438b5693fde435fa06e30c9
2021-05-18 14:19:27 +00:00
carlory 96b4e0f923 As users are a valid resources type for the can-i command, the warning shouldn't appear
Kubernetes-commit: 5d9a0c3c00df605d1a186844c4b1a9b1ffdf588d
2021-04-30 11:44:27 +08:00
Quan Tian a78d4d9ab3 Fix EndpointSlice describe panic when an Endpoint doesn't have zone
Kubernetes-commit: 67494b169413c74c116cf4c238c266810729247a
2021-04-12 18:15:16 +08:00
xiongzhongliang 32cf4940bf fix description of command kubectl cluster-info dump
Kubernetes-commit: 4dce977034c5d169ff4af14d61eba50d992ac81d
2021-02-28 06:39:15 +08:00
Zzde 161f78e312 Add test create service with ns
Kubernetes-commit: 84b9159a2e7e20b143d5756bf7f9ccb36d58926a
2021-04-22 17:39:23 +08:00
Zzde dd3b5db48b Set namespace when using kubectl create service
Kubernetes-commit: d1e95a07b24e03ffdf2c5957c4de3f501e9c0a84
2021-04-12 01:20:36 +08:00
David Eads f1feb4b0d5 add --all-namespaces to kubectl annotate,label
Kubernetes-commit: ad0cff7b61515e481098a1dfbe785066d655da97
2021-04-26 11:13:01 -04:00
Katrina Verey 2a8c1d4c6f Clean up kinds removed from extensionv1beta in 1.16
Kubernetes-commit: 8c1a86a272dfd25418be5c7995eba0985b3df34e
2021-04-23 12:10:42 -07:00
Katrina Verey 866947d076 Add correct GV for PSP describer
Kubernetes-commit: 11c1d77660d7f232389b1badc1abc4efff9685d7
2021-04-20 11:25:04 -07:00
Chok Yip Lau a148ed0251 Fixed typo for kubectl top pod
Kubernetes-commit: e821f9c566aa23c558f4ff2379e143eeebd4858c
2021-04-22 09:59:37 -04:00
Ricardo Katz bb18a0e1b2 Fix validation in kubectl create ingress (#101377)
* Fix validation in kubectl create ingress

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

* Fix validation in kubectl create ingress

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>

Kubernetes-commit: 3dfbcbc878a72a9544af6841315e7dceef9e99fc
2021-04-22 21:44:23 -03:00
Katrina Verey c31d6154d6 Add --chunk-size support to kubectl describe
Kubernetes-commit: 8ad6fd6ddbf6a8e0f2cdca17583af38cf30c2bb2
2021-04-20 11:24:35 -07:00
BLasan 9072d8b375 Remove AddGeneratorFlag function
Kubernetes-commit: 9c8335b65a4527ea3a07687e4a7a8ba5ebd72041
2021-04-13 23:58:24 +05:30
Madhav Jivrajani de20fbd4bf remove deprecated generator flag
Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: ea709114f1961cee7e5aa46ff42dfd6aaeb48569
2021-03-06 21:56:58 +05:30
Lee Verberne 46887fb25e Address feedback for new /ephemeralcontainers API
* Use deep copies in `PrepareForUpdate()`
* Preserve select metadata from new pod
* Use patch to add ephemeral container `kubectl debug`
* Distinguish between pod vs /ephemeralcontainers NotFound

Kubernetes-commit: 97726a50c138557522def7f753ec8581d00f0b02
2021-04-14 18:40:42 +02:00
Lee Verberne 7fd8647b0d Switch ephemeralcontainers SR to Pod Kind
This changes the `/ephemeralcontainers` subresource of `/pods` to use
the `Pod` kind rather than `EphemeralContainers`.

When designing this API initially it seemed preferable to create a new
kind containing only the pod's ephemeral containers, similar to how
binding and scaling work.

It later became clear that this made admission control more difficult
because the controller wouldn't be presented with the entire Pod, so we
updated this to operate on the entire Pod, similar to how `/status`
works.

Kubernetes-commit: d22dc5cb72a627341f4004b5d58d275f3d8773b3
2021-04-09 13:53:13 +02:00
Gautier Delorme 579299d5e2 remove go-openapi/spec
Signed-off-by: Gautier Delorme <gautier.delorme@gmail.com>

Kubernetes-commit: 34b0fcef5fc47e3fcddf7f6ca1b3e6176b2a5323
2021-04-20 17:48:33 +02:00
卢振兴10069964 031e3ab456 code cleanup: fix broken link in kubectl completion
Kubernetes-commit: 84df3a213fcb6a91f8b72e66dc610ce399807d10
2021-04-19 14:15:48 +08:00
Hong Xu cd28c3f56e Validate scale's --current-replicas flag
--current-replicas is only meaningful when it's -1 or greater.

Also add an error message to clarify the range of --current-replicas. It
is unclear that --current-replicas=-1 means no precondition. This info
may be useful for programming purposes (i.e., shell scripting, etc.).

Kubernetes-commit: 8fd7862e6974fda28bb91286ca79dc6fa236f2f8
2021-03-24 13:59:08 -07:00
Aldo Culquicondor 0fb45f1128 Fix Job describe for completion mode
Kubernetes-commit: 2fd8dd1724e4d8a2740c834ae971cf876f2fd2a3
2021-04-15 21:15:09 +00:00
Jordan Liggitt 49f840d934 kubectl: send policy/v1 evictions to servers that support it
Kubernetes-commit: f07fc213b07568442b22757b2220b80a5041cced
2021-04-01 22:50:59 -04:00
Katrina Verey ea308b60b6 Add --chunk-size flag to kubectl drain
Kubernetes-commit: 5200ff86d0983e42c3d2d5c0d830e96495516347
2021-03-19 08:32:37 -07:00
Katrina Verey 086cadbf87 Create helper for adding chunk-size flag to commands
Kubernetes-commit: f8097c6ceeb16461861c74d4fc5dd0bcd36ebeaf
2021-03-19 08:30:49 -07:00
Katrina Verey 9348b0acca Extract DefaultChunkSize constant
Kubernetes-commit: 222e2c5ef897f4d47831b8d822cab09c000037c2
2021-03-10 12:21:25 -08:00
Sagar Muchhal 27325b0861 Adds actual context to node drainer code
Signed-off-by: Sagar Muchhal <muchhals@vmware.com>

Kubernetes-commit: 2e01560fd0c1fc6eec607c5a01022384feda67d6
2021-03-21 18:11:50 -07:00
Masashi Honma c011a4ab83 Fix a unit test failure in non English languages
This is a result in Japanese language.

$ make test WHAT=./staging/src/k8s.io/kubectl/pkg/cmd/diff
[0402 07:24:05] Running tests without code coverage
FAIL: TestDiffProgram (0.00s)
    diff_test.go:73: stdout = "ファイル /dev/zero と /dev/zero は同一です\n", expected = Files /dev/zero and /dev/zero are identical
        "
FAIL
FAIL	k8s.io/kubernetes/staging/src/k8s.io/kubectl/pkg/cmd/diff	0.045s
FAIL
make: *** [Makefile:184: test] エラー 1

Kubernetes-commit: 6b9ff98dd72503e0cad5c626f67c716d465d18b2
2021-04-02 15:59:47 +09:00
Katrina Verey 5105e147ad Fix kubectl drain --dry-run=server
Adds missing type meta to PodDelete items

Kubernetes-commit: ff9ada1b550852c697af5250c90e8e4de69110e4
2021-03-12 16:26:48 -08:00
Hidetatsu Yaginuma ea99c2e0e8 use AllowedFormat in kubectl get help to avoid code duplication (#99983)
Kubernetes-commit: 0486f1a728c964f643c70d1f3aea59243a4fedf8
2021-04-09 09:10:22 +09:00
Hong Xu e8a9ba311e Use os.CreateTemp in kubectl editor (#99921)
os.CreateTemp seems to perform the exactly same task here, and its
implementation seems having considered many more edge cases than the
implementation here. This patch uses os.CreateTemp here to avoid
reinventing the wheel.

Kubernetes-commit: de0f030bcec55944dcbf81a9eec4f4d87f76567f
2021-04-08 16:00:25 -07:00
changshuchao 7d1600ce5a code cleanup for kubectl apply_edit_last_applied.go,wait.go,completion.go,cp.go
Signed-off-by: changshuchao <chang.shuchao1@zte.com.cn>

Kubernetes-commit: e229ca33cff782e0bf602f43312b9a168aa58c4c
2021-03-07 05:04:30 +08:00
Chok Yip Lau c2974ae03d Fixed describe ingress causing SEGFAULT
Kubernetes-commit: 12f8468fe03291a1da0803b9e5375ec079abd6e6
2021-03-23 18:21:20 -04:00
Aldo Culquicondor eb94c78123 Only default Job fields when feature gates are enabled
Also use pointer for completionMode enum

Kubernetes-commit: e6c3d7b34dff0324adb80591c00519b6f6a4a2e1
2021-03-12 17:26:40 +00:00
mengjiao.liu a0af655b7a kubectl default container behavior
Kubernetes-commit: 88e530117ff3fff29e670aee51c677a8e0fe8dec
2021-03-05 17:04:40 +08:00
Patrick Ohly 5274b1e590 generic ephemeral volumes: drop ReadOnly field
As discussed during the alpha review, the ReadOnly field is not really
needed because volume mounts can also be read-only. It's a historical
oddity that can be avoided for generic ephemeral volumes as part
of the promotion to beta.

Kubernetes-commit: 555d4a12bf58f19cbd79f866e2abce13490bde40
2021-03-03 17:16:13 +01:00
yuzhiquan 0ca8bbb1ad remove --ignore-errors flag deprecated warning message
Kubernetes-commit: 01d0d15562ccb7377176f72fb70a3cf18d0d7666
2021-02-24 19:02:24 +08:00
Jordan Liggitt 9967facf23 kubectl describe policy/v1 PodDisruptionBudget
Kubernetes-commit: 7956a9239ab6e28b5260340aeae5f3e6b1b94a36
2021-03-09 10:56:48 -05:00
Chok Yip Lau c66790ded2 Fixed set env did not support keys with dot in it
Kubernetes-commit: ab5a81cd1502418b1c8a8f55da7f0550b42e7ab7
2021-02-06 22:27:44 -05:00
Maciej Szulik 69bc307556 Fix batch/v1 CronJob support in create, describe and polymorphichelpers
Kubernetes-commit: a68582d6086ffc8608779b0459de8d387042eed1
2021-03-09 09:44:02 +01:00
Morten Torkildsen 8ae7711ae6 Promote PDBs to GA
Kubernetes-commit: 21fba79d453b0bab7153f46916126c754d10341e
2021-02-20 12:56:31 -08:00
bl-ue 91c5000b38 Fix case of Age column in kubectl describe node
Kubernetes-commit: df1955208b9a1950b79630b2fe88376452d70e02
2020-11-30 14:06:34 -05:00
rkilingr 1d4a9f61b6 Provides capacity for make slice
* Providing capacity for slice decreases memory allocations performed

Kubernetes-commit: dfe29ae7f84dccb3a989ed1f5d73bde3f58d4ed8
2021-01-31 20:56:11 +05:30
monopole a767deb039 Manually update kustomize attachment points.
Kubernetes-commit: 6c9460f0b405630ebd21cd432b8b8ffede6d7554
2021-02-25 12:06:47 -08:00
monopole ae675e730f Delete staging/src/k8s.io/cli-runtime/pkg/kustomize
Kubernetes-commit: 073ca8b42e9b5e4bed4c7f5cec12e9c8c17ea0d9
2021-02-13 14:52:06 -08:00
Swetha Repakula 691cc30112 Add v1 describers for EndpointSlice
Kubernetes-commit: ba34956dd6bb348e5ba83580c6864001316cd67c
2021-03-08 13:32:26 -08:00
Heng WU 408faf6867 Wrong command (kubectl top) description (#99060)
* Update top.go

* Update top_pod.go

* Update top_node.go

Kubernetes-commit: b7613c4315c18592621ecae4d4959985ed497623
2021-03-08 22:01:04 +00:00
Jan Chaloupka ba75977126 kubectl explain: detect resource group in case there are two or more groups discovered
Assume the following CRDs exist (ordered by priority, the first is the highest):
- authentications.migration.k8s.io (K=Authentications, G=migration.k8s.io)
- authentications.metal3.io (K=Authentications, G=metal3.io)
- authentications.whereabouts.cni.cncf.io (K=Authentications, G=whereabouts.cni.cncf.io)
- authentications.snapshot.storage.k8s.io (K=Authentications, G=snapshot.storage.k8s.io)

In case 'kubectl explain authentications' is ran, the highest priority definition (in this case authentications.migration.k8s.io)
is returned. In case a user wants to explain authentication CRD of a different group, --api-version flag has to be set alongside
to point to a specific group and version. E.g. --api-version=metal3.io/v1

This PR allows to dismiss --api-version flag and perform a prefix check to select a resource (e.g. CRD) whose (resource, group) pair
fully prefixes requested resource. E.g. running 'kubectl explain authentications.metal3.io' will return
description of authentications.metal3.io. The same holds for optional field path.
I.e. 'kubectl explain authentications.metal3.io.spec' will return description of spec field
of authentications.metal3.io.spec. In case no resource match is found, the search falls back
to selecting the highest priority gvr that matches the resource.
In case --api-version is set, no prefix matching is performed. To cover cases
such as 'kubectl explain authentications.metal3.io --api-version=authentications.metal3.io/v1' where
fields path coincide with the resource fully specified name (to access .metal3.io field of authentications.metal3.io).

Kubernetes-commit: 30674db1595e3a24273ceb71cbfe67bb300ad951
2021-01-14 09:08:20 +01:00
Maciej Szulik 1198e26232 Drop deprecated run flags and deprecate unused ones
Kubernetes-commit: f38ef2fbc6299f4b050a0daa578bfbf393df467c
2021-03-03 22:22:58 +01:00
Harry Bagdi 62d08a495c Add namespace scoped ParametersReference to IngressClass
Kubernetes-commit: a7fc92089a42aff0c2f10d56b0ee290440adfbc4
2021-03-06 03:03:20 +05:30
Maciej Szulik 5e9caaade6 Clean unused generators
Kubernetes-commit: da19e5b2583fa00a13110de97448bf6452010988
2021-03-03 22:47:53 +01:00
Marek Siarkowicz bc5d348632 Use protobuf for kubectl top
Kubernetes-commit: 560394da38422cf106917b7addc3fa828e746b6b
2020-11-18 00:14:20 +01:00
Clayton Coleman 56434236a4 kubectl: Inline the containers for the user in attach/exec
The behavior of the container defaulting in attach/exec is inconsistent
and should be unified. As a user, when we default the vast majority of
pods will have a small number of containers and so printing the container
names inline (as kubectl logs did) is more appropriate. The debug message
we printed about using describe was already longer than 99% of all pod
container names, so we were wasting user time.

Unify container selection for exec and attach to be consistent with old
behavior. Properly handle the --quiet flag (should not print in that case)
for both commands. Remove EnableCmdSuggestion and the machinery it needs.

The message now prints:

> Defaulted container "etcdctl" out of: etcdctl, etcd, etcd-metrics, etcd-ensure-env-vars (init), etcd-resources-copy (init)

Kubernetes-commit: 43e8ebbbcd3f57d18d8151efb6242f88a763b06d
2021-02-11 11:40:25 -05:00
Clayton Coleman 46f90dca38 kubectl: Properly respect --quiet in exec/attach
--quiet means no informational output for the human that could be
confused with the output of the shell / command on the other side.

Kubernetes-commit: 75700d32bff0e28c7093ef384de78dbdd0db61b2
2021-02-11 11:48:43 -05:00
Maciej Szulik 10f53d93f7 Fix kubectl openapi test to use apps/v1/Deployment
Kubernetes-commit: 7c194bb3e3daaadcf0bb785a16bffb3c1add274f
2021-03-01 19:24:15 +01:00
Maciej Szulik 341b878121 kubectl create job support both v1beta1 and v1 cronjob
Kubernetes-commit: 470e23e770223fb9ddb147b3d431c7727f342255
2021-02-12 17:04:50 +01:00
xiongzhongliang 4c524fcbeb fix kubectl patch command error message
Kubernetes-commit: 99f0369f9d9110dbe5d36c20e067e25077a50d9d
2021-02-04 19:15:18 +08:00
Ricardo Pchevuzinske Katz 922a8a5058 Remove extensions v1beta1 from addon manager and kubectl prune
Kubernetes-commit: 25f3cf55509acdd3bd31bc9ca028c5d5a3bd22b0
2021-02-05 09:38:28 -03:00
caodonghui a93288022b remove duplicate logs
Kubernetes-commit: 60991daf1ca6ccd24ae14e6643b8374d55bc75bb
2021-03-02 18:20:12 +08:00
brianpursley 79dc7a9183 Add warning if client/server version difference exceeds the supported skew
Kubernetes-commit: 0c28cad8d142059b488347badd46433d50e47feb
2021-03-03 20:55:05 -05: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
Shiming Zhang 1bc7e4aa19 Fix MakeRegexpArray handling empty strings
Kubernetes-commit: 63860270e303476cdef282c6bb071c70952b4fbb
2021-03-02 17:53:00 +08:00
John Howard c8325cdd3b Improve warnings for default-container
Right now, there is no way to use these annotations, support multiple
`kubectl` versions, and not give users annoying warnings every time they
run `kubectl log`.

If a user is setting *both* annotations, they clearly know that the old
on is deprecated. Therefor, we should not warn them.

Kubernetes-commit: a7882d8a4264cdb9eaab9dc3d67cf0cc5afd5886
2021-03-02 09:07:50 -08:00
Sean Sullivan 76c2cf7eb6 Kubectl command headers in requests: KEP 859
Kubernetes-commit: 211fc12b67ea2d04a46b24ef245b3513f2cfeb03
2021-02-09 23:09:22 -08:00
Aldo Culquicondor 3af483b7e4 Add Job.spec.completionMode and Job.status.completedIndexes
And IndexedJob feature gate, disabled by default.
Update JobDescriber

Kubernetes-commit: a1a5868a5ae8c18df39b386d2424ff04c89826fb
2020-12-30 11:42:01 -05:00
mengjiao.liu 0a33eeb176 update kubectl cp --container flag description
Kubernetes-commit: 6be7b00b455f632a92c2c9c1a3878ecf5201e955
2021-03-01 18:02:02 +08:00
pacoxu 4245d9e7b5 print log for default container of kubectl
Kubernetes-commit: 96f8d6262459e802510244d2880886f8b481ee0e
2021-03-01 12:04:29 +08:00
Chok Yip Lau 0b4fea3c25 Remove dependency of generators from create secret
Kubernetes-commit: 5d3c4eaf562dcdcdc783dee8861e1a2be031ee69
2021-01-13 18:59:18 -05:00
pacoxu aedad91395 fix: will logs the default container only even --all-containers is specified
Signed-off-by: pacoxu <paco.xu@daocloud.io>

Kubernetes-commit: 71db08d15a580cee1592eb699a3ff448f5fe4fe1
2021-03-01 11:00:05 +08:00
wzshiming ad07682396 Fix --ignore-errors does not take effect if multiple logs are printed and unfollowed
Kubernetes-commit: 336e464caef8234a57d150c2944916445ca91e69
2021-01-07 10:43:36 +08:00
pacoxu 8d367eb060 move default container annotation to kubectl pkg
Kubernetes-commit: 27bd94e54d2f8a7676411b280ab9d0ac7f9e921b
2021-02-26 10:11:12 +08:00
pacoxu 360e8d2b15 feature: use default container annotation for logs and exec
- update according to KEP: move getContainerName to helper

Signed-off-by: pacoxu <paco.xu@daocloud.io>

Kubernetes-commit: b54e823dbce08bff6fab979243663b0fea5a351f
2020-12-07 15:30:30 +08:00
fabiankramm f32b960dd4 override request host for kubectl proxy
Signed-off-by: fabiankramm <fab.kramm@googlemail.com>

Kubernetes-commit: 379b541070bf5a5f31abe513d717c0f7b12845a8
2020-12-18 10:02:59 +01:00
Philipp Stehle 2aa5185d01 bash-completion for comma separated list on get
`kubectl get` supports specifying a comma separated list of resource types. E.g.:

```bash
kubectl get pods,secrets
```

Will list all pods and secrets in the current namespace.

This commit adds support to the kubectl bash completion for this feature. Which means if you type `kubectl get pods,sec<tab>` it will be auto-completed to `kubectl get pods,secrets` (assuming the cluster does not have a CRD starting with `sec`).

Kubernetes-commit: 51671ecc2e258d50c7b1315b7b68c4e239f7e829
2021-01-22 10:04:56 +01:00
Nikhita Raghunath 75f0d51ce1 kubectl: fix error message for client-side SMP for CRs
Kubernetes-commit: a9a3e4d1c95fcfd8d3b2dbbca31cf7ad6441abbb
2021-02-17 13:44:36 +05:30
Heng WU 58dd520868 Update plugin.go
Kubernetes-commit: 3c1c53c06c7b95283a84b28d3566e74c201e0e21
2021-02-14 11:10:20 +08:00
Heng WU e405ba800f Remove redundant code in kubectl top pod (#99062)
* Update top_pod.go

* Update top_pod.go

Kubernetes-commit: 93ab4e96f3c07e99ff32724aafe6887b6eab94ee
2021-02-17 11:17:06 -06:00
Maciej Szulik 6b4e2b9b05 Drop batch/v2alpha1 API
Kubernetes-commit: 3dab7462d1ff6e20f7efe38249dd9958e4e32c89
2020-12-01 16:33:47 +01: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
CaiyuhangC 1fa4fffb96 Remove the dependency between create namespace command and generators (#96556)
* Remove the dependency between create namespace command and generators

* Update create_namespace.go

format the file

rename "kruntime" package to "runtime"

remove the reliance of generators

replace dynamic client with typed client

rename "options" to "o" in "NewNamespaceOptions" fun for better reading and comparison with other create cmd

remove Namespace and EnforceNamespace from NamespaceOptions

remove Mapper from NamespaceOptions

refactory the "Run" fun

refactory the "Run" fun

Update create_namespace.go and create_namespace_test.go

* Update create_namespace.go and create_namespace_test.go

* fix createNamespace function

* fix createNamespace function

* fix createNamespace function

* remove the wrong comment in NamespaceOptions

* add validate operation for cobra.Command

* add some unit tests

* add some unit tests

* remove the call of Validate() from createNamespace() and update return type of createNamespace()

* update test suite for the new createNamespace()

Kubernetes-commit: 6990d75625b6aaa32c1aa5a99a174775868263bc
2021-02-05 17:33:15 +00:00
Chok Yip Lau 45c537a0ee Fixed typo in create_priorityclass
Kubernetes-commit: 2edbea60a58c0ec3b5951722a3c90c1752561b50
2021-02-03 21:46:10 -05:00
chymy b2c6b4b00c Remove heapster flag in 'top node'
Signed-off-by: chymy <chang.min1@zte.com.cn>

Kubernetes-commit: 01f521aac6d275be4da31d87bffa7ae29b6216f3
2021-01-27 15:33:04 +08:00
Nick Maliwacki f3ec5d79c4 add .status.observedGeneration tests & update names
Kubernetes-commit: bca0ddeba0d669093d04a148cef4d4179e2fa271
2021-01-13 22:35:58 -08:00
Nick Maliwacki a84bbc2022 wait ensures observedGeneration >= generation
Kubernetes-commit: 44aff9917566885ab5d8cc712a3330bac1923214
2020-12-20 00:35:31 -08: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
chymy 942504dab2 add i18n.T in waitExample
Signed-off-by: chymy <chang.min1@zte.com.cn>

Kubernetes-commit: e472a7724bc6f105e07c9a0d6362cd0e8390d2fe
2021-01-28 10:35:21 +08:00
bl-ue 3bac60a8ed Fix typo in kubectl/.../attach_test.go
exepctedErr -> expectedErr

Kubernetes-commit: b34d00aa09084d5786d4ca5cf11b173be9f791eb
2020-11-27 14:55:23 -05:00
Sagar Muchhal 72f141c577 Passes a context to the drain helper object
Enables the PatchOrReplace call for the cordon helper to accept a
user-supplied context to be used for the client.Patch/Update calls to
alter the node status while cordoning/uncordoning the node.

Signed-off-by: Sagar Muchhal <muchhals@vmware.com>

Kubernetes-commit: 017eaa519de5926fd75a9ddc61bedf2398b69653
2020-12-04 15:13:03 -08:00
xiongzhongliang c6d8fe03b9 cleanup: fix the format of kubectl proxy examples
Kubernetes-commit: 5a77916666a0aa7893da1bebf706a8e98793b81e
2021-01-05 06:02:37 +08:00
xiongzhongliang b0de341b90 Remove kubectl alpha debug command in 1.21
Kubernetes-commit: e650a8a38c30ff3707292c060613acdb0714b2ec
2021-01-16 20:17:22 +08:00
xiongzhongliang bfad7fa736 code cleanup for kubectl alpha -h
Kubernetes-commit: 5eff181ec30624706eb024467fb1b9d5c9a473f7
2020-12-27 07:30:44 +08:00
Bryan Boreham 40c811e2d9 Comment default behaviour of GracePeriodSeconds
It took me a while to spot this subtlety.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Kubernetes-commit: 7c764c8550121b48a6e2678700b6a80fa7d3e2f0
2020-11-23 17:46:14 +00:00
Chok Yip Lau 31e15a5c73 Remove dependency of generators from create configmap
Kubernetes-commit: 838b189130e1a7f19b11a0764f15df1c8de32769
2021-01-10 18:47:32 -05:00
Li Bo 1d8a42052c fix problem that NewReplicaSet shows <none> when describing deployments
Kubernetes-commit: a286455a3e230eb1373002b302669c6999c949f1
2021-01-06 11:05:31 +08:00
Sachin Kumar Singh 8e81e1d9ff Remove the dependency between create poddisruptionbudget and generators
Kubernetes-commit: 1e4cba79ef8972248ac360b4ac5b21b085f6a8dc
2020-12-22 01:50:52 +05:30
Chok Yip Lau a306e7043b Moving kubectl logs Long command into variable
Kubernetes-commit: bd4bf6a28e1080ee9f5c4b2885eecb94542f35f8
2021-01-10 14:54:27 -05:00
Masashi Honma 3c3bc4f5e8 Namespace has no effect when exposing deployment with --dry-run=client
This is how to reproduce.

$ kubectl create ns testns
$ kubectl -n testns create deployment test-deploy --image=nginx
$ kubectl -n testns expose deployment.apps/test-deploy --port=80 --dry-run=client -o yaml
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    app: test-deploy
  name: test-deploy
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: test-deploy
status:
  loadBalancer: {}

If --dry-run=client is not specified, namespace element is contained in the yaml.

Kubernetes-commit: 8d83dfe2075be68344a633418de7ef81e1dd5957
2020-12-24 09:40:10 +09:00
Henrique Fernandes 5d79d7168d Remove debug print
Kubernetes-commit: 32b8d5ae20105c88fd33c1a34f245639c4a0f6f7
2021-01-19 17:21:50 -03:00
Douglas Schilling Landgraf 2560231a8d kubectl diff: update regex to allow equal param
When using GNU diffutils, some commands (e.g. --color[=WHEN])
requires an equal sign.

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

Kubernetes-commit: 722751accf7607f4d0573778e85027c63e1802ce
2021-01-18 23:22:36 -05:00
Douglas Schilling Landgraf b839958e59 kubectl: run - remove unneeded vars
No need extra vars just for a single validation.

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

Kubernetes-commit: ea017e53af84b05154f275fabcfc95a61b091493
2021-01-15 21:03:27 -05:00
Hidetatsu Yaginuma 0668abe1cd fix invalid indentation
Kubernetes-commit: f00f114ecaca6065be0cbc4c16c670370e202b1a
2021-01-12 13:02:52 +09:00
xiongzhongliang b5ead8eb49 Add statefulset to kubectl autoscale bash completions
Add statefulset to kubectl autoscale bash completions

Kubernetes-commit: 0c74749ec9f2e8ca5ae4710f1d16831998d55625
2021-01-08 03:40:55 +08:00
Chok Yip Lau e9514842ae Fix golint errors for kubectl/pkg/cmd/certificates/certificates.go
Kubernetes-commit: 9a3148291d499a7dc8e25caf429a9a7a8ac06a56
2021-01-09 19:51:51 -05:00
xiongzhongliang ceb5d08972 add -q as shorthand for --quiet
Kubernetes-commit: a7e15c7606d24f0ff11c5ddf05f3cbc6ab891e16
2020-12-31 19:18:17 +08:00
熊中谅10171568 1d4e99420e add more usage info for kubectl wait option --for
add more usage info for kubectl wait option --for

Kubernetes-commit: 033e4a58182fb90e36d5f6cc3f291a2ea114998a
2020-12-29 21:08:03 +08:00
ramnar 75a9c11d24 implemented review comments
Kubernetes-commit: ffc5c5c054bb8138d8fe456f1d9b5a071cdbdbdc
2020-11-18 09:42:36 +05:30
ramnar 23b2c5aba6 remove generator dependency in create service account
Kubernetes-commit: 7000c28b74b6069fd3b5179d89178271b9fafe42
2020-11-12 07:21:46 +05:30
Haoran Wang 8226a30e69 Add NewProxyHandler func
Kubernetes-commit: 930cfe74087080440b1abc58d7918e2fd435377d
2021-01-04 15:58:23 +08:00
xiongzhongliang 862982a5ec cleanup: change klog.Fatalf to fmt.Errorf for kubectl auth reconcile
cleanup: change klog.Fatalf to fmt.Errorf for kubectl auth reconcile

cleanup: change klog.Fatalf to fmt.Errorf for

Kubernetes-commit: 3b3a6d27cd1a55fff173427ac9d74d35de7f5acf
2021-01-01 22:43:51 +08:00
xiongzhongliang 7222c38716 code cleanup for kubectl port-forward
code cleanup for kubectl port-forward

code cleanup for kubectl port-forward

Kubernetes-commit: 555fa97cda1f24631642698e31c2b7b55c003cca
2020-12-27 00:49:18 +08: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
xiongzhongliang 269a0a3ee5 fix typo of kubectl completion -h
Kubernetes-commit: fe094b20d2d66a28d4cfb78fcb493d213136cded
2020-12-22 16:49:39 +08:00
cpanato 1feceb70c9 add initial translation for pt_BR
Kubernetes-commit: 0697918749ad7f8997f464016f490bc1fa66a1c2
2018-03-23 13:59:35 +01:00
Sachin Kumar Singh 7259471acb Fix typos and add comments in functions for `kubectl create` subcommands
Certain missing comments and typos in comments are fixed in the files
that implement `kubectl create` subcommands.

Kubernetes-commit: 1c5c8601e479cc3b32809868c250aeb256796484
2020-12-02 03:35:34 +05:30