Skip to content

Commit edb6dcf

Browse files
committed
Add debug documentation for pull mode
This change adds information to debug how the SOCI snapshotter pulls an image. Signed-off-by: Kern Walster <walster@amazon.com>
1 parent 0a23f72 commit edb6dcf

File tree

3 files changed

+72
-4
lines changed

3 files changed

+72
-4
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ body:
3434
- type: textarea
3535
attributes:
3636
label: Any additional context or information about the bug
37+
description: |
38+
If this is an issue with lazy loading, please indicate how the snapshotter pulled the image. See [Determining how an image was pulled](../../docs/debug.md#determining-how-an-image-was-pulled) in the debugging doc for more information.
39+
validations:
40+
required: false

docs/debug.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ This document outlines where to find/access logs and metrics for the snapshotter
1212
- [Metrics Emitted](#metrics-emitted)
1313
- [Common Scenarios](#common-scenarios)
1414
- [Pulling an Image](#pulling-an-image)
15+
- [Determining How an Image Was Pulled](#determining-how-an-image-was-pulled)
16+
- [Explicit Index Digest](#explicit-index-digest)
17+
- [SOCI Index Manifest v2 via SOCI-Enabled Images](#soci-index-manifest-v2-via-soci-enabled-images)
18+
- [SOCI Index Manifest v1 via The Referrers API](#soci-index-manifest-v1-via-the-referrers-api)
19+
- [Ahead of Time Without a SOCI Index](#ahead-of-time-without-a-soci-index)
1520
- [No lazy-loading](#no-lazy-loading)
1621
- [Pull Taking An Abnormal Amount Of Time](#pull-taking-an-abnormal-amount-of-time)
1722
- [Background Fetching](#background-fetching)
@@ -103,6 +108,57 @@ While pulling, the image manifest, config, and layers without zTOCs' are fetched
103108

104109
Below are a list of common error paths that may occur in this phase:
105110

111+
### Determining How an Image Was Pulled
112+
113+
The SOCI snapshotter can pull an image using one of four modes:
114+
1) Lazily using an explicitly provided SOCI index digest
115+
2) Lazily using a SOCI index manifest v2 via SOCI-enabled images
116+
3) Lazily using a SOCI index manifest v1 via the Referrers API
117+
4) Ahead of time without a SOCI index
118+
119+
Determining which of these mode was used is often a good first step for debugging image pull issues.
120+
121+
When the SOCI snapshotter starts to pull an image, it will emit a set of debug logs to indicate which modes were tried and which was ultimately used.
122+
123+
#### Explicit Index Digest
124+
If the SOCI snapshotter finds an explicit index digest, it will use it and log the following message:
125+
```
126+
using provided soci index digest
127+
```
128+
129+
#### SOCI Index Manifest v2 via SOCI-Enabled Images
130+
If an explicit index digest was not provided. The SOCI snapshotter will try to use a SOCI-enabled image.
131+
132+
If `pull_modes.soci_v2.enabled` is `false`, the snapshotter will log:
133+
```
134+
soci v2 is disabled
135+
```
136+
137+
Otherwise, if it find that the image is SOCI-enabled, it will log:
138+
```
139+
using soci v2 index annotation
140+
```
141+
142+
#### SOCI Index Manifest v1 via The Referrers API
143+
If the image is not SOCI-enabled, the SOCI snapshotter will try to use the referrers API.
144+
145+
If `pull_modes.soci_v1.enabled` is `false` (it is false by default), the SOCI snapshotter will log:
146+
```
147+
soci v1 is disabled
148+
```
149+
150+
Otherwise, if it finds a SOCI index via the referrers API, it will log:
151+
```
152+
using soci v1 index via referrers API
153+
```
154+
155+
#### Ahead of Time Without a SOCI Index
156+
If none of the above apply, the SOCI snapshotter will pull the image ahead of time and log:
157+
158+
```
159+
deferring to container runtime
160+
```
161+
106162
### No lazy-loading
107163

108164
If you notice that all layers are being fetched for an image or that `FUSE` mounts are not being created for layers with a zTOC than that means that remote mounting has failed for those layers.

fs/fs.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,12 @@ func (fs *filesystem) findSociIndexDesc(ctx context.Context, imageManifestDigest
474474
if fs.pullModes.SOCIv2.Enable {
475475
log.G(ctx).Debug("checking for soci v2 index annotation")
476476
desc, err := findSociIndexDescAnnotation(ctx, imgDigest, remoteStore)
477-
if err == nil || !errors.Is(err, errdefs.ErrNotFound) {
478-
return desc, err
477+
if err == nil {
478+
log.G(ctx).Debug("using soci v2 index annotation")
479+
return desc, nil
480+
}
481+
if !errors.Is(err, errdefs.ErrNotFound) {
482+
return ocispec.Descriptor{}, err
479483
}
480484
log.G(ctx).Debug("soci v2 index annotation not found")
481485
} else {
@@ -486,8 +490,12 @@ func (fs *filesystem) findSociIndexDesc(ctx context.Context, imageManifestDigest
486490
if fs.pullModes.SOCIv1.Enable {
487491
log.G(ctx).Debug("checking for soci v1 index via referrers API")
488492
desc, err := findSociIndexDescReferrer(ctx, imgDigest, remoteStore)
489-
if err == nil || !errors.Is(err, ErrNoReferrers) {
490-
return desc, err
493+
if err == nil {
494+
log.G(ctx).Debug("using soci v1 index via referrers API")
495+
return desc, nil
496+
}
497+
if !errors.Is(err, ErrNoReferrers) {
498+
return ocispec.Descriptor{}, err
491499
}
492500
log.G(ctx).Debug("soci v1 referrers not found")
493501
} else {

0 commit comments

Comments
 (0)