mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 02:06:23 +00:00
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.
This commit is contained in:
@@ -588,6 +588,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
|
||||
Recorder: og.recorder,
|
||||
SELinuxLabel: volumeToMount.SELinuxLabel,
|
||||
ReconstructedVolume: actualStateOfWorld.IsVolumeReconstructed(volumeToMount.VolumeName, volumeToMount.PodName),
|
||||
IsRemount: isRemount,
|
||||
})
|
||||
// Update actual state of world
|
||||
markOpts := MarkVolumeOpts{
|
||||
|
||||
@@ -139,6 +139,16 @@ type MounterArgs struct {
|
||||
// mainly used by unit tests
|
||||
VolumeOwnershipApplicator VolumeOwnershipChanger
|
||||
ReconstructedVolume bool
|
||||
|
||||
// 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 {
|
||||
|
||||
Reference in New Issue
Block a user