-
Notifications
You must be signed in to change notification settings - Fork 900
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
Add virtual columns PersistentVolume#storage_capacity and PersistentVolumeClaim#storage_capacity #17412
Add virtual columns PersistentVolume#storage_capacity and PersistentVolumeClaim#storage_capacity #17412
Conversation
176d3fa
to
bcfae5b
Compare
@miq-bot assign @gtanzillo |
@zakiva @nimrodshn could you review |
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.
@yrudman LGTM.
@yrudman From what I understand the PersistentVolume capacity hash has a single key/value entry - under
see: here for more details in the Kubernetes docs and here for the kube client code. |
@nimrodshn thank you |
I'm ok with exposing the serialized column as a virtual column but I'm not for the |
If that's the case why are we storing a hash? Let's just make a column with the value and then you don't need a virtual column. @cben do you have any more insight here? |
@Fryguy yeah I thought we agreed we were going to add a new column to store just the integer size and use the parser to normalize the value from the hash instead of just stuffing the whole hash in the column. |
I suppose the original intent was future-proofing due to k8s doc saying (emphasis mine):
There is also conceptual symmetry to PersistentVolumeClaim In principle, keeping these as hashes is more elegant. Imagine
|
We can do 2) after 1) is fixed and merged. |
bcfae5b
to
8b09ea2
Compare
…n :capacity. It will allow to show storage value on report as inumber instead of Hash entry. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1576922
8b09ea2
to
3a1ba10
Compare
3a1ba10
to
47f951e
Compare
def persistent_volume | ||
container_volumes.find_by_type('PersistentVolume') | ||
end | ||
|
||
def storage_capacity | ||
capacity[:storage] if capacity |
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.
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'm wondering if capacity.fetch(:storage, 0)
is enough or if we want nils
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 think nil should mean not set, and 0 - was set to 0
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.
Semantically there is difference between 0 and unset capacity.
PVs probably nearly always (?) have a capacity, though there are too many types to be sure...
PVCs don't have capacity when not bound to a PV. That's not the same as being bound to a 0-size PV (which would be a pretty silly volume).
Checked commits yrudman/manageiq@3083fcf~...d922fe1 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@yrudman yeah, I guess I'm not sure if all callers are expecting non-nil values. |
@jrafanie looks as empty place on report (the only possible caller at this time): |
There is
PersistentVolume.capacity
column, defined asserialize :capacity, Hash
and one of entry in that hash could be:storage =>...
.This PR: Virtual column
storage
added toPersistentVolume
model for the purpose of showing on reportFixes https://bugzilla.redhat.com/show_bug.cgi?id=1576922
Example of report based on
![screen shot 2018-05-11 at 2 35 29 pm](https://user-images.githubusercontent.com/6556758/39942103-8c9465f4-552c-11e8-8daa-0c7f04c19366.png)
PersistentVolume
model with new columnStorage
:@miq-bot add-label reporting
\cc @gtanzillo