Skip to content

Commit a13c8b8

Browse files
Update default value for api_name in DataVolume and add future warning (RedHatQE#2649)
1 parent be6eac5 commit a13c8b8

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

ocp_resources/datavolume.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __init__(
9595
multus_annotation: str | None = None,
9696
bind_immediate_annotation: bool | None = None,
9797
preallocation: bool | None = None,
98-
api_name: str | None = "pvc",
98+
api_name: str | None = None,
9999
checkpoints: list[Any] | None = None,
100100
final_checkpoint: bool | None = None,
101101
priority_class_name: str | None = None,
@@ -124,7 +124,8 @@ def __init__(
124124
bind_immediate_annotation (bool, default: None): when WaitForFirstConsumer is set in StorageClass and DV
125125
should be bound immediately.
126126
preallocation (bool, default: None): preallocate disk space.
127-
api_name (str, default: "pvc"): api used for DV (e.g., "storage", "pvc").
127+
api_name (str | None, default: None): api used for DV (e.g., "storage", "pvc").
128+
NOTE: Currently defaults to "pvc" if not specified. Default will change to "storage" in a future release.
128129
checkpoints (list[Any], default: None): list of DataVolumeCheckpoints for snapshot operations.
129130
final_checkpoint (bool, default: None): indicates whether the current DataVolumeCheckpoint is the final one.
130131
priority_class_name (str, default: None): priority class name for the DataVolume pod.
@@ -147,7 +148,17 @@ def __init__(
147148
self.multus_annotation = multus_annotation
148149
self.bind_immediate_annotation = bind_immediate_annotation
149150
self.preallocation = preallocation
150-
self.api_name = api_name
151+
if api_name is None:
152+
warn(
153+
"The default 'api_name' will change from 'pvc' to 'storage' in a future release. "
154+
"To maintain existing behavior and suppress this warning, "
155+
"explicitly set api_name='pvc' in your constructor call.",
156+
FutureWarning,
157+
stacklevel=2,
158+
)
159+
self.api_name = "pvc"
160+
else:
161+
self.api_name = api_name
151162
self.checkpoints = checkpoints
152163
self.final_checkpoint = final_checkpoint
153164
self.priority_class_name = priority_class_name

0 commit comments

Comments
 (0)