Skip to content

Commit 5806bdc

Browse files
authored
Adapt to latest OCI format (#517)
Signed-off-by: Lukas Frank <lukas.frank@sap.com>
1 parent d0dcebd commit 5806bdc

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

internal/controllers/machine_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ func (r *MachineReconciler) setDomainImage(
916916
return err
917917
}
918918
if !ok {
919-
if err := r.raw.Create(rootFSFile, raw.WithSourceFile(img.RootFS.Path)); err != nil {
919+
if err := r.raw.Create(rootFSFile, raw.WithSourceFile(img.SquashFS.Path)); err != nil {
920920
return fmt.Errorf("error creating root fs disk: %w", err)
921921
}
922922
if err := os.Chmod(rootFSFile, filePerm); err != nil {

internal/oci/image.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
type Image struct {
2626
Config ironcoreimage.Config
27-
RootFS *FileLayer
27+
SquashFS *FileLayer
2828
InitRAMFs *FileLayer
2929
Kernel *FileLayer
3030
}
@@ -112,25 +112,25 @@ func (c *LocalCache) resolveImage(ctx context.Context, ociImg image.Image) (*Ima
112112
Descriptor: layer.Descriptor(),
113113
Path: kernelPath,
114114
}
115-
case ironcoreimage.RootFSLayerMediaType:
116-
rootFSPath, err := localStore.BlobPath(layer.Descriptor().Digest)
115+
case ironcoreimage.SquashFSLayerMediaType:
116+
squashFSPath, err := localStore.BlobPath(layer.Descriptor().Digest)
117117
if err != nil {
118118
return nil, fmt.Errorf("error getting path to rootfs: %w", err)
119119
}
120-
img.RootFS = &FileLayer{
120+
img.SquashFS = &FileLayer{
121121
Descriptor: layer.Descriptor(),
122-
Path: rootFSPath,
122+
Path: squashFSPath,
123123
}
124124

125125
}
126126
}
127127
var missing []string
128-
if img.RootFS == nil || img.RootFS.Path == "" {
129-
missing = append(missing, "rootfs")
130-
}
131128
if img.Kernel == nil || img.Kernel.Path == "" {
132129
missing = append(missing, "kernel")
133130
}
131+
if img.SquashFS == nil || img.SquashFS.Path == "" {
132+
missing = append(missing, "squashfs")
133+
}
134134
if img.InitRAMFs == nil || img.InitRAMFs.Path == "" {
135135
missing = append(missing, "initramfs")
136136
}
@@ -262,6 +262,7 @@ func setupMediaTypeKeyPrefixes(ctx context.Context) context.Context {
262262
ironcoreimage.InitRAMFSLayerMediaType: "layer",
263263
ironcoreimage.KernelLayerMediaType: "layer",
264264
ironcoreimage.RootFSLayerMediaType: "layer",
265+
ironcoreimage.SquashFSLayerMediaType: "layer",
265266
}
266267
for mediaType, prefix := range mediaTypeToPrefix {
267268
ctx = remotes.WithMediaTypeKeyPrefix(ctx, mediaType, prefix)

0 commit comments

Comments
 (0)