-
Notifications
You must be signed in to change notification settings - Fork 391
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
STOR-2040: CLI command to display bound pvc filesystem usage percentage #1854
Conversation
@gmeghnag: This pull request references STOR-2040 which is a valid jira issue. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
Thank you for spending time on this nice and useful feature. But that requires a KEP first to sync on the feature and implementation. |
Hey @ardaguclu, what is a KEP? And how to create one? Thanks :) |
I think, you'd write an enhancement proposal under https://github.com/openshift/enhancements/tree/master/enhancements/oc and we'll discuss the design and align on it. Once it merges, we can return to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @gmeghnag :) This is nice work, I just have a few suggestions.
/retest |
/test e2e-agnostic-ovn-cmd |
/retest |
DO NOT MERGE, I have to fix first https://issues.redhat.com/browse/OCPBUGS-44011 |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still believe that this is a cool feature and thanks for spending time on this. I think it requires major code refactorings though.
/label tide/merge-method-squash
@@ -0,0 +1,382 @@ | |||
package top |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you'll be the maintainer of this command, there should be a separate OWNERS file like this https://github.com/openshift/oc/blob/master/pkg/cli/admin/inspectalerts/OWNERS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is still valid. We need OWNERS file to maintain and triage the issues with respect to this comment.
@ardaguclu Thank you a lot for the code review! Before spending time answering your questions and proceeding with the code modifications I would like to ask @tsmetana if doing so will make this PR merged, because, from our last chat I understood that you (with the storage leads) chose to go upstream first with this functionality, and doing so will probably need a different approach since Prometheus is not provided by default in vanilla Kubernetes. In short, I don't want to spend time modifying the code if this PR will not be merged anyway. Thanks |
@gmeghnag labelling the feature as experimental is exactly what would make it merge even if we want to implement this also in upstream Thanks for the awesome work! |
@ardaguclu @tsmetana I've updated the PR, please let me know if anything else is needed! (: |
/retest-required |
Thank you. I quickly skimmed over the current code but we need to iterate a couple of times to be ready for merge. I think, it would be safer to defer this to 4.19 as unfortunately I don't have time for 4.18. |
for _, promOutputDataResult := range promOutput.Data.Result { | ||
namespaceName := promOutputDataResult.Metric["namespace"] | ||
pvcName := promOutputDataResult.Metric["persistentvolumeclaim"] | ||
usagePercentage := promOutputDataResult.Value[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we know promOutputDataResult.Value
's length is greater than 1 and we don't panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this is a "dogma" from Prometheus output, see here [1][2]:
Instant vectors are returned as result type vector. The corresponding result property has the following format:
[
{
"metric": { "<label_name>": "<label_value>", ... },
"value": [ <unix_time>, "<sample_value>" ],
"histogram": [ <unix_time>, <histogram> ]
},
...
]
[1] https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries
[2] https://prometheus.io/docs/prometheus/latest/querying/api/#instant-vectors
@@ -0,0 +1,382 @@ | |||
package top |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is still valid. We need OWNERS file to maintain and triage the issues with respect to this comment.
return body, nil | ||
} | ||
|
||
type PromOutput struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can unexport this and the other nested ones.
@ardaguclu I updated the code with the modification you suggested; let me know if anything else is needed. [: |
Could you please squash this to one comment?. Merge commits shouldn't be listed in commits. |
"Could you please squash this to one comment?. Merge commits shouldn't be listed in commits." |
Thank you It is better to get lgtm from storage team. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ardaguclu, gmeghnag, jsafrane 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 |
/label acknowledge-critical-fixes-only |
@gmeghnag: all tests passed! 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. |
[ART PR BUILD NOTIFIER] Distgit: openshift-enterprise-cli |
[ART PR BUILD NOTIFIER] Distgit: ose-tools |
[ART PR BUILD NOTIFIER] Distgit: ose-cli-artifacts |
[ART PR BUILD NOTIFIER] Distgit: openshift-enterprise-deployer |
The code makes use of a Prometheus query to implement the
oc adm top persistentvolumeclaims
and show usage statistics for bound persistentvolumeclaims, as follows:It supports the following flags: