This commit teaches the shell completion logic how to handle the
<type>/<name> form for resource specification.
It also teaches the 'exec' command how to complete its '--container/-c'
flag using container names.
Also, for commands that work on pods, kubectl will now also suggest
completion choices of the form <type>/<name> for resource types that
contain pods (see below for more details).
The following commands can now have completion of the <type>/<name>
form. Commands that accept any resource type:
annotate
apply edit-last-applied
apply view-last-applied
delete
describe
edit
get
label
patch
Commands that accept a subset of resource types:
autoscale
expose
rollout history
rollout pause
rollout restart
rollout resume
rollout status
rollout undo
scale
taint
Commands that apply to resource types that contain pods:
attach
exec
logs
port-foward
For these last four commands, the possible resource types are now
included in the completion choices. For example:
kubectl exec d<TAB>
will suggest
daemonsets/ deployments/
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
Kubernetes-commit: cf66f5c3cbd0a0e2f223af438ee4c6bc7e4a907c
Bump client_golang to v1.12.1 to fix a concurrency issue in the Go
Collector that was introduced by the library in v1.12.0.
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
Kubernetes-commit: 7f3f8d25c856e3075d8526dc918ca0965bd4ffae
When it initially landed in kubernetes/kubernetes@c6e9ad066e (Initial
node drain implementation for #3885, 2015-08-30,
kubernetes/kubernetes#16698), the drain logic looked in a created-by
annotation for recognized kinds [1], so listing the set of recognized
kinds was a clear approach.
Sometime later, the source moved into ownerReferences, but the
hard-coded set of recognized controller kinds remained.
When kubernetes/kubernetes@2f1108451f (Remove hard-coded
pod-controller check, 2017-12-05, kubernetes/kubernetes#56864) removed
the hard-coded set of recognized controller kinds, it should have also
updated these messages to remove stale references to the previous
hard-coded values. This commit catches the message strings up with
that commit.
[1]: c6e9ad066e (diff-211259b8a8ec42f105264c10897dad48029badb538684e60e43eaead68c3d219R216)
Kubernetes-commit: 587f4f04cc5fc18f4e85ed6a4a06bbf1bfee0496
Some of these changes are cosmetic (repeatedly calling klog.V instead of
reusing the result), others address real issues:
- Logging a message only above a certain verbosity threshold without
recording that verbosity level (if klog.V().Enabled() { klog.Info... }):
this matters when using a logging backend which records the verbosity
level.
- Passing a format string with parameters to a logging function that
doesn't do string formatting.
All of these locations where found by the enhanced logcheck tool from
https://github.com/kubernetes/klog/pull/297.
In some cases it reports false positives, but those can be suppressed with
source code comments.
Kubernetes-commit: edffc700a43e610f641907290a5152ca593bad79
to match their kubectl config subcommand names and reflect that they
are used for setting values, not just creating.
Deprecated NewCmdConfigSetAuthInfo in favor of NewCmdConfigSetCredentials.
Did some minor refactoring of one of the complete functions to eliminate
an unused argument and not wrap returned errors that do not add detail.
Kubernetes-commit: 48007fc32bb473d1d0d7d7c24b9daa2157e433d1
ServerResources function was deprecated and instead ServerGroupsAndResources
function is suggested.
This PR removes ServerResources function and move every place to use ServerGroupsAndResources.
Kubernetes-commit: ef39a8914291ba200bd5486c88a7575ffd4b7d1d
Also runs:
hack/pin-dependency.sh golang.org/x/mod \
v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
Signed-off-by: Stephen Augustus <foo@auggie.dev>
Kubernetes-commit: 4b1bd548bbe4d71609c65b050b69f63af1ca81d1
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