crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.26k stars 242 forks source link

Display PersistentVolumeSize in `crc status` #4265

Closed vyasgun closed 3 months ago

vyasgun commented 4 months ago

Enhance the crc status command to display the PersistentVolumeSize from the CRC configuration.

Fixes: Issue #4191

Solution/Idea

The /status handler should return fields specifying the PVC size and usage (allocated storage).

Proposed changes

Testing

Run crc status

gvyas-mac:~ gvyas$ crc status
CRC VM:                  Running
MicroShift:              Running (v4.15.12)
RAM Usage:               1.62GB of 3.904GB
Disk Usage:              6.824GB of 20.41GB (Inside the CRC VM)
Persistent Volume Usage: 10.67GB of 16GB (Allocated)
Cache Usage:             74.36GB
Cache Directory:         /Users/gvyas/.crc/cache
vyasgun commented 4 months ago

/retest

anjannath commented 4 months ago

it is showing the value of the persistent-volume-size config option, but it'd be more useful if the usage was shown like the Disk Usage (how much is used and how much is free)

e.g

CRC VM:                  Running
OpenShift:               Running (v4.16.0)
RAM Usage:               6.374GB of 10.92GB
Disk Usage:              22.86GB of 32.68GB (Inside the CRC VM)
Persistent Volume Usage: 7GB of 15GB
Cache Usage:             64.58GB
Cache Directory:         /home/anjan/.crc/cache

also this should be shown only when using the microshift preset for now, since for openshift preset the config doesn't have any effect yet

% crc config get preset
Configuration property 'preset' is not set. Default value 'openshift' is used

% crc status
CRC VM:                 Running
OpenShift:              Running (v4.16.0)
RAM Usage:              6.374GB of 10.92GB
Disk Usage:             22.86GB of 32.68GB (Inside the CRC VM)
Persistent Volume Size: 15GB
Cache Usage:            64.58GB
Cache Directory:        /home/anjan/.crc/cache
vyasgun commented 4 months ago

@anjannath Just updated the code. Please take a look again, thanks!

openshift-ci[bot] commented 3 months ago

@vyasgun: 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/security 944a250899b659b2ab9c5f9d3b7641b914fc064a link false /test security
ci/prow/integration-crc 944a250899b659b2ab9c5f9d3b7641b914fc064a link true /test integration-crc

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
anjannath commented 3 months ago

@vyasgun one thing i forgot to mention earlier is that the response for /status from the daemon API also needs to be updated to include the persistent volume size

vyasgun commented 3 months ago

The /status changes are there: https://github.com/crc-org/crc/pull/4265/files#diff-33aaddc3c8c7beec8f2bd2c494769cf4d50dafc32852da086948ad308127d19bR73

gvyas-mac:~ gvyas$ curl --unix-socket /Users/gvyas/.crc/crc-http.sock http://127.0.0.1/api/status
{"CrcStatus":"Running","OpenshiftStatus":"Running","OpenshiftVersion":"4.15.12","DiskUse":5831663616,"DiskSize":24702353408,"RAMUse":2200383488,"RAMSize":3904045056,"PersistentVolumeUse":10670309377,"PersistentVolumeSize":16000000000,"Preset":"microshift"}

@anjannath -- let me know if anything else needs to be added!

openshift-ci[bot] commented 3 months ago

[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: - ~~[OWNERS](https://github.com/crc-org/crc/blob/main/OWNERS)~~ [anjannath] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment