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 the bug when kubeconfig file content is collapsed to one line after workspace restart #1279

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Dec 17, 2024

What does this PR do?

  1. Change the parse format from JSON to YAML as the default format of the oc and kubectl tools is YAML.
  2. Do not substring new line when fetching the kubeconfig file content.

Screenshot/screencast of this PR

What issues does this PR fix or reference?

fixes eclipse-che/che#23238

Is it tested? How?

  1. Deploy Che with the dashboard pull request image: quay.io/eclipse/che-dashboard:pr-1279
  2. Apply Persistent user home.
  3. Start a workspace, open the /home/user/.kube/config file, see that the content is YAML.
  4. Open a new terminal and oc login to a kubernetes cluster.
  5. Restart the workspace, execute oc whoami from the terminal.

See: the oc command works, the kubeconfig file is valid.

Release Notes

Docs PR

@che-bot
Copy link
Contributor

che-bot commented Dec 17, 2024

Click here to review and test in web IDE: Contribute

@olexii4
Copy link
Contributor

olexii4 commented Dec 17, 2024

@vinokurig Could you add the proper test for your changes(for the mergeKubeConfig method)?

Copy link

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

kubectl patch command
kubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1279", name: che-dashboard}]}}]"

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.

@vinokurig would it be possible to add test(s) for that ?

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 30.00000% with 14 lines in your changes missing coverage. Please review.

Project coverage is 91.80%. Comparing base (6be3790) to head (fed10a3).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...d/src/devworkspaceClient/services/kubeConfigApi.ts 31.57% 13 Missing ⚠️
...nd/src/devworkspaceClient/services/helpers/exec.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1279      +/-   ##
==========================================
+ Coverage   91.69%   91.80%   +0.10%     
==========================================
  Files         499      499              
  Lines       45651    45653       +2     
  Branches     3178     3187       +9     
==========================================
+ Hits        41860    41912      +52     
+ Misses       3760     3711      -49     
+ Partials       31       30       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vinokurig
Copy link
Contributor Author

@ibuziuk @olexii4 Added test.

@olexii4
Copy link
Contributor

olexii4 commented Dec 18, 2024

@vinokurig Could you fix the build-and-test checks, please?

Copy link

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

kubectl patch command
kubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1279", name: che-dashboard}]}}]"

Copy link
Contributor

@olexii4 olexii4 left a comment

Choose a reason for hiding this comment

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

LGTM

@artaleks9
Copy link
Contributor

Verified on Eclipse Che with quay.io/eclipse/che-dashboard:pr-1279 - the functionality works properly

Copy link

openshift-ci bot commented Dec 19, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@vinokurig vinokurig merged commit 1790beb into main Dec 19, 2024
21 of 22 checks passed
@vinokurig vinokurig deleted the che-23230 branch December 19, 2024 12:16
@devspacesbuild
Copy link

Build 3.19 :: dashboard_3.x/607: Console, Changes, Git Data

@devspacesbuild
Copy link

@devspacesbuild
Copy link

@devspacesbuild
Copy link

Build 3.19 :: get-sources-rhpkg-container-build_3.x/8442: FAILURE

dashboard : 3.x :: Failed in : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

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.

Kubeconfig Format Corruption After Switching Clusters and Restarting Workspace
7 participants