Commit Graph

1105 Commits

Author SHA1 Message Date
Marcus Puckett 97f6de2e3a Add line to describe output for IngressClassName
Kubernetes-commit: cfacaf086a70a9513826cb4b5194412e61be477b
2022-02-02 11:16:39 -08:00
Marcus Puckett 23ee230608 Remove annoying sprintf warning
Kubernetes-commit: 517a0b0818e35a4b85fabd171f510da5b4e42549
2022-02-02 11:06:05 -08:00
Jordan Liggitt 344e97b543 Add command to request a bound service account token
Kubernetes-commit: fca9b1d9fcc7288ecb93c969ff9907a5def2dc9e
2022-01-31 11:46:50 -05:00
Jack 5fb22b2ab8 RunCordonOrUncordon error if drainer has nil Ctx or Client
Kubernetes-commit: ee02f5ddc42a67166c91e539fe98cc6541db668e
2021-09-27 14:20:24 -07:00
Bronson Mirafuentes 1d62bce235 wrap error from RunCordonOrUncordon
Kubernetes-commit: 297432f0e92479cfbb62d182d9d20c1833a3521c
2022-01-25 10:34:47 -08:00
Arda Güçlü 119abb31f8 Add manually invalidate cache documentation into delete
When CRDs are deleted, discovery local cache is not invalidated.
This brings about `resource not found` error when new CRD with same name is created
with different fields(ie. changing scope from cluster-wide to namespaced).
Because this already deleted CRD still stays in serverresources.json and kubectl tries to use it.

This local cached files have 10 minutes TTL. After deletion, if user waits 10 minutes,
files will be expired and deleted and there will be no errors. However, 10 minutes is a long time
and cache needs to be invalidated after deletion occurs.

This PR adds a document into delete command by noting that there might be a need to invalidate discovery
cache when CRD is deleted. In addition to that this PR adds a test to catch this behavior.

