From e72fea8ecd3a345d83a73f1a9af9d159cc5a38b0 Mon Sep 17 00:00:00 2001 From: Lyndon-Li Date: Wed, 14 Jan 2026 14:05:21 +0800 Subject: [PATCH] fix issue for cache volume Signed-off-by: Lyndon-Li --- pkg/controller/data_download_controller.go | 2 +- pkg/controller/pod_volume_restore_controller.go | 2 +- pkg/types/node_agent.go | 6 +++--- site/content/docs/main/data-movement-cache-volume.md | 4 ++-- site/data/docs/main-toc.yml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/controller/data_download_controller.go b/pkg/controller/data_download_controller.go index 6ad64c956..8da5b2814 100644 --- a/pkg/controller/data_download_controller.go +++ b/pkg/controller/data_download_controller.go @@ -918,7 +918,7 @@ func (r *DataDownloadReconciler) setupExposeParam(dd *velerov2alpha1api.DataDown cacheVolume = &exposer.CacheConfigs{ Limit: limit, StorageClass: r.cacheVolumeConfigs.StorageClass, - ResidentThreshold: r.cacheVolumeConfigs.ResidentThreshold, + ResidentThreshold: r.cacheVolumeConfigs.ResidentThresholdInMB << 20, } } } diff --git a/pkg/controller/pod_volume_restore_controller.go b/pkg/controller/pod_volume_restore_controller.go index 71b9d234e..507e3d468 100644 --- a/pkg/controller/pod_volume_restore_controller.go +++ b/pkg/controller/pod_volume_restore_controller.go @@ -934,7 +934,7 @@ func (r *PodVolumeRestoreReconciler) setupExposeParam(pvr *velerov1api.PodVolume cacheVolume = &exposer.CacheConfigs{ Limit: limit, StorageClass: r.cacheVolumeConfigs.StorageClass, - ResidentThreshold: r.cacheVolumeConfigs.ResidentThreshold, + ResidentThreshold: r.cacheVolumeConfigs.ResidentThresholdInMB << 20, } } } diff --git a/pkg/types/node_agent.go b/pkg/types/node_agent.go index 3e876d635..f456bbf55 100644 --- a/pkg/types/node_agent.go +++ b/pkg/types/node_agent.go @@ -68,10 +68,10 @@ type RestorePVC struct { type CachePVC struct { // StorageClass specifies the storage class for cache PVC - StorageClass string + StorageClass string `json:"storageClass,omitempty"` - // ResidentThreshold specifies the minimum size of the backup data to create cache PVC - ResidentThreshold int64 + // ResidentThresholdInMB specifies the minimum size of the backup data to create cache PVC + ResidentThresholdInMB int64 `json:"residentThresholdInMB,omitempty"` } type NodeAgentConfigs struct { diff --git a/site/content/docs/main/data-movement-cache-volume.md b/site/content/docs/main/data-movement-cache-volume.md index 31490db15..c41d1609b 100644 --- a/site/content/docs/main/data-movement-cache-volume.md +++ b/site/content/docs/main/data-movement-cache-volume.md @@ -16,7 +16,7 @@ A sample of cache PVC configuration as part of the ConfigMap would look like: ```json { "cachePVC": { - "thresholdInGB": 1, + "residentThresholdInMB": 1024, "storageClass": "sc-wffc" } } @@ -29,7 +29,7 @@ kubectl create cm node-agent-config -n velero --from-file= A must-have field in the configuration is `storageClass` which tells Velero which storage class is used to provision the cache PVC. Velero relies on Kubernetes dynamic provision process to provision the PVC, static provision is not supported. -The cache PVC behavior could be further fine tuned through `thresholdInGB`. Its value is compared to the size of the backup, if the size is smaller than this value, no cache PVC would be created when restoring from the backup. This ensures that cache PVCs are not created in vain when the backup size is too small and can be accommodated in the data mover pods' root disk. +The cache PVC behavior could be further fine tuned through `residentThresholdInMB`. Its value is compared to the size of the backup, if the size is smaller than this value, no cache PVC would be created when restoring from the backup. This ensures that cache PVCs are not created in vain when the backup size is too small and can be accommodated in the data mover pods' root disk. This configuration decides whether and how to provision cache PVCs, but it doesn't decide their size. Instead, the size is decided by the specific backup repository. Specifically, Velero asks a cache limit from the backup repository and uses this limit to calculate the cache PVC size. The cache limit is decided by the backup repository itself, for Kopia repository, if `cacheLimitMB` is specified in the backup repository configuration, its value will be used; otherwise, a default limit (5 GB) is used. diff --git a/site/data/docs/main-toc.yml b/site/data/docs/main-toc.yml index 4fdcafba9..c732a9174 100644 --- a/site/data/docs/main-toc.yml +++ b/site/data/docs/main-toc.yml @@ -76,7 +76,7 @@ toc: - page: Data Movement Node Selection Configuration url: /data-movement-node-selection - page: Data Movement Cache PVC Configuration - url: /data-movement-cache-volume.md + url: /data-movement-cache-volume - page: Node-agent Concurrency url: /node-agent-concurrency - title: Plugins