Skip to content

Pv pvc - #141

Closed
corentin1002 wants to merge 8 commits into
vapor-ware:masterfrom
corentin1002:pv_pvc
Closed

Pv pvc#141
corentin1002 wants to merge 8 commits into
vapor-ware:masterfrom
corentin1002:pv_pvc

Conversation

@corentin1002

Copy link
Copy Markdown
Contributor

Hello,

Currently, it is not possible to test a deployment with PV and PVC.
This pull request is for adding PersistentVolume and PersistentVolumeClaim support.

++

@corentin1002
corentin1002 marked this pull request as ready for review September 2, 2019 12:36

@marcoceppi marcoceppi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread kubetest/client.py Outdated
Comment thread kubetest/client.py Outdated
@corentin1002
corentin1002 force-pushed the pv_pvc branch 2 times, most recently from b008af5 to 5f12489 Compare September 3, 2019 06:27

@marcoceppi marcoceppi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting looks good to me! @edaniszewski should have a review shortly

@edaniszewski edaniszewski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment thread kubetest/client.py Outdated

By default, this will augment the PersistentVolume object with
the generated test case namespace. This behavior can be
disabled with the ``set_namespace`` flag.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread kubetest/client.py Outdated
Args:
path (str): The path to the PersistentVolumeClaim manifest.
set_namespace (bool): Enable/disable the automatic
augmentation of the Service namespace.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... of the Service namespace.

should be

... of the PersistentVolumeClaim namespace.

Comment thread kubetest/objects/persistentvolume.py Outdated
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the docstring:

  • Remove Args block, as there is no namespace arg here
  • Update summary line, removing under the given namespace, since no namespace is given.

Comment thread kubetest/objects/persistentvolume.py Outdated

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove mention of namespace, since the PV doesn't need it.

Comment thread kubetest/objects/persistentvolume.py Outdated

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @edaniszewski
I have done some changes regarding the comments for being more consistent. Do not hesitate to tell me if something seems wrong

@plyte

plyte commented Sep 3, 2019

Copy link
Copy Markdown

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.

@edaniszewski

Copy link
Copy Markdown
Contributor

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.

@corentin1002

Copy link
Copy Markdown
Contributor Author

too many changes, follow #166 for PV

@corentin1002 corentin1002 mentioned this pull request Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants