From 58b0072283aed1370d3400ebeea2530eeb3fa90d Mon Sep 17 00:00:00 2001 From: Anish Ramasekar Date: Wed, 13 May 2026 11:49:54 -0700 Subject: [PATCH] feat(volume): add IsRemount to MounterArgs Thread the reconciler's existing isRemount signal into MounterArgs so volume plugins can distinguish an initial publish from a republish (e.g. CSIDriver.spec.requiresRepublish=true). No behavior change. --- .../util/operationexecutor/operation_generator.go | 1 + pkg/volume/volume.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/pkg/volume/util/operationexecutor/operation_generator.go b/pkg/volume/util/operationexecutor/operation_generator.go index a79e6cb628b..9fd3eb7e2a9 100644 --- a/pkg/volume/util/operationexecutor/operation_generator.go +++ b/pkg/volume/util/operationexecutor/operation_generator.go @@ -586,6 +586,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc( FSGroupChangePolicy: fsGroupChangePolicy, Recorder: og.recorder, SELinuxLabel: volumeToMount.SELinuxLabel, + IsRemount: isRemount, }) // Update actual state of world markOpts := MarkVolumeOpts{ diff --git a/pkg/volume/volume.go b/pkg/volume/volume.go index 36814591ccb..eb269f8e3e5 100644 --- a/pkg/volume/volume.go +++ b/pkg/volume/volume.go @@ -138,6 +138,16 @@ type MounterArgs struct { // Optional interface that will be used to change the ownership of the volume, if specified. // mainly used by unit tests VolumeOwnershipApplicator VolumeOwnershipChanger + + // IsRemount is true when SetUp is being invoked on a volume that the + // reconciler considers already mounted to the pod, e.g. a periodic + // republish triggered by CSIDriver.spec.requiresRepublish=true. Volume + // plugins should use this to avoid destroying state (e.g. mount + // directories, volume metadata files) that the pod is currently + // observing through an existing bind mount, since teardown on a + // failed remount cannot be repaired by a subsequent successful + // remount and would leave the pod with stale contents. + IsRemount bool } type VolumeOwnershipChanger interface {