Skip to content

Commit

Permalink
fix: image cache volume provisioning
Browse files Browse the repository at this point in the history
There is a logic failure in the `ImageCacheConfig` controller that
`allReady` was always `false` (now should be fixed).

The real issue was that `IMAGECACHE` being in the `SystemDisk` wave, and
not being provisioned until `EPHEMERAL` is not provisioned, which blocks
booting with Image Cache on and without an ISO, by just providing an
empty `IMAGECACHE` disk volume. There isn't much use in this scenario,
but still good to make it fixed.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Feb 3, 2025
1 parent c966781 commit 7c46eba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ func (ctrl *VolumeManagerController) Run(ctx context.Context, r controller.Runti

fullyProvisionedWave := math.MaxInt
allClosed := true
minWave := math.MinInt

if len(volumeConfigs) > 0 {
minWave = volumeConfigs[0].TypedSpec().Provisioning.Wave
}

for _, vc := range volumeConfigs {
// abort on context cancel, as each volume processing might take a while
Expand Down Expand Up @@ -341,7 +346,8 @@ func (ctrl *VolumeManagerController) Run(ctx context.Context, r controller.Runti
volumeStatus.PreFailPhase = block.VolumePhase(0)
}

if volumeStatus.Phase != block.VolumePhaseReady {
// if the wave we're working on is a minimum wave, let's not push the limit further, as minWave can be processed (partially)
if volumeStatus.Phase != block.VolumePhaseReady && vc.TypedSpec().Provisioning.Wave != minWave {
fullyProvisionedWave = vc.TypedSpec().Provisioning.Wave - 1
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ func (ctrl *ImageCacheConfigController) Run(ctx context.Context, r controller.Ru
}
}

logger.Debug("image cache status", zap.String("status", status.String()), zap.String("copy_status", copyStatus.String()))

if err = safe.WriterModify(ctx, r, cri.NewImageCacheConfig(), func(cfg *cri.ImageCacheConfig) error {
cfg.TypedSpec().Status = status
cfg.TypedSpec().CopyStatus = copyStatus
Expand Down Expand Up @@ -349,10 +351,12 @@ func (ctrl *ImageCacheConfigController) analyzeImageCacheVolumes(ctx context.Con
roots := make([]string, 0, len(volumeIDs))

var (
allReady, isoReady, diskReady bool
copySource, copyTarget string
isoReady, diskReady bool
copySource, copyTarget string
)

allReady := true

// analyze volume statuses, and build the roots
for _, volumeStatus := range volumeStatuses {
// mount as rw only disk cache if the ISO cache is present
Expand Down

0 comments on commit 7c46eba

Please sign in to comment.