diff --git a/ocp_resources/persistent_volume_claim.py b/ocp_resources/persistent_volume_claim.py index 3a6b19dcf1..a8456b7f55 100644 --- a/ocp_resources/persistent_volume_claim.py +++ b/ocp_resources/persistent_volume_claim.py @@ -44,6 +44,7 @@ def __init__( teardown=True, yaml_file=None, delete_timeout=TIMEOUT_4MINUTES, + pvlabel=None, **kwargs, ): super().__init__( @@ -60,6 +61,7 @@ def __init__( self.size = size self.hostpath_node = hostpath_node self.storage_class = storage_class + self.pvlabel = pvlabel def to_dict(self): super().to_dict() @@ -86,6 +88,11 @@ def to_dict(self): if self.storage_class: self.res["spec"]["storageClassName"] = self.storage_class + if self.pvlabel: + self.res["spec"]["selector"] = { + "matchLabels": {"pvLabel": self.pvlabel} + } + def bound(self): """ Check if PVC is bound