From 56b6ba6b107066bf6ba1ca2948783eed5a2282d7 Mon Sep 17 00:00:00 2001 From: Shubham Pampattiwar Date: Wed, 8 Jul 2026 11:36:17 -0700 Subject: [PATCH 1/2] Add image volume type support to volume policies The Kubernetes image volume type (GA in k8s 1.31) was not recognized by Velero's volume type detection logic, causing volume policies with volumeTypes condition set to "image" to be silently ignored. This led to failed fs-backups when defaultVolumesToFsBackup was enabled, since image volumes have no host path for the node agent to back up. Add the "image" SupportedVolume constant and detection in getVolumeTypeFromVolume() so that volume policies can properly match and skip image volumes. Fixes velero-io/velero#9977 Signed-off-by: Shubham Pampattiwar --- internal/resourcepolicies/volume_types_conditions.go | 4 ++++ .../resourcepolicies/volume_types_conditions_test.go | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/internal/resourcepolicies/volume_types_conditions.go b/internal/resourcepolicies/volume_types_conditions.go index 0ee57166b..400af387a 100644 --- a/internal/resourcepolicies/volume_types_conditions.go +++ b/internal/resourcepolicies/volume_types_conditions.go @@ -45,6 +45,7 @@ const ( Glusterfs SupportedVolume = "glusterfs" GCEPersistentDisk SupportedVolume = "gcePersistentDisk" HostPath SupportedVolume = "hostPath" + Image SupportedVolume = "image" ISCSI SupportedVolume = "iscsi" Local SupportedVolume = "local" NFS SupportedVolume = "nfs" @@ -243,5 +244,8 @@ func getVolumeTypeFromVolume(vol *corev1api.Volume) SupportedVolume { if vol.EmptyDir != nil { return EmptyDir } + if vol.Image != nil { + return Image + } return "" } diff --git a/internal/resourcepolicies/volume_types_conditions_test.go b/internal/resourcepolicies/volume_types_conditions_test.go index 7b7be97ee..03f5bbb0b 100644 --- a/internal/resourcepolicies/volume_types_conditions_test.go +++ b/internal/resourcepolicies/volume_types_conditions_test.go @@ -563,6 +563,15 @@ func TestGetVolumeTypeFromVolume(t *testing.T) { }, expected: Ephemeral, }, + { + name: "Test Image", + inputVol: &corev1api.Volume{ + VolumeSource: corev1api.VolumeSource{ + Image: &corev1api.ImageVolumeSource{}, + }, + }, + expected: Image, + }, } for _, tc := range testCases { From e3a3c8902c60cd8c369cb5fc26fc4405d415825b Mon Sep 17 00:00:00 2001 From: Shubham Pampattiwar Date: Wed, 8 Jul 2026 11:39:06 -0700 Subject: [PATCH 2/2] Add changelog for PR #9978 Signed-off-by: Shubham Pampattiwar --- changelogs/unreleased/9978-shubham-pampattiwar | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelogs/unreleased/9978-shubham-pampattiwar diff --git a/changelogs/unreleased/9978-shubham-pampattiwar b/changelogs/unreleased/9978-shubham-pampattiwar new file mode 100644 index 000000000..856fe087f --- /dev/null +++ b/changelogs/unreleased/9978-shubham-pampattiwar @@ -0,0 +1 @@ +Add image volume type support to volume policies