Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions ocp_resources/datavolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(
multus_annotation: str | None = None,
bind_immediate_annotation: bool | None = None,
preallocation: bool | None = None,
api_name: str | None = "pvc",
api_name: str | None = None,
checkpoints: list[Any] | None = None,
final_checkpoint: bool | None = None,
priority_class_name: str | None = None,
Expand Down Expand Up @@ -124,7 +124,8 @@ def __init__(
bind_immediate_annotation (bool, default: None): when WaitForFirstConsumer is set in StorageClass and DV
should be bound immediately.
preallocation (bool, default: None): preallocate disk space.
api_name (str, default: "pvc"): api used for DV (e.g., "storage", "pvc").
api_name (str | None, default: None): api used for DV (e.g., "storage", "pvc").
NOTE: Currently defaults to "pvc" if not specified. Default will change to "storage" in a future release.
checkpoints (list[Any], default: None): list of DataVolumeCheckpoints for snapshot operations.
final_checkpoint (bool, default: None): indicates whether the current DataVolumeCheckpoint is the final one.
priority_class_name (str, default: None): priority class name for the DataVolume pod.
Expand All @@ -147,7 +148,17 @@ def __init__(
self.multus_annotation = multus_annotation
self.bind_immediate_annotation = bind_immediate_annotation
self.preallocation = preallocation
self.api_name = api_name
if api_name is None:
warn(
"The default 'api_name' will change from 'pvc' to 'storage' in a future release. "
"To maintain existing behavior and suppress this warning, "
"explicitly set api_name='pvc' in your constructor call.",
FutureWarning,
stacklevel=2,
)
self.api_name = "pvc"
else:
self.api_name = api_name
self.checkpoints = checkpoints
self.final_checkpoint = final_checkpoint
self.priority_class_name = priority_class_name
Expand Down