Bug 1963784

Summary: oc project not works with cluster proxy
Product: OpenShift Container Platform Reporter: OpenShift BugZilla Robot <openshift-bugzilla-robot>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.8CC: aos-bugs, haowang, jokerman, mfojtik
Target Milestone: ---Keywords: ServiceDeliveryImpact
Target Release: 4.7.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Not all options from config were copied when switching projects. Consequence: When using proxy through Exec configuration in kubeconfig that information was lost during project switch. Fix: Copy all the necessary information when switching projects. Result: oc project works when using proxy.
Story Points: ---
Clone Of:
: 1973613 (view as bug list) Environment:
Last Closed: 2021-07-06 11:38:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1944581    
Bug Blocks: 1973613    

Comment 4 zhou ying 2021-06-25 07:54:00 UTC
Checked with the latest oc client, the issue has fixed:

[root@localhost ~]#  oc projects
You have access to the following projects and can switch between them with ' project <projectname>':

    zhouyt
  * zhouyt2

Using project "zhouyt2" on server "https://api.jwei.qe.devcluster.openshift.com:6443".
[root@localhost ~]#  oc project zhouyt
Now using project "zhouyt" on server "https://api.jwei.qe.devcluster.openshift.com:6443".
[root@localhost ~]# cat /root/.kube/config 
apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://api.jwei.qe.devcluster.openshift.com:6443
  name: api-jwei-qe-devcluster-openshift-com:6443
contexts:
- context:
    cluster: api-jwei-qe-devcluster-openshift-com:6443
    user: testuser-39/api-jwei-qe-devcluster-openshift-com:6443
  name: /api-jwei-qe-devcluster-openshift-com:6443/testuser-39
- context:
    cluster: api-jwei-qe-devcluster-openshift-com:6443
    namespace: zhouyt
    user: testuser-39/api-jwei-qe-devcluster-openshift-com:6443
  name: zhouyt/api-jwei-qe-devcluster-openshift-com:6443/testuser-39
- context:
    cluster: api-jwei-qe-devcluster-openshift-com:6443
    namespace: zhouyt2
    user: testuser-39/api-jwei-qe-devcluster-openshift-com:6443
  name: zhouyt2/api-jwei-qe-devcluster-openshift-com:6443/testuser-39
current-context: zhouyt/api-jwei-qe-devcluster-openshift-com:6443/testuser-39
kind: Config
preferences: {}
users:
- name: testuser-39/api-jwei-qe-devcluster-openshift-com:6443
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - /root/.kube/my-token
      command: bash
      env: null
      provideClusterInfo: false
[root@localhost ~]# oc version --client 
Client Version: 4.7.0-202106232349.p0.git.3ac4b96-3ac4b96

Comment 7 errata-xmlrpc 2021-07-06 11:38:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.7.19 bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:2554