• bjhaid's avatar
    Opt out of chowning and chmoding from kubectl cp. · 44bed94f
    bjhaid authored
    `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
    ```
    44bed94f
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
docs Loading commit data...
hack Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
staging Loading commit data...
test Loading commit data...
third_party Loading commit data...
translations Loading commit data...
vendor Loading commit data...
.bazelrc Loading commit data...
.generated_files Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.kazelcfg.json Loading commit data...
BUILD.bazel Loading commit data...
CHANGELOG-1.10.md Loading commit data...
CHANGELOG-1.11.md Loading commit data...
CHANGELOG-1.12.md Loading commit data...
CHANGELOG-1.2.md Loading commit data...
CHANGELOG-1.3.md Loading commit data...
CHANGELOG-1.4.md Loading commit data...
CHANGELOG-1.5.md Loading commit data...
CHANGELOG-1.6.md Loading commit data...
CHANGELOG-1.7.md Loading commit data...
CHANGELOG-1.8.md Loading commit data...
CHANGELOG-1.9.md Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.generated_files Loading commit data...
OWNERS Loading commit data...
OWNERS_ALIASES Loading commit data...
README.md Loading commit data...
SECURITY_CONTACTS Loading commit data...
SUPPORT.md Loading commit data...
WORKSPACE Loading commit data...
code-of-conduct.md Loading commit data...