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 (machine) : crc daemon /status api should return correct preset value for okd cluster (#4478) #4480

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

rohanKanojia
Copy link
Contributor

@rohanKanojia rohanKanojia commented Nov 25, 2024

Fix #4478

Relates to: Issue #4478 #4479

Solution/Idea

CRC daemon's /api/status API endpoint should return correct value of preset when running CRC cluster configured with crc preset. At the moment it only returns correct value for microshift and openshift presets.

Proposed changes

  • Refactor Status() method to move ClusterStatusResult object creation logic to a separate method for easier testing
  • Add case for OKD preset while setting preset value in cluster preset

Testing

Build a development version of CRC and create a cluster configured with okd preset. Then query status endpoint to see what preset is returned by API server.

  1. crc config set preset okd
  2. crc setup
  3. crc start
  4. curl -i --unix-socket ~/.crc/crc-http.sock http://crc/api/status | jq .Preset should return "okd"

Old Behavior

Old Response of /api/status on OKD based cluster:

{
  "CrcStatus": "Running",
  "OpenshiftStatus": "Unreachable",
  "OpenshiftVersion": "4.14.0-0.okd-scos-2024-01-10-151818",
  "DiskUse": 16885141504,
  "DiskSize": 32680947712,
  "RAMUse": 1958576128,
  "RAMSize": 9371365376,
  "Preset": "openshift" // Not OK, should be okd
}

New Behavior (with this PR)

New Response of /api/status on OKD based cluster:

{
  "CrcStatus": "Running",
  "OpenshiftStatus": "Unreachable",
  "OpenshiftVersion": "4.15.0-0.okd-2024-02-23-163410",
  "DiskUse": 521195520,
  "DiskSize": 10947768320,
  "RAMUse": 21496344576,
  "RAMSize": 32680947712,
  "Preset": "okd"
}

I have tested by cherry-picking this commit on top of #4479 , it's now displaying OKD value in crc status as expected.

Copy link

openshift-ci bot commented Nov 25, 2024

Hi @rohanKanojia. Thanks for your PR.

I'm waiting for a crc-org 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.

@anjannath
Copy link
Member

/ok-to-test

pkg/crc/machine/status.go Outdated Show resolved Hide resolved
… value for `okd` cluster (crc-org#4478)

+ Refactor `Status()` method to move ClusterStatusResult object creation
  logic to a separate method for easier testing
+ Add case for OKD preset while setting preset value in cluster preset

Signed-off-by: Rohan Kumar <[email protected]>
@openshift-ci openshift-ci bot added the lgtm label Dec 2, 2024
Copy link

openshift-ci bot commented Dec 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anjannath

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

The pull request process is described 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

Copy link

openshift-ci bot commented Dec 2, 2024

@rohanKanojia: The following tests 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/integration-crc 691b143 link true /test integration-crc
ci/prow/e2e-crc 691b143 link true /test e2e-crc

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-sigs/prow repository. I understand the commands that are listed here.

@anjannath anjannath merged commit 28b72b7 into crc-org:main Dec 2, 2024
26 of 35 checks passed
@rohanKanojia rohanKanojia deleted the pr/issue4478 branch December 2, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] crc daemon /status api returns wrong preset value for okd cluster
2 participants