Bug 1462662 - Incorrect behaviour of OpenShift client inside a container.
Incorrect behaviour of OpenShift client inside a container.
Status: NEW
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.4.0
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Fabiano Franz
Xingxing Xia
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-19 04:25 EDT by Alexander Koksharov
Modified: 2017-06-20 10:18 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alexander Koksharov 2017-06-19 04:25:34 EDT
Description of problem:
oc command is ignoring/misuse "-n <namespace>" option when is executed rfrom within a container.

Environment:
- container is running under serviceaccount which have cluster-admin role assigned.
- container is created from an image which has oc client installed

Issue:
- container is running in "cake" namespace
- do rsh to a contaner

- initially current project is not set:
bash-4.2# ./oc  project   
No project has been set. Pass a project name to make that the default.

- When checking project default namespace, Objects from "cake" namespace are returned. This is a namespace where current container lives. So, '-n' option is ignored.
bash-4.2# ./oc get all -n default
NAME             TYPE      FROM         LATEST
bc/hello-world   Source    Git@master   3

NAME                   TYPE      FROM          STATUS                               STARTED       DURATION
builds/hello-world-1   Source    Git@ad345b5   Failed (PushImageToRegistryFailed)   13 days ago   1m47s
builds/hello-world-2   Source    Git@ad345b5   Complete                             13 days ago   1m27s
builds/hello-world-3   Source    Git@ad345b5   Failed (PushImageToRegistryFailed)   3 days ago    1m15s

NAME             DOCKER REPO                            TAGS      UPDATED
is/hello-world   172.30.236.171:5000/cake/hello-world   latest    13 days ago

NAME             REVISION   DESIRED   CURRENT   TRIGGERED BY
dc/hello-world   10         1         1         config,image(hello-world:latest)

NAME                DESIRED   CURRENT   READY     AGE
rc/hello-world-1    0         0         0         13d
rc/hello-world-10   1         1         1         3d
rc/hello-world-2    0         0         0         13d
rc/hello-world-3    0         0         0         13d
rc/hello-world-4    0         0         0         13d
rc/hello-world-5    0         0         0         13d
rc/hello-world-6    0         0         0         13d
rc/hello-world-7    0         0         0         13d
rc/hello-world-8    0         0         0         13d
rc/hello-world-9    0         0         0         12d

NAME                 HOST/PORT                       PATH      SERVICES      PORT       TERMINATION   WILDCARD
routes/hello-world   hello-world-cake.apps.lex.lab             hello-world   8080-tcp                 None

NAME              CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
svc/hello-world   172.30.173.69   <none>        8080/TCP   13d

NAME                      READY     STATUS    RESTARTS   AGE
po/hello-world-10-6pd7p   1/1       Running   0          3d
po/hello-world-3-build    0/1       Error     0          3d
bash-4.2#

- Set project explicitly.
bash-4.2# ./oc project cake
Now using project "cake" on server "https://172.30.0.1:443".

- Now, when checking default namespace, objects from default namespace are returned. Current project is 'cake' but '-n' option is taken into account.
bash-4.2# ./oc get all -n default
NAME                  DOCKER REPO                                    TAGS      UPDATED
is/registry-console   172.30.236.171:5000/default/registry-console   3.5       2 weeks ago

NAME                  REVISION   DESIRED   CURRENT   TRIGGERED BY
dc/docker-registry    1          1         1         config
dc/registry-console   1          1         1         config
dc/router             1          2         2         config

NAME                    DESIRED   CURRENT   READY     AGE
rc/docker-registry-1    1         1         1         19d
rc/registry-console-1   1         1         1         19d
rc/router-1             2         2         2         19d

NAME                      HOST/PORT                               PATH      SERVICES           PORT      TERMINATION   WILDCARD
routes/docker-registry    docker-registry-default.apps.lex.lab              docker-registry    <all>     passthrough   None
routes/registry-console   registry-console-default.apps.lex.lab             registry-console   <all>     passthrough   None

NAME                   CLUSTER-IP       EXTERNAL-IP   PORT(S)                   AGE
svc/docker-registry    172.30.236.171   <none>        5000/TCP                  19d
svc/kubernetes         172.30.0.1       <none>        443/TCP,53/UDP,53/TCP     19d
svc/registry-console   172.30.147.237   <none>        9000/TCP                  19d
svc/router             172.30.148.22    <none>        80/TCP,443/TCP,1936/TCP   19d

NAME                          READY     STATUS    RESTARTS   AGE
po/docker-registry-1-9051x    1/1       Running   0          5h
po/registry-console-1-bf6lt   1/1       Running   0          5h
po/router-1-dq5t0             1/1       Running   0          5h
po/router-1-spdcg             1/1       Running   0          13h
bash-4.2#


Version-Release number of selected component (if applicable):
3.4
3.5

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Note You need to log in before you can comment on or make changes to this bug.