Pv pvc - #141
Conversation
marcoceppi
left a comment
There was a problem hiding this comment.
Thank you so much for you contribution! I've just done a first pass at some simple formatting things. I'll assign this to a reviewer for a more in-depth review
b008af5 to
5f12489
Compare
marcoceppi
left a comment
There was a problem hiding this comment.
Formatting looks good to me! @edaniszewski should have a review shortly
edaniszewski
left a comment
There was a problem hiding this comment.
Largely, this looks good to me. I noticed some inconsistencies/incorrect docstrings that should be cleaned up. After that, I think this is good to go!
|
|
||
| By default, this will augment the PersistentVolume object with | ||
| the generated test case namespace. This behavior can be | ||
| disabled with the ``set_namespace`` flag. |
There was a problem hiding this comment.
This comment does not match up with the default value of the set_namespace parameter. This comment should either be changed, or set_namespace should default to True.
| Args: | ||
| path (str): The path to the PersistentVolumeClaim manifest. | ||
| set_namespace (bool): Enable/disable the automatic | ||
| augmentation of the Service namespace. |
There was a problem hiding this comment.
... of the Service namespace.
should be
... of the PersistentVolumeClaim namespace.
| namespace (str): The namespace to create the PersistentVolume under. | ||
| If the PersistentVolume was loaded via the kubetest client, the | ||
| namespace will already be set, so it is not needed here. | ||
| Otherwise, the namespace will need to be provided. |
There was a problem hiding this comment.
Need to update the docstring:
- Remove
Argsblock, as there is no namespace arg here - Update summary line, removing
under the given namespace, since no namespace is given.
|
|
||
| This method expects the PersistentVolume to have been loaded or otherwise | ||
| assigned a namespace already. If it has not, the namespace will need | ||
| to be set manually. |
There was a problem hiding this comment.
Can remove mention of namespace, since the PV doesn't need it.
|
|
||
| PersistentVolumes do not have a "status" field to check, so we will | ||
| measure their readiness status by whether or not they exist | ||
| on the cluster. |
There was a problem hiding this comment.
this is technically not true, as there is a status field which holds a V1PersistentVolumeStatus -- that said, I'm not sure how helpful that necessarily is as it just gives the status of whether its available, used, or reclaimed (https://kubernetes.io/docs/concepts/storage/persistent-volumes/#phase)
There could be additional discussion as to whether we want to check that this enters the Available phase, but I'm not sold on that entirely, as a different object using the PV could be spun up and put it in the Bound phase quickly. That is to say, I think the implementation here for checking if its ready is ok, but I think the docstring should be updated to reflect that there is a status, but it may not be reliable for determining readiness for the reason mentioned above.
|
|
||
| PersistentVolumeClaims do not have a "status" field to check, so we will | ||
| measure their readiness status by whether or not they exist | ||
| on the cluster. |
There was a problem hiding this comment.
similar note as with the PV is_ready method -- there is a "status" field here, but to me its not certain that checking the phase necessarily guarantees that the object is ready.
There was a problem hiding this comment.
Hello @edaniszewski
I have done some changes regarding the comments for being more consistent. Do not hesitate to tell me if something seems wrong
|
How is the Persistent volume being deleted? Usually kubetest when tearing down a test deletes the namespace. Since persistent volumes are not namespaced, we need to delete them individually. In manager.py the teardown function deletes the namespace and then deletes the clusterolebindings individually since those dont have namespaces as well. If we add the persistence volumes to a list we can then iterate over them and call the delete function on each. This might fix this problem. One way we could test this would be through checking if a pv is infact deleted once the tear down function is called. This of course causes more changes to be made during the setup as we need to register these persistent volumes from the marker (applymanifest). If we add a check in "apply_manifest_from_marker" in the markers.py function we should be able to register them accordingly from there. |
|
Sorry for the delay in circling back on this. I think the changes for the comments I left before all look good, but @plyte makes a good point here that since the PersistentVolume is not in the namespace set up for the test, it won't be automatically deleted on test cleanup. This leaves it up to the test author to manually delete the resource, which I'd prefer to avoid since its an easy step to miss. I think the suggested solution of creating a marker to load/clean up the PV (like is done for ClusterRoleBindings), that should alleviate that issue. |
|
too many changes, follow #166 for PV |
Hello,
Currently, it is not possible to test a deployment with PV and PVC.
This pull request is for adding PersistentVolume and PersistentVolumeClaim support.
++