Commit Graph

478 Commits

Author SHA1 Message Date
panguicai008
5c9c630c33 use uppercase letters for flag usage
Signed-off-by: panguicai008 <guicai.pan@daocloud.io>
2023-03-08 14:28:06 +08:00
Jian Zeng
f706576500
feat: tag image using Transfer api
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2023-03-05 23:22:17 +08:00
Derek McGowan
13bf5565eb
[transfer] update export to use image store references
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-03-02 11:14:32 -08:00
Jian Zeng
f6491b0049
feat: export images using Transfer api
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2023-03-02 09:04:25 -08:00
Iceber Gu
b91f42a146 ctr/tasks: support remapped UID/GID
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-03-02 14:02:14 +08:00
Tony Fang
8a47c6910f Add a leading space after the comment sign
Fix coding standards

Signed-off-by: Tony Fang <nhfang@amazon.com>
2023-02-26 17:49:15 +00:00
Tony Fang
47305392c6 Add configuration options to local transfer service
Signed-off-by: Tony Fang <nhfang@amazon.com>
2023-02-25 03:40:06 +00: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
Derek McGowan
fa5752ba92
Merge pull request #8096 from helen-frank/feature/ctrVersionAddArgsCheck
ctr version: add args check
2023-02-15 15:29:01 -08:00
Zechun Chen
39bac0dbef error strings should not be capitalized
Signed-off-by: Zechun Chen <zechun.chen@daocloud.io>
2023-02-15 14:30:36 +08:00
Wei Fu
e855a59984 cmd/ctr/commands/images: support usage subcommand
The `ctr image usage` can display the usage of snapshots with a given
image ref. It's easy for user to get chain snapshot IDs and unpack
usage. And according to the [discuss][1], this subcommand can be used to
ensure if snapshot's pagecache has been discarded in a unexpected
reboot.

How to use it:

```bash
$ bin/ctr image usage --snapshotter native docker.io/library/golang:1.19.3
ctr: image docker.io/library/golang:1.19.3 isn't unpacked in snapshotter native

$ bin/ctr image usage --snapshotter overlayfs docker.io/library/golang:1.19.3
KEY                                                                     SIZE      INODES
sha256:28114d8403bac6352c3e09cb23e37208138a0cd9d309edf3df38e57be8075a1d 16.0 KiB  4
sha256:f162c02ce6b9b594757cd76eda1c1dd119b88e69e882cb645bf7ad528b54f0d2 476.2 MiB 13660
sha256:a5b9faceaa495819b9ba7011b7276c4ffaffe6c7b9de0889e11abc1113f7b5ca 225.5 MiB 3683
sha256:412b2615d27d6b0090558d25b201b60a7dff2a40892a7e7ca868b80bf5e5de41 159.8 MiB 6196
sha256:dbce1593502d39c344ce089f98187999f294de5182a7106dcb6c9d04ce0c7265 19.4 MiB  502
sha256:8953bf5d24149e9b2236abc76bd0aa14b73828f1b63e816cb4b457249f6125bc 12.2 MiB  958
sha256:ccba29d6937047c719a6c048a7038d3907590fbb8556418d119469b2ad4f95bc 134.7 MiB 7245

$ bin/ctr image usage --snapshotter overlayfs docker.io/library/golang:1.19
ctr: failed to ensure if image docker.io/library/golang:1.19 exists: image "docker.io/library/golang:1.19": not found
```

[1]: <https://github.com/containerd/containerd/issues/5854#issuecomment-1415915765>

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-02-14 23:24:10 +08:00
Akihiro Suda
4e2eb8ba4e
Merge pull request #7964 from dmcgowan/transfer-image-store-references
[transfer] update imagestore interface to support multiple references
2023-02-14 11:22:27 +09:00
Derek McGowan
081601f521
Update imagestore interface to support multiple references
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-02-13 13:58:33 -08:00
helen
36e7dbdcbd ctr version: add args check, prohibit incoming args
Signed-off-by: helen <haitao.zhang@daocloud.io>
2023-02-13 17:20:18 +08:00
Akihiro Suda
b61988670c
go.mod: github.com/containerd/typeurl/v2 v2.1.0
Changes: https://github.com/containerd/typeurl/compare/7f6e6d160d67...v2.1.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-02-11 23:39:52 +09:00
Fish-pro
76a62e52ae Use http constants instead of string
Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
2023-02-10 14:01:48 +08:00
yulng
757b8f702b
keep the uppercase letter for flag info
Signed-off-by: yulng <wei.yang@daocloud.io>
2023-02-06 16:37:24 +08:00
Phil Estes
eda079259d
Merge pull request #8039 from yankay/cleanup-useless-IntToInt32Array-func
cmd/ctr/commands: clean up the func IntToInt32Array in utils.go
2023-02-01 11:19:17 -05:00
Kay Yan
2f1aad03af
cleanup useless IntToInt32Array func
Signed-off-by: Kay Yan <kay.yan@daocloud.io>
2023-02-01 12:14:46 +08:00
Edgar Lee
34d5878185 Use mount.Target to specify subdirectory of rootfs mount
- Add Target to mount.Mount.
- Add UnmountMounts to unmount a list of mounts in reverse order.
- Add UnmountRecursive to unmount deepest mount first for a given target, using
moby/sys/mountinfo.

