Files
velero/site/content/docs
d8facf81f8 Detect VolumeGroupSnapshot API version at runtime (v1/v1beta2/v1beta1) (#10601)
* Migrate VolumeGroupSnapshot API from v1beta2 to v1

Signed-off-by: Prasad Joshi <prajoshi@redhat.com>

* Add changelog

Signed-off-by: Prasad Joshi <prajoshi@redhat.com>

* Detect VolumeGroupSnapshot API version at runtime

Velero hardcoded the VolumeGroupSnapshot (VGS) API version, so VGS backup and
restore failed on clusters that serve a different version than Velero expects.
For example OCP 5.0 serves only groupsnapshot.storage.k8s.io/v1 and OCP 4.22
serves only v1beta1, while Velero targeted a single version and failed with
"no matches for kind" on the others.

Detect the served VGS API version at runtime via the discovery client
(preferring v1 > v1beta2 > v1beta1) and perform all VGS, VGSClass and VGSContent
I/O through the dynamic client, converting to and from the canonical v1 typed
structs. The controller-runtime typed client cannot negotiate versions because
it sends the GVK of the Go type, so the dynamic client is used at the I/O
boundary instead. Owner-reference matching is now version-independent (Kind and
UID), since the CSI controller stamps refs with whatever version the cluster
serves.

This builds on the v1 migration and external-snapshotter client bump from the
previous commits.

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

* Add changelog for VGS runtime version detection

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

* docs: VGS supports v1/v1beta2/v1beta1 via runtime detection

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

* Remove superseded changelog for #10600 (covered by #10601)

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

* Use crClient + unstructured for VGS access instead of a dynamic client

Address review feedback: rather than a dedicated VGSClient wrapping
dynamic.Interface + discovery.DiscoveryInterface, perform all VolumeGroupSnapshot
I/O through the existing controller-runtime client with *unstructured.Unstructured.
The object's GVK is stamped to the served version and controller-runtime routes it
via its RESTMapper, giving the same multi-version behavior (v1/v1beta2/v1beta1)
that the typed client cannot.

This removes the extra client plumbing: no constructor signature changes to
NewRestoreFinalizerReconciler or server.go, no Factory DynamicClient/DiscoveryClient
mock churn, and no separate fake client package. The version is resolved from the
client's RESTMapper (preferring v1 > v1beta2 > v1beta1), and the helpers convert
to and from the canonical v1 typed structs.

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

---------

Signed-off-by: Prasad Joshi <prajoshi@redhat.com>
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
Co-authored-by: Prasad Joshi <prajoshi@redhat.com>
2026-09-29 11:51:42 -04:00
..
2020-08-13 09:09:15 -07:00
2024-12-05 14:30:40 +01:00
2024-12-05 14:30:40 +01:00
2024-12-05 14:30:40 +01:00
2026-06-09 09:04:25 -07:00