Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kube config flow #562

Merged
merged 2 commits into from
Jun 14, 2022
Merged

Fix kube config flow #562

merged 2 commits into from
Jun 14, 2022

Conversation

olexii4
Copy link
Contributor

@olexii4 olexii4 commented Jun 13, 2022

Signed-off-by: Oleksii Orel oorel@redhat.com

What does this PR do?

Fix kube config flow

What issues does this PR fix or reference?

fixes eclipse-che/che#21454

Is it tested? How?

  1. Deploy Eclipse CHE
  2. Create a new workspace from one of the samples.
  3. config file should be in ~/.kube/
$ ls ~/.kube/

You can test it with https://eclipse-che.apps.cluster-k865s.k865s.sandbox811.opentlc.com

Signed-off-by: Oleksii Orel <oorel@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Jun 13, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@che-bot
Copy link
Contributor

che-bot commented Jun 13, 2022

Click here to review and test in web IDE: Contribute

@codecov
Copy link

codecov bot commented Jun 13, 2022

Codecov Report

Merging #562 (923b659) into main (f6cb102) will increase coverage by 0.08%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #562      +/-   ##
==========================================
+ Coverage   56.14%   56.23%   +0.08%     
==========================================
  Files         216      217       +1     
  Lines        7385     7375      -10     
  Branches     1262     1265       +3     
==========================================
+ Hits         4146     4147       +1     
+ Misses       3060     3049      -11     
  Partials      179      179              
Flag Coverage Δ
unittests 56.23% <0.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ontend/src/store/Workspaces/devWorkspaces/index.ts 9.19% <0.00%> (-0.10%) ⬇️
packages/dashboard-frontend/src/Layout/index.tsx 0.00% <0.00%> (ø)
...ges/dashboard-frontend/src/store/Branding/index.ts 0.00% <0.00%> (ø)
...s/dashboard-frontend/src/services/helpers/login.ts 50.00% <0.00%> (ø)
...rd-frontend/src/services/workspace-client/index.ts 31.03% <0.00%> (+5.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6cb102...923b659. Read the comment docs.

@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-562

@olexii4 olexii4 requested review from ibuziuk and l0rd June 13, 2022 22:57
@olexii4 olexii4 marked this pull request as ready for review June 13, 2022 22:58
@olexii4 olexii4 requested a review from akurinnoy as a code owner June 13, 2022 22:58
@olexii4 olexii4 changed the title [wip] Fix kube config flow Fix kube config flow Jun 14, 2022
Copy link
Member

@ibuziuk ibuziuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested locally against dogfooding and there is one thing I can not grok:

bash-4.4$ cat ~/.kube/config 
{"apiVersion":"v1","kind":"Config","clusters":[{"name":"api-che-dev-x6e0-p1-openshiftapps-com:6443","cluster":{"server":"https://api.che-dev.x6e0.p1.openshiftapps.com:6443","insecure-skip-tls-verify":false}}],"users":[{"name":"developer","user":{"token":"<token>"}}],"contexts":[{"name":"logged-user","context":{"user":"developer","cluster":"api-che-dev-x6e0-p1-openshiftapps-com:6443","name":"logged-user"}}],"preferences":{},"current-context":"logged-user"}
bash-4.4$ oc whoami
ibuziuk

Basically, oc whoami reports the right user, but the kube config file refers to the developer user. wondering if this is expected? Basically, the token that is injected in file is the correct one and belongs to my user, but it is a bit strange to see the developer reference.

@ibuziuk
Copy link
Member

ibuziuk commented Jun 14, 2022

@akurinnoy thanks for the pointer https://github.com/eclipse-che/che-dashboard/blob/main/packages/dashboard-backend/src/services/kubeclient/kubeConfigProvider.ts#L39-L46

looks like the logic for retrieving the username is failing atm. Can be fixed in a separate PR though

Copy link
Member

@ibuziuk ibuziuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
the problem with username detection can be fixed in a separate PR I believe. I think we should not fall back on token itself for username since it is a sha256 one-way hash that can not be decrypted.

Signed-off-by: Oleksii Orel <oorel@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm label Jun 14, 2022
@che-bot
Copy link
Contributor

che-bot commented Jun 14, 2022

Click here to review and test in web IDE: Contribute

@openshift-ci openshift-ci bot added the lgtm label Jun 14, 2022
@openshift-ci
Copy link

openshift-ci bot commented Jun 14, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: akurinnoy, ibuziuk, olexii4

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-562

@openshift-ci
Copy link

openshift-ci bot commented Jun 14, 2022

@olexii4: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v8-dashboard-happy-path 7e35534 link true /test v8-dashboard-happy-path

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@olexii4 olexii4 merged commit a3c3dad into main Jun 14, 2022
@olexii4 olexii4 deleted the CHE-21454 branch June 14, 2022 12:08
@che-bot che-bot added this to the 7.49 milestone Jun 14, 2022
@l0rd
Copy link
Contributor

l0rd commented Jun 14, 2022

Thanks @olexii4 for the rapid fix. I am not sure if it's even necessary to get the right username. It looks like the only important thing is the token anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kube context is not added at workspace startup
5 participants