Skip to content

Fix datamover backup arg mismatch for CSI CBT service account name - #10318

Draft
kaovilai wants to merge 2 commits into
velero-io:mainfrom
kaovilai:pr-bug1
Draft

Fix datamover backup arg mismatch for CSI CBT service account name#10318
kaovilai wants to merge 2 commits into
velero-io:mainfrom
kaovilai:pr-bug1

Conversation

@kaovilai

Copy link
Copy Markdown
Member

Note

Responses generated with Claude

Does your change fix a particular issue?

Fixes #10298

Summary

The exposer built the datamover backup pod's command with --csi-snapshot-metadata-service-sa, but the datamover backup command only registered --cbt-sa-name. cobra rejects unknown flags, so the data mover pod exited immediately whenever a dedicated CBT service account was configured (csiSnapshotMetadataServiceConfigs.saName set in the node-agent ConfigMap) — and the reverse also held: since the two sides never agreed on a flag name, the SA name never actually reached the pod, so cbtservice.ServiceImpl.SAName/SANamespace (pkg/cbtservice/csi_service_impl.go:89-93,119-123) were unreachable regardless of configuration.

Not limited to the block data mover. The line that emits this flag (pkg/exposer/csi_snapshot.go:746) sits outside both the DataMoverTypeVeleroBlock gate (:266-272) and the cbtInfo != nil gate (:735-739), so it fires for any CSI snapshot data-movement backup, not just velero-block.

Fix

Emit --cbt-sa-name — already registered and consumed by NewBackupCommand (pkg/cmd/cli/datamover/backup.go:104, plumbed through to pkg/cbtservice at :217) — instead of the flag no consumer ever listened for. This also brings the naming in line with the other CBT flags built on adjacent lines (--change-id, --volume-id, --snapshot-id).

Test

TestBackupPodCBTServiceSAFlagMatchesDatamoverBackupFlags asserts the flag string the exposer builds parses cleanly against NewBackupCommand's own flag set and round-trips the SA name correctly — so the two sides can't silently drift apart again the way they did here.

Please indicate you have done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file (make new-changelog) — will add once this PR has a number.
  • Updated the corresponding documentation in site/content/docs/main — n/a, no user-facing flag change; this fixes an internal pod-to-pod arg contract.

The exposer built the pod command with --csi-snapshot-metadata-service-sa,
but the datamover backup command only registered --cbt-sa-name. cobra
rejects unknown flags, so the data mover pod exited immediately whenever
a dedicated CBT service account was configured -- and the reverse also
held: since the flags never matched, the SA name never actually reached
the pod, so any code path depending on it stayed unreachable.

Not limited to the block data mover: this line sits outside the
DataMoverTypeVeleroBlock gate and the cbtInfo != nil gate, so it fires
for any CSI snapshot data-movement backup.

Fix: emit --cbt-sa-name (already consumed by the backup command), naming
it consistently with the other CBT flags on the same line (--change-id,
--volume-id, --snapshot-id).

Add a regression test asserting the emitted flag string parses cleanly
against NewBackupCommand's own flag set, so the two sides can't drift
apart again without a test failure.

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@netlify

netlify Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploy Preview for velero canceled.

Name Link
🔨 Latest commit 52beef7
🔍 Latest deploy log https://app.netlify.com/projects/velero/deploys/6a83fb89b3a5b200085de490

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/exposer/csi_snapshot.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting node-agent csiSnapshotMetadataServiceConfigs.saName breaks all CSI snapshot datamover backups (arg/flag name mismatch)

1 participant