Signed-off-by: Edgar Lee <edgarhinshunlee@gmail.com>
2023-01-27 09:51:58 +08:00
Iceber Gu
0b9313c426 ctr/run: flags --detach and --rm cannot be specified together
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-01-07 10:18:43 +08:00
Danny Canter
0abc2f160c ctr: Add platform flag to 'oci spec' command
This adds in a simple flag to control what platform the spec it generates
is for. Useful to easily get a glance at whats the default across platforms.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-01-03 12:44:26 -08:00
Iceber Gu
6b333fd210 ctr contents ls sorts the labels of the content
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2022-12-30 15:58:47 +08:00
Iceber Gu
a2df12d1a3 fix ctr tasks kill does not remove cni network under windows
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2022-12-23 14:51:49 +08:00
Fu Wei
12f30e6524
Merge pull request #7792 from mxpv/sb-shutdown 2022-12-15 13:37:35 +08:00
Maksym Pavlenko
a4d5c3e5cb Support sandboxed shims shutdown
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-12-14 18:22:52 -08:00
Akihiro Suda
dc48349248
epoch: propagate SOURCE_DATE_EPOCH via ctx
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-12-12 09:02:35 +09:00
Maksym Pavlenko
3bc8fc4d30 Cleanup build constraints
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-12-08 09:36:20 -08:00
Akihiro Suda
698622b89a
Merge pull request #7673 from turan18/ctr-restore
Refactor ctr restore to allow for tty allocation
2022-12-06 17:55:19 +09:00
Derek McGowan
42eedc0bc7
Update ctr to make local the default for distribution
Disable using transfer service by default for now

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:57 -08:00
Derek McGowan
ef61e13a6e
Update import cli to use transfer service
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:56 -08:00
Derek McGowan
b991c71e90
Update pull command to use filter arguments
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:56 -08:00
Derek McGowan
0aca4bb1f2
Update ctr commands to use transfer interface
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:54 -08:00
Derek McGowan
e506cd103f
Implement client interface for transfer service
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:53 -08:00
Derek McGowan
763d4e1261
Merge pull request #7730 from djdongjin/ctr-prune
Add ctr image prune command
2022-11-29 15:39:42 -08:00
Derek McGowan
6f7ed272e8
Merge pull request #7694 from AkihiroSuda/introspection-pid
introspection: expose the daemon's PID and PIDNS
2022-11-29 11:41:14 -08:00
Jin Dong
8e0a3c51a5 Add ctr image prune
Signed-off-by: Jin Dong <jindon@amazon.com>
2022-11-29 18:11:34 +00:00
Fu Wei
24020812bb
Merge pull request #7669 from yanggangtony/status-clean
make status more readable and update easy.
2022-11-27 23:12:23 +08:00
Akihiro Suda
661aaae3bb
introspection: expose the daemon's PID and PIDNS
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-11-18 17:14:26 +09:00
Derek McGowan
223f67ccdb
Merge pull request #7601 from kzys/cgroups-upgrade
Upgrade github.com/containerd/cgroups from v1 to v3
2022-11-17 21:55:03 -08:00
Yasin Turan
5d0457df90 Refactored ctr to allow for tty allocation when container has {terminal:true} within Spec
Signed-off-by: Yasin Turan <turyasin@amazon.com>
2022-11-16 21:15:03 +00:00
yanggang
e38e2c8a4d
make status more readable and update easy.
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-11-15 15:48:01 +08:00
yanggang
3abcfb5c07
keep the lower case letter for flag info
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-11-15 14:09:55 +08:00
Kazuyoshi Kato
8bb5999738 Remove the outdated comment
While containerd/cgroups is only for Linux, the metrics subcommand works
on Windows.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-11-14 21:07:48 +00:00
Kazuyoshi Kato
dd86128e0d Convert hcsshim's stats to cgroups' stats
Since hcsshim still uses containerd/cgroups 1.x which uses
gogo/protobuf.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-11-14 21:07:48 +00:00
Fu Wei
9fffa8c712
Merge pull request #7629 from wzshiming/feat/pprof-debug
Add `--debug` args to all subcommands of `ctr pprof`
2022-11-11 11:47:57 +08:00
Shiming Zhang
91e295d766 Add --debug args
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2022-11-09 17:43:53 +08:00
Sebastiaan van Stijn
eaedadbed0
replace strings.Split(N) for strings.Cut() or alternatives
Go 1.18 and up now provides a strings.Cut() which is better suited for
splitting key/value pairs (and similar constructs), and performs better:

```go
func BenchmarkSplit(b *testing.B) {
        b.ReportAllocs()
        data := []string{"12hello=world", "12hello=", "12=hello", "12hello"}
        for i := 0; i < b.N; i++ {
                for _, s := range data {
                        _ = strings.SplitN(s, "=", 2)[0]
                }
        }
}

func BenchmarkCut(b *testing.B) {
        b.ReportAllocs()
        data := []string{"12hello=world", "12hello=", "12=hello", "12hello"}
        for i := 0; i < b.N; i++ {
                for _, s := range data {
                        _, _, _ = strings.Cut(s, "=")
                }
        }
}
```

    BenchmarkSplit
    BenchmarkSplit-10            8244206               128.0 ns/op           128 B/op          4 allocs/op
    BenchmarkCut
    BenchmarkCut-10             54411998                21.80 ns/op            0 B/op          0 allocs/op

While looking at occurrences of `strings.Split()`, I also updated some for alternatives,
or added some constraints; for cases where an specific number of items is expected, I used `strings.SplitN()`
with a suitable limit. This prevents (theoretical) unlimited splits.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 10:02:25 +01:00
Akihiro Suda
11a06c1a3d
ctr: add ctr content fetch-blob
e.g., `ctr content fetch-blob docker.io/library/debian:latest sha256:43d28810c1b4c28a1be3bac8e0e40fcc472b2bfcfcda952544ed99cb874d2b1a`

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-11-04 11:41:11 +09:00