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: remove check if the .kube/config exist and prevent replacing or reading it #1153

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

batleforc
Copy link
Contributor

What does this PR do?

Fix an error made in #1141 (a copy and paste error), I forgot to remove the [ -f ${kubeConfigDirectory}/config ] that check if the file exists, and the goal here was either to replace the

What issues does this PR fix or reference?

eclipse-che/che#22924

Is it tested? How?

  1. Fix test file to match the new form of the command
  2. Build the image (podman build / podman push)
  3. fix che cluster with the image and delete pod
  4. Start a new workspace and check that it work
  5. edit the current kubeconfig by adding random char in the middle of the token
  6. Reload the IDE and check that the metrics doesn't show up
  7. Reload workspaces
  8. Check that the metrics show up
  9. Start an old workspace (fixed by removing the ssh key :D ) that wasn't showing metrics
  10. See that the metrics are up

Release Notes

N/A

Docs PR

N/A

Signed-off-by: Max batleforc <maxleriche.60@gmail.com>
Copy link

openshift-ci bot commented Jul 26, 2024

Hi @batleforc. Thanks for your PR.

I'm waiting for a eclipse-che member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@che-bot
Copy link
Contributor

che-bot commented Jul 26, 2024

Click here to review and test in web IDE: Contribute

Copy link

codecov bot commented Jul 26, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.69%. Comparing base (fde2f44) to head (1cb3e8a).
Report is 1 commits behind head on main.

Files Patch % Lines
...d/src/devworkspaceClient/services/kubeConfigApi.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1153      +/-   ##
==========================================
+ Coverage   89.55%   89.69%   +0.14%     
==========================================
  Files         415      415              
  Lines       42461    42461              
  Branches     2840     2843       +3     
==========================================
+ Hits        38025    38085      +60     
+ Misses       4409     4345      -64     
- Partials       27       31       +4     

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

@akurinnoy akurinnoy requested a review from tolusha July 29, 2024 11:28
@@ -89,7 +89,7 @@ export class KubeConfigApiService implements IKubeConfigApi {
podName,
namespace,
containerName,
['sh', '-c', `[ -f ${kubeConfigDirectory}/config ] || cat ${kubeConfigDirectory}/config`],
['sh', '-c', `cat ${kubeConfigDirectory}/config`],
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I don't understand why [ -f ${kubeConfigDirectory}/config ] is not needed anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The purpose of the [ -f ${kubeConfigDirectory}/config ] is to do the next action if the file doesn't exist. The goal of this command is to check if the file exists, if it exists output it and merge it with the expected kubeconfig

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, if the file ${kubeConfigDirectory}/config doesn't exist, then the exec command return not empty stdError. In this case we don't merge kubeConfig but creates it with the next exec command.
If so, can we do it in more clear way or at least add some comments explaining the logic please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added some comment, is it enough or should I rework how i've done it ?

… kubeconfig

Signed-off-by: Max batleforc <maxleriche.60@gmail.com>
Copy link

openshift-ci bot commented Aug 1, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: akurinnoy, batleforc, tolusha

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

@akurinnoy akurinnoy merged commit 48e9057 into eclipse-che:main Aug 1, 2024
13 of 16 checks passed
@devstudio-release
Copy link

Build 3.16 :: dashboard_3.x/515: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.16 :: get-sources-rhpkg-container-build_3.x/7324: FAILURE

dashboard : 3.x :: Failed in 63042805 : 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
Projects
None yet
5 participants