Kubernetes-commit: 43d8b3459baec794c8a3a858c04f1562a09886a3
2021-12-21 11:53:09 +03:00
Aram Peres 8e80d8fd7e Cleanup kubectl label selectors with 'cmdutil.AddLabelSelectorFlagVar'
Kubernetes-commit: 8f8138bc35f59ef04b77a3520d8d1065603ccdb7
2022-01-06 23:28:44 -05:00
ncapps 9f0231784c Update label selector message to clarify that constraints use AND operator
Kubernetes-commit: 62baa0af4c995cdf401339bfb92d6ae172fe5c6d
2022-01-07 17:25:17 +00:00
Sebastian Laskawiec cd508979c1 Fix printing control character in kubectl explain
Kubernetes-commit: e4dbaef3ccbd88d9e65befd8d0d666a793509ea2
2022-01-20 15:04:15 +01:00
astraw99 7f5c2f206a fix label msg
Kubernetes-commit: 83fe357f3e45423662f461f7cfd66bb18c122d33
2022-01-20 10:56:46 +08:00
brianpursley 24505ed13a Upgrade Cobra from 1.2.1 to 1.3.0 to fix a bug where bash completions don't work when the kubectl command uses the --context flag to specify a context that contains a colon
Kubernetes-commit: 64fac6cf49839ba058345dc471f038e5008a05f1
2022-01-12 10:37:13 -05:00
Davanum Srinivas 95fca74e1d OWNERS cleanup - Jan 2021 Week 1
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9682b7248fb69733c2a0ee53618856e87b067f16
2022-01-03 10:59:47 -05:00
Philip Hamer b11bd1ffd7 add test case for issue 106277 (PR 106268) (#106532)
* add test case for issue 106277 - fix edit of non-registered custom API types

* remove unneeded struct, as suggested

Kubernetes-commit: ea2dff12e6df93ac27684707ea48f7781eb669b5
2022-01-12 01:49:19 +00:00
Kebe d100fd0cee Add completion for
Kubernetes-commit: a57e6c892448f0ef21d7af551170773b57e8b397
2021-11-30 18:20:05 +08:00
Tobias Klauser 7b07391a3a kubectl: remove unnecessary fmt.Sprintf
Directly use the %#v verb in fmt.Fprintf instead.

Kubernetes-commit: 169f1845fc29a9002645e0a4df9489fee1ae7128
2021-11-04 13:45:47 +01:00
Jian Li 3f7abd9859 cmd/kubectl: make 'kubectl logs' default to the first container when default container cannot be determined or found by annotations (#105964)
* cmd/kubectl: make 'kubectl logs' default to the first container.

While running 'kubectl logs <pod>', If '-c' is omited and the pod has more than one container, and no default container can be determined from annotations, this command shows an error message and exits. With this fix, it defaults to the first container in such scenarios and show its logs. This aligns behavior with what 'kubectl exec' does currently, and is more in line with KEP SIG-CLI 2227 design.

* fix unit test(forgotten)

* fix spelling typo

Kubernetes-commit: 0977a5d7cda59d5bd324bf2730846905e072fbbf
2022-01-07 09:40:41 +08:00
Aram Peres 22a27cb97d Add label selector in 'kubectl rollout' commands
Kubernetes-commit: 5a5ac86a80464019e3e85d57306156839511d397
2022-01-06 16:53:29 -05:00
W. Trevor King cdcb6ed356 kubectl: Document --for's Unicode case-folding condition-value comparison
When the wait command was added in 76794643c5 (add wait, 2018-05-18, #64034),
this comparison was via ToLower.  It moved to use Unicode case folding
[1,2] in f4940cf55f (Staticcheck:
vendor/k8s.io/kubectl/pkg/scale|describe/versioned|cmd/top|cmd/util/editor|cmd/top,
2020-01-21, #87403).

[1]: https://pkg.go.dev/strings#EqualFold
[2]: http://www.unicode.org/reports/tr30/tr30-1.html

Kubernetes-commit: f69d52338b21da938021af37f49f49a83016534d
2021-08-30 19:41:08 -07:00
Paul Barfuss 0208a3ee09 Replace hardcoded kubectl with kubectl.Name()
Kubernetes-commit: 77be26c3b83dd28be450c8790ecee823750f9a8c
2021-12-10 15:58:52 -05:00
Paul Barfuss 9b4102b899 kubectl: fix hard-coded value in zsh completion
Kubernetes-commit: 339c361ca0156cbf2be5aa64f52a0afd332f5708
2021-12-07 15:13:39 -05:00
Ricardo Katz 36401bb108 fix nil pointer in create secret commands
Kubernetes-commit: 50015c2da621ecaee581f64f737aa2e527905f14
2021-12-25 21:24:21 -03:00
Jonny Langefeld a8accff4dc Fix default config flags
This is a follow up to #105520 which only changed the new default config flags in the `NewKubectlCommand` function if `kubeConfigFlags == nil`. However they are not nil because they were initialized before here:
2fe968deb6/staging/src/k8s.io/kubectl/pkg/cmd/cmd.go (L97)

This fix uses the same defaults for both functions

Signed-off-by: Jonny Langefeld <jonny.langefeld@gmail.com>

Kubernetes-commit: c4fbd35cf4bdc76b86dd74e468b69328f5aa20f9
2021-12-19 19:59:46 -08:00
Ross Peoples 88ea823a7a Allow create.specialVerbs to be customized
Kubernetes-commit: 9b2f24aee0668ef54e7f51acc79e51b93f1aedb3
2021-12-16 13:08:28 -06:00
Arda Güçlü f6fcb7d932 Enable setting proxyurl in kubeconfig via kubectl config (#105566)
* Enable setting proxyurl in kubeconfig via kubectl config

This PR enables setting `proxy-url` in kubeconfig via kubectl config.

* Add godoc for proxy-url unit tests

Kubernetes-commit: afdde383210294c3da573decc44b5ce55cffcb94
2021-12-20 21:54:05 +00:00
Ross Peoples 866baec66e Allow custom img resolver and flags for set image
Kubernetes-commit: 2f56584853355c0ab16e5ad2b0195d8dfcd7dc6b
2021-12-16 14:06:46 -06:00
sunzhaochang 16d7d99cc5 Add Close() for profile
Kubernetes-commit: 82c9d80295451dad4b9a5af89f34bb56b3a9904b
2021-12-15 21:03:34 +08:00
Julian V. Modesto 5c9b92b57c Re-introduce removed kubectl --dry-run values.
For 1.23, we removed the kubectl `--dry-run` empty default value (`--dry-run`)
and boolean values (`--dry-run=true` and `--dry-run=false`). This change
required requiring users to specify `--dry-run=client` or `--dry-run=server`
due to a deprecation. This change was made in #105327.

After reconsideration, this change is not worth the churn for users.
It's likely that many users rely on these values for automated and manual use
cases.

This change reverts #105327 and re-introduces the values `--dry-run`,
`--dry-run=true`, and `--dry-run=false`.

Kubernetes-commit: cc4998b2b131ca9906b847600bd5ad3be70eff3a
2021-12-13 15:04:49 -05:00
Arda Güçlü ab3928acd9 Refactor diff/prune
This PR does some refactors for diff/prune;

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

Kubernetes-commit: 6c449dd272c95f2aeb3bb77e67d312d8df21bd62
2021-11-08 11:22:10 +03:00
Arda Güçlü 2d0f4303f1 Get object name correctly for pruned resources
Kubernetes-commit: a19bd5e47436c1f0a2aea20c4a992da18f8ba480
2021-10-06 17:01:19 +03:00
Arda Güçlü 292510bc0b Add pruner constructor, tweak DiffOptions
Kubernetes-commit: 05100c0e49328cd149e96aa78fefc91c8c97ffee
2021-09-30 11:26:40 +03:00
Arda Güçlü eee66ad171 Add boilerplate header into util/prune
Kubernetes-commit: f4861725c9a8494481093d30a5f6e07f7ab8f2d7
2021-09-29 12:20:38 +03:00
Arda Güçlü 3f914a34f1 Add new unit tests for diff/prune
Kubernetes-commit: 17de414905fb3463ec17ec63f40180fa09965d98
2021-09-24 09:40:26 +03:00
Arda Güçlü ff5d018049 Introduce new prune parameter into diff command
This PR introduces new prune and it's dependent parameters to simulate
`kubectl apply --prune` command.

Kubernetes-commit: 56c19f1056ad6d4a4bb926fe90e37f56a31c4e2f
2021-09-17 15:27:21 +03:00
Davanum Srinivas 12c6b0404d Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9405e9b55ebcd461f161859a698b949ea3bde31d
2021-12-09 21:31:26 -05:00
haoyun 343b5260f3 fix: combine assertion prevent npe
Signed-off-by: haoyun <yun.hao@daocloud.io>

Kubernetes-commit: 84a7329cf07b468ea47fd0617e6fdb9bdb174937
2021-12-01 16:37:24 +08:00
Andrea Hoffer d6145c119b Adding an example for kubectl plugin list
Kubernetes-commit: f5612f100ef6a61dcc29ca783571e2b3c171abf1
2021-11-22 13:21:21 -05:00
Sergey Kanzhelev 8f510212ee Merge pull request #106463 from SergeyKanzhelev/grpcProbe
Implement grpc probe action

Kubernetes-commit: e4952f32b79b69bfa9333ff9da26a2da13859148
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-12-02 20:40:51 -05:00
Antonio Ojea 6dd58defe1 remove inefficient assignment
Kubernetes-commit: e1821c13ebf78ac6e022948aa9415d9cc0b28a77
2021-11-16 19:00:51 +01:00
Antonio Ojea 476fa148b6 fix ineffectual assignment to i (ineffassign)
Kubernetes-commit: b2971e74970f241e138c93f5e755aa2980ab13ed
2021-11-16 18:08:27 +01:00
Maciej Szulik 691bf81946 Allow changing discovery QPS with cli-runtime
Kubernetes-commit: 2fe968deb6cef4feea5bd0eb435e71844e397eed
2021-11-16 22:27:33 +01:00
Maciej Szulik ca7662ebb5 Bump discovery burst for kubectl
Kubernetes-commit: e944d2c365af0d2d2784dd8f71f90ca5bd0cdbc9
2021-11-16 22:26:32 +01:00
Daniel Lipovetsky 8e82388f5f Include Conditions in `kubectl describe namespace`
If a namespace deletion is blocked, finding the reason why can require
reading the Conditions on the namespace.

Currently, `kubectl describe namespace` does not include Conditions.
This change adds Conditions to the output. Example output:

```
Name:         example
Labels:       <none>
Annotations:  <none>
Status:	      Terminating
Conditions:
  Type                             Status  LastTransitionTime               Reason          Message
  ----                             ------  ------------------               ------          -------
  NamespaceDeletionContentFailure  True    Wed, 15 Jan 2014 00:00:00 +0000  example reason  example message

No resource quota.

No LimitRange resource.
```

Kubernetes-commit: eb6e8ce00a39c1c98146f3341f4336b90757ab13
2021-11-07 21:39:56 -08: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
Patrick Ohly dc8558e8e5 kubectl: add deprecation notice to flag usage help
Several klog flags were deprecated in Kubernetes 1.23, but that was not visible
in "kubectl options" because it does its own formatting without considering a
flag's deprecation string.

Now the output looks like this:

$ go run ./cmd/kubectl options
The following options can be passed to any command:

      --add-dir-header=false: If true, adds the file directory to the header of the log messages (DEPRECATED: will be
removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --alsologtostderr=false: log to standard error as well as files (DEPRECATED: will be removed in a future release,
see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --as='': Username to impersonate for the operation. User could be a regular user or a service account in a
namespace.
      --as-group=[]: Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --cache-dir='/home/pohly/.kube/cache': Default cache directory
      --certificate-authority='': Path to a cert file for the certificate authority
      --client-certificate='': Path to a client certificate file for TLS
      --client-key='': Path to a client key file for TLS
      --cluster='': The name of the kubeconfig cluster to use
      --context='': The name of the kubeconfig context to use
      --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will
make your HTTPS connections insecure
      --kubeconfig='': Path to the kubeconfig file to use for CLI requests.
      --log-backtrace-at=:0: when logging hits line file:N, emit a stack trace (DEPRECATED: will be removed in a future
release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-dir='': If non-empty, write log files in this directory (DEPRECATED: will be removed in a future release,
see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-file='': If non-empty, use this log file (DEPRECATED: will be removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-file-max-size=1800: Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0,
the maximum file size is unlimited. (DEPRECATED: will be removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-flush-frequency=5s: Maximum number of seconds between log flushes
      --logtostderr=true: log to standard error instead of files (DEPRECATED: will be removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --match-server-version=false: Require server version to match client version
  -n, --namespace='': If present, the namespace scope for this CLI request
      --one-output=false: If true, only write logs to their native severity level (vs also writing to each lower
severity level) (DEPRECATED: will be removed in a future release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --password='': Password for basic authentication to the API server
      --profile='none': Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex)
      --profile-output='profile.pprof': Name of the file to write the profile to
      --request-timeout='0': The length of time to wait before giving up on a single server request. Non-zero values
should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
  -s, --server='': The address and port of the Kubernetes API server
      --skip-headers=false: If true, avoid header prefixes in the log messages (DEPRECATED: will be removed in a future
release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --skip-log-headers=false: If true, avoid headers when opening log files (DEPRECATED: will be removed in a future
release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --stderrthreshold=2: logs at or above this threshold go to stderr (DEPRECATED: will be removed in a future
release, see
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --tls-server-name='': Server name to use for server certificate validation. If it is not provided, the hostname
used to contact the server is used
      --token='': Bearer token for authentication to the API server
      --user='': The name of the kubeconfig user to use
      --username='': Username for basic authentication to the API server
  -v, --v=0: number for the log level verbosity
      --vmodule=: comma-separated list of pattern=N settings for file-filtered logging
      --warnings-as-errors=false: Treat warnings received from the server as errors and exit with a non-zero exit code

For comparison, pflag itself prints:

$ go run ./cmd/kubelet --help 2>&1 | grep -e --log-file
      --log-file string                                          If non-empty, use this log file (DEPRECATED: will be removed in a future release, see https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)
      --log-file-max-size uint                                   Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800) (DEPRECATED: will be removed in a future release, see https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components)

Kubernetes-commit: 21bd4ae18b5a146c8ef6dff373732abdecf60d66
2021-11-05 09:34:25 +01:00
Philip Hamer 7da3d10e34 fix edit of non-registered custom API types
Kubernetes-commit: e07a6c9e523c11509f3264ad1ef2ea381709a29c
2021-11-09 10:06:03 -05:00
Chok Yip Lau 8d1dfaeedb Added JSONPath wait for kubectl wait
Co-authored-by: Eddie Zaneski <eddiezane@gmail.com>

Kubernetes-commit: 8fcf98ec3bb16ddf32ea1688752e6b7e2a14eaa4
2021-10-04 16:19:08 -04:00
Maciej Szulik 19d74f894c Switch from arguments to an input structure for kubectl command
Kubernetes-commit: baab99d04cd4c4314525e19c14ec85a072161cb1
2021-11-04 16:29:08 +01:00
Maciej Szulik d89f23e807 Allow providing wrapper for client config
Kubernetes-commit: c5aea015c30735b0e64f8bbd41acd811782c1fe5
2021-11-04 16:14:27 +01:00
Matthias Bertschy 68250fd482 add option to make kubectl cp resume on errors
Kubernetes-commit: 00b528cdf42ae4c1771f3a51c557a1f289701113
2021-09-06 10:04:15 +02:00
Chok Yip Lau aed179d9d5 Fixed nil pointer dereference
Kubernetes-commit: c337857673e60a44bbdbef9afcbce5b0245b81ec
2021-11-10 12:41:39 -05:00
yylt 0198d9185e Fix edit command
Kubernetes-commit: 2ae37c8046128e0191ec96c8b31361ae894f2330
2021-10-21 20:07:38 +08:00
Sai Harsha Kottapalli 8165f83007 Refactor Apply cmd to split flags from options (#102240)
* Refactor Apply cmd to split flags from options

* refactor code

* fix subcommands

Kubernetes-commit: 17919b184153b2d123a7c75f5b0dc7e486a724db
2021-11-08 17:17:08 +00:00
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