Skip to content

Commit 5a0a4e7

Browse files
committed
[feat.] image config field imageRef and 'podSandboxMeta'
Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
1 parent 2aa48b0 commit 5a0a4e7

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- name: Build
3434
shell: bash
3535
run: |
36+
set -x
3637
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
3738
if [[ -z ${RELEASE_VERSION} ]]; then
3839
git fetch --tags

pkg/snapshot/overlay.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,10 @@ func (o *snapshotter) turboOCIFsMeta(id string) (string, string) {
15041504
log.L.Warn("erofs is not supported on this system, fallback to other fs type")
15051505
continue
15061506
}
1507+
if fsType == "erofs" && o.rwMode != RoDir {
1508+
log.L.Warn("erofs is not supported in rw mode, fallback to other fs type")
1509+
continue
1510+
}
15071511
return fsmeta, fsType
15081512
} else if !errors.Is(err, os.ErrNotExist) {
15091513
log.L.Errorf("error while checking fs meta file: %s", err)

pkg/snapshot/storage.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,19 @@ func (o *snapshotter) constructOverlayBDSpec(ctx context.Context, key string, wr
498498
ResultFile: o.overlaybdInitDebuglogPath(id),
499499
}
500500

501+
if writable {
502+
// pod sandbox meta is only for rw layer
503+
meta, ok := info.Labels["PodSandboxMetadata"]
504+
if !ok {
505+
log.G(ctx).Warn("no pod sandbox meta found")
506+
} else {
507+
if err := json.Unmarshal([]byte(meta), &configJSON.PodSandboxMeta); err != nil {
508+
return fmt.Errorf("failed to unmarshal pod sandbox meta %q: %w", meta, err)
509+
}
510+
log.G(ctx).Infof("pod sandbox meta: %s", meta)
511+
}
512+
}
513+
501514
// load the parent's config and reuse the lowerdir
502515
if info.Parent != "" {
503516
parentID, _, _, err := storage.GetInfo(ctx, info.Parent)
@@ -511,6 +524,7 @@ func (o *snapshotter) constructOverlayBDSpec(ctx context.Context, key string, wr
511524
}
512525
configJSON.RepoBlobURL = parentConfJSON.RepoBlobURL
513526
configJSON.Lowers = parentConfJSON.Lowers
527+
configJSON.ImageRef = parentConfJSON.ImageRef
514528
}
515529

516530
switch stype {
@@ -540,6 +554,7 @@ func (o *snapshotter) constructOverlayBDSpec(ctx context.Context, key string, wr
540554
}
541555

542556
configJSON.RepoBlobURL = blobPrefixURL
557+
configJSON.ImageRef = ref
543558
if isTurboOCI, dataDgst, compType := o.checkTurboOCI(info.Labels); isTurboOCI {
544559
var fsmeta string
545560

pkg/types/types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ package types
1818

1919
// OverlayBDBSConfig is the config of overlaybd target.
2020
type OverlayBDBSConfig struct {
21+
ImageRef string `json:"imageRef"`
2122
RepoBlobURL string `json:"repoBlobUrl"`
2223
Lowers []OverlayBDBSConfigLower `json:"lowers"`
2324
Upper OverlayBDBSConfigUpper `json:"upper"`
2425
ResultFile string `json:"resultFile"`
2526
AccelerationLayer bool `json:"accelerationLayer,omitempty"`
2627
RecordTracePath string `json:"recordTracePath,omitempty"`
28+
PodSandboxMeta PodSandboxMetadata `json:"podSandboxMeta,omitempty"`
2729
}
2830

2931
// OverlayBDBSConfigLower
@@ -43,3 +45,9 @@ type OverlayBDBSConfigUpper struct {
4345
Target string `json:"target,omitempty"`
4446
GzipIndex string `json:"gzipIndex,omitempty"`
4547
}
48+
49+
type PodSandboxMetadata struct {
50+
Name string `json:"name,omitempty"`
51+
Uid string `json:"uid,omitempty"`
52+
Namespace string `json:"namespace,omitempty"`
53+
}

0 commit comments

Comments
 (0)