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