+
Skip to content

Better error handling of mountArtifact #9165

Closed
@bitoku

Description

@bitoku

Currently when cri-o fails to mount artifacts, it always fallback to mount images, but there're some cases that we don't have to fallback.

if m.GetImage().GetImage() != "" {
if s.config.OCIArtifactMountSupport {
// Try mountArtifact first, and fall back to mountImage if it fails with ErrNotFound
artifactVolumes, err := s.mountArtifact(ctx, specgen, m, mountLabel, skipRelabel, maybeRelabel)
if err == nil {
volumes = append(volumes, artifactVolumes...)
continue
}
} else {
log.Debugf(ctx, "Skipping artifact mount because OCI artifact mount support is disabled")
}
log.Warnf(ctx, "Artifact mount failed with %s. Falling back to image mount", err)
volume, safeMount, err := s.mountImage(ctx, specgen, imageVolumesPath, m, runDir)
if err != nil {
return nil, nil, nil, fmt.Errorf("%w: %w", crierrors.ErrImageVolumeMountFailed, err)
}
volumes = append(volumes, *volume)
safeMounts = append(safeMounts, safeMount)
continue
}

This issue intends to figure out what errors are fallback-able, and avoid fallback in other cases.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载