Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: image cache volume provisioning #10281

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ uki-certs: talosctl ## Generate test certificates for SecureBoot/PCR Signing
.PHONY: cache-create
cache-create: installer imager ## Generate image cache.
@docker run --entrypoint /usr/local/bin/e2e.test registry.k8s.io/conformance:$(KUBECTL_VERSION) --list-images | \
$(TALOSCTL_EXECUTABLE) images integration --installer-tag=$(IMAGE_TAG) --registry-and-user=$(REGISTRY_AND_USERNAME) | \
$(TALOSCTL_EXECUTABLE) images integration --installer-tag=$(IMAGE_TAG)-amd64-secureboot --registry-and-user=$(REGISTRY_AND_USERNAME) | \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess unrelated to this, but to make the default secureboot installer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is in fact related, the change you did to make ISO sd-boot broke image-cache, as it needs to cache a different installer image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I think we should figure out a plan vs. the installer and start using UKIfied installer everywhere now, but it doesn't have to be the this PR

$(TALOSCTL_EXECUTABLE) images cache-create --image-cache-path=/tmp/cache.tar --images=- --force
@crane push /tmp/cache.tar $(REGISTRY_AND_USERNAME)/image-cache:$(IMAGE_TAG)
@$(MAKE) image-iso IMAGER_ARGS="--image-cache=$(REGISTRY_AND_USERNAME)/image-cache:$(IMAGE_TAG) --extra-kernel-arg='console=ttyS0'"
Expand Down
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