Commit Graph

26 Commits

Author SHA1 Message Date
Derek McGowan
696cf25650
Move pkg/kmutex to internal/kmutex
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:57:01 -08:00
Derek McGowan
c79ecfe246
Move pkg/cleanup to internal/cleanup
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:56:34 -08:00
Derek McGowan
8f0eb26311
Move tracing to pkg/tracing
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:56:25 -08:00
Derek McGowan
b76236bb45
Move labels to pkg/labels
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:55:30 -08:00
Derek McGowan
44a836c9b5
Move errdefs to pkg/errdefs
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:54:45 -08:00
Derek McGowan
fcd39ccc53
Move snapshots to core/snapshots
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:54:09 -08:00
Derek McGowan
6e5408dcec
Move mount to core/mount
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:52:12 -08:00
Derek McGowan
57ea8aef3d
Move images to core/images
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:51:26 -08:00
Derek McGowan
913edcd489
Move diff to core/diff
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:51:17 -08:00
Derek McGowan
21b4f3f0aa
Move content to core/content
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-17 09:50:32 -08:00
Austin Vazquez
01c442147f Enhance container image unpack client logs
Adds debug message per layer unpacking and adds duration field to
the existing image unpacking debug message.

Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2023-11-15 17:30:53 +00:00
Derek McGowan
5fdf55e493
Update go module to github.com/containerd/containerd/v2
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-10-29 20:52:21 -07:00
Bjorn Neergaard
5ab04ac5a1
pkg/unpack: use mediatype helpers
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-27 13:12:49 -06:00
Derek McGowan
508aa3a1ef
Move to use github.com/containerd/log
Add github.com/containerd/log to go.mod

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-22 07:53:23 -07:00
Tianon Gravi
21b3318ebe Fix several conversions of "ocispec.Image" to "ocispec.Platform"
Several bits of code unmarshal image config JSON into an `ocispec.Image`, and then immediately create an `ocispec.Platform` out of it, but then discard the original image *and* miss several potential platform fields (most notably, `variant`).

Because `ocispec.Platform` is a strict subset of `ocispec.Image`, most of these can be updated to simply unmarshal the image config directly to `ocispec.Platform` instead, which allows these additional fields to be picked up appropriately.

We can use `tianon/raspbian` as a concrete reproducer to demonstrate.

Before:

```console
$ ctr content fetch docker.io/tianon/raspbian:bullseye-slim
...

$ ctr image ls
REF                                     TYPE                                                 DIGEST                                                                  SIZE     PLATFORMS    LABELS
docker.io/tianon/raspbian:bullseye-slim application/vnd.docker.distribution.manifest.v2+json sha256:66e96f8af40691b335acc54e5f69711584ef7f926597b339e7d12ab90cc394ce 28.6 MiB linux/arm/v7 -
```

(Note that the `PLATFORMS` column lists `linux/arm/v7` -- the image itself is actually `linux/arm/v6`, but one of these bits of code leads to only `linux/arm` being extracted from the image config, which `platforms.Normalize` then updates to an explicit `v7`.)

After:

```console
$ ctr image ls
REF                                     TYPE                                                 DIGEST                                                                  SIZE     PLATFORMS    LABELS
docker.io/tianon/raspbian:bullseye-slim application/vnd.docker.distribution.manifest.v2+json sha256:66e96f8af40691b335acc54e5f69711584ef7f926597b339e7d12ab90cc394ce 28.6 MiB linux/arm/v6 -
```

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-30 13:13:02 -07:00
Fu Wei
8cb00f45c9
Merge pull request #8143 from mxpv/log
Add Fields type alias to log package
2023-02-21 10:22:23 +08:00
Maksym Pavlenko
06e085c8b5 Add Fields type alias to log package
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-02-20 17:29:08 -08:00
Akihiro Suda
d8b68e3ccc
Stop using math/rand.Read and rand.Seed (deprecated in Go 1.20)
From golangci-lint:

> SA1019: rand.Read has been deprecated since Go 1.20 because it
>shouldn't be used: For almost all use cases, crypto/rand.Read is more
>appropriate. (staticcheck)

> SA1019: rand.Seed has been deprecated since Go 1.20 and an alternative
>has been available since Go 1.0: Programs that call Seed and then expect
>a specific sequence of results from the global random source (using
>functions such as Int) can be broken when a dependency changes how
>much it consumes from the global random source. To avoid such breakages,
>programs that need a specific result sequence should use
>NewRand(NewSource(seed)) to obtain a random generator that other
>packages cannot access. (staticcheck)

See also:

- https://pkg.go.dev/math/rand@go1.20#Read
- https://pkg.go.dev/math/rand@go1.20#Seed

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-02-16 03:50:23 +09:00
Derek McGowan
b550526ccd
Use cleanup.Background instead of context.Background for cleanup
Use the cleanup context to re-use values from the original context

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-01-04 11:22:24 -08:00
Iceber Gu
778e8f2af4 Use the const labels.LabelUncompressed
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-01-03 18:29:21 +08:00
Derek McGowan
0bc9f7b545
Avoid using canceled context in unpacker cleanup
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-12-22 14:53:23 -08:00
Swagat Bora
7def13dde3 Add a thin wrapper around otel Span object
Signed-off-by: Swagat Bora <sbora@amazon.com>
2022-11-11 01:28:27 +00:00
Swagat Bora
ee64926a72 add SpanAttribute
Signed-off-by: Swagat Bora <sbora@amazon.com>
2022-11-03 18:34:06 +00:00
Swagat Bora
3b87d46ce2 Add tracing spans in CRI image service and pull.go
Signed-off-by: Swagat Bora <sbora@amazon.com>

Add spans around image unpack operations
Use image.ref to denote image name and image.id for the image config digest
Add top-level spand and record errors in the CRI instrumentation service
2022-11-03 17:03:43 +00:00
Derek McGowan
39692e7672
unpack: return error when no platforms defined
Require platforms to be non-empty to avoid no-op unpack

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-19 18:21:57 -07:00
Derek McGowan
8017daa12d
Add unpack interface to be used by client
Move client unpacker to pkg/unpack

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-19 18:21:57 -07:00