Although `kubectl attach POD_NAME <tab>` completes container name,
kubectl attach needs `-c` option so the command causes error as:
```
$ kubectl attach nginx-7cdbd8cdc9-b5rhr nginx
error: the server doesn't have a resource type "nginx-7cdbd8cdc9-b5rhr"
```
This patch changes the completion to the same way as `kubectl exec`.
The filename can overlap when multiple resources have the same name (but
obviously are of a different type). Include the name of the type in the
file name to prevent the overlap.
There is currently a race-condition when diffing, where we get the
object and then run a server-side dry-run patch and compare the two
results. If something changes the object on the server between the get
and the patch, the diff is going to show unrelated changes. We can now
specify the exact revisionversion that we want to patch, and that will
return a conflict, and we can retry multiple times to get a
non-conflicting diff. Eventually (after 3 times), we diff without
checking the version and throw a warning that the diff might be
partially wrong.
Give a new "ResourceVersion" option to the patch so that the patch can
be forced against a specific version. Also there is no way to customize
how many retries the patcher should do on conflicts, so also add a
"Retries" option that let's one customize it.
Makes dry-run output match what would happen when running in non dry-run mode.
Objects would only get added to visitedUids if running in non dry-run mode.
visitedUids is used by prune() to know if an action should be taked on the item or not.
Fixes#67863
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
* github.com/kubernetes/repo-infra
* k8s.io/gengo/
* k8s.io/kube-openapi/
* github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods
Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
- Fix some golint errors for `pkg/kubectl`
- Fix a golint error for `pkg/kubectl/apps`
- Fix all golint errors for `pkg/kubectl/cmd`
- Fix some golint errors for `pkg/kubectl/generate/versioned`
- Fix a golint error for `pkg/kubectl/generate`
- Fix some golint errors for `pkg/kubectl/metricsutil`
- Fix all golint errors for `pkg/kubectl/util`
- Fix all golint errors for `pkg/kubectl/util/slice`
This patch allows the `kubectl plugin list` command to display discovered
plugin paths in the same order as they appear in a user's PATH.
Prior to this patch, discovered plugin paths were sorted before being
displayed.
Additionally, any errors encountered while reading from any directory in a
user's PATH will now be printed to stderr at the end of the command's
output.
The closing bracket in the link was automatically included in the link HREF.
Myself and @lurraca used standard markdown formatting to prevent that from happening.
`kubectl cp` relies on tar to extract the copied file/directory in the
container, tar by default attempts to chown/chmod the extracted file
after extraction if the user is the "superuser"(root)
```
--same-owner
try extracting files with the same ownership as exists in the archive
(default for superuser)
-p, --preserve-permissions, --same-permissions
extract information about file permissions (default for superuser)
```
This fails in environment where the container runs as root but is not
granted the OWNER or CHOWN capability.
Before this patch below was the behavior of `kubectl cp`
```
kubectl cp README.md foo-67b6fcbd4c-qjlt6:/tmp
tar: README.md: Cannot change ownership to uid 1000, gid 1000: Operation
not permitted
tar: Exiting with failure status due to previous errors
command terminated with exit code 2
kubectl exec -it foo-67b6fcbd4c-qjlt6 -- ls -l /tmp/README.md
-rw------- 1 1000 1000 3179 Oct 7 22:00 /tmp/README.md
```
After this patch
```
kubectl cp -x a foo-67b6fcbd4c-qjlt6:/
kubectl exec -it foo-67b6fcbd4c-qjlt6 -- ls -l /tmp/README.md
-rw-r--r-- 1 root root 3179 Oct 7 22:00 /tmp/README.md
```
The dependency on printers/internalversion was causing kubectl/scheme
to have defaulters registered, which should not be the case. Remove
defaults from the test.
pkg/kubectl has a lot of files. Move everything generator related
into pkg/kubectl/generate (generic) or pkg/kubectl/generate/versioned
(type specific).
Move the DescriberFn and GeneratorFn out of kubectl/cmd/util and into
the respective versioned packages, along with tests.
Adds an extra check condition for "." in stripPathShortcuts
so that an empty string is returned, and the correct prefix
index is used untarAll when generating path names.
Resolves: #69804.