Commit Graph

6540 Commits

Author SHA1 Message Date
Fabiano Fidêncio
305fb0547d virtcontainers: Fix gosimple issue on client.go
For some reason our static check started to get opinionated about code
that's been there for ages.

One of the suggestions is to improve:
```
INFO: Running golangci-lint on /home/fidencio/go/src/github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/client
client.go:431:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple)
	if strings.HasPrefix(sock, "mock:") {
```

And that's what this PR is about.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-09 17:18:08 +02:00
Fabiano Fidêncio
89cf168c92 virtcontainers: Ignore a staticcheck error on cpuset.go
First of all, cpuset.go just comes from kubernetes and we shouldn't be
doing much with this file apart from updating it every now and then
(but that's material for another PR).

Right now, due to some change on the static checks we use as part of our
CI, we started getting issues as:
```
INFO: Running golangci-lint on /home/fidencio/go/src/github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/cpuset
cpuset.go:60:2: SA4005: ineffective assignment to field Builder.done (staticcheck)
	b.done = true
```

For those, let's just ignore the lint and move on.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-09 17:17:12 +02:00
Jakob Naucke
f793b28dfd
Merge pull request #2193 from Jakob-Naucke/snap-s390x
snap: Miscellaneous s390x fixes
2021-07-09 11:08:25 +02:00
Jakob Naucke
9577e54e2a
Merge pull request #2168 from Jakob-Naucke/fix-cc-suse-s390x
runtime: Use CC=gcc on all RPM-based s390x
2021-07-09 11:07:35 +02:00
Jakob Naucke
e8ec18a9d8
Merge pull request #2027 from Jakob-Naucke/virtio-blk-ccw
s390x: Enable virtio-blk-ccw
2021-07-08 18:22:44 +02:00
James O. D. Hunt
7a481c3f4f
Merge pull request #2133 from jodh-intel/trace-forwarder-dump-only
forwarder: Add dump only option
2021-07-08 15:17:36 +01:00
Jakob Naucke
2cc9006c26
snap: Miscellaneous s390x fixes
- Ported from https://github.com/kata-containers/tests/pull/3612:
  Install protobuf-compiler for agent build on ppc64le & s390x
- Fixes in image target for ppc64le & s390x
  - Install image instead of initrd since it's preferred
  - Use Ubuntu as base since Alpine requires a musl agent (cannot be
    built on ppc64le & s390x because there is no such Rust target)
- Ported from
  https://github.com/kata-containers/kata-containers/pull/1265:
  Fix vmlinux install path
- Install libseccomp-dev on all architectures, not just x86_64

Fixes: #2192
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-08 15:02:47 +02:00
Jakob Naucke
28b2c629e3
runtime: Use CC=gcc on SUSE s390x too
This setting is required, as it is on Fedora-likes.

Fixes: #2167
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-08 15:01:32 +02:00
Jakob Naucke
cfd690b638
virtcontainers: Use virtio-blk-ccw on s390x
if virtio-blk-pci were to be used

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-08 14:59:47 +02:00
Jakob Naucke
8758ce26b7
agent: Enable virtio-blk-ccw
Forward-port of https://github.com/kata-containers/agent/pull/600.
Enable virtio-blk-ccw devices in agent (virtio-blk for s390x, already
enabled in runtime).

Fixes: #2026

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-08 14:59:47 +02:00
James O. D. Hunt
a33d6bae63 forwarder: Add dump only option
Added a `--dump-only` option which disables forwarding of trace spans.
This essentially makes the forwarder a NOP but can be useful for testing
purposes.

Fixes: #2132.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-07-08 13:12:17 +01:00
Fabiano Fidêncio
432296ae7a
Merge pull request #2197 from lifupan/fix_leak_hypervisor
shimv2: fix the issue of leaking the hypervisor processes
2021-07-08 13:49:37 +02:00
Fabiano Fidêncio
cf4a63f1e5
Merge pull request #2137 from likebreath/0628/clh_remove_version_check
runtime: Remove the version check for cloud hypervisor
2021-07-08 10:14:18 +02:00
fupan.lfp
4c809a53d2 shimv2: fix the issue of leaking the hypervisor processes
Since we only send an shutdown qmp command to qemu when do
stopSandbox, and didn't wait until qemu process's exit, thus
we'd better to make sure it had exited when shimv2 terminated.
Thus here to do the last cleanup of the hypervisor.

Fixes: #2198

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2021-07-08 15:43:58 +08:00
Bo Chen
d08603bebb runtime: Remove the version check for cloud hypervisor
It looks like the version check for cloud hypervisor (clh) was added
initially when clh was actively evolving its API. We no longer need the
version check as clh API has been fairly stable for its recent releases.

Fixes: #1991

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-07-06 18:42:59 -07:00
Julio Montes
7d3cf04f29
Merge pull request #2125 from LiangZhou-CTY/patch-1
agent: fix wrong regular exp to fetch guest-cid
2021-07-06 07:01:43 -05:00
Tim Zhang
3f1aa8ff91
Merge pull request #2084 from liubin/fix/2082-refactor-vc-pkg-oci
runtime: refact virtcontainers/pkg/oci
2021-07-06 19:14:10 +08:00
Bin Liu
26985bbfff
Merge pull request #2173 from Tim-Zhang/enhance-test-execute-hook
agent: enhance tests of execute_hook
2021-07-05 14:36:45 +08:00
Liang Zhou
2c9430123e agent: fix wrong regular exp to fetch guest-cid
Fix the incorrect regular expression to fetch the guest context ID.
In " [^,][^,]* ", [^,]* will match to the next ",",
which is after "socket",  so finally got incorrect result.
Use egrep -o "guest-cid=[0-9]*" instead.

Fixes: #2124

Signed-off-by: Liang Zhou <zhoul110@chinatelecom.cn>
2021-07-05 09:46:03 +08:00
Fabiano Fidêncio
015b3baf06
Merge pull request #2178 from mxpv/config
agent: Cleanup config
2021-07-03 09:51:16 +02:00
Fupan Li
2de9c5b41d
Merge pull request #1969 from liubin/feature/1968-pass-span-context-to-agent
Pass span context from runtime to agent to get a full trace #1968
2021-07-03 09:31:02 +08:00
Maksym Pavlenko
e6b1766f6b agent: Cleanup config
This commit clean up config parsing and testing code to make it a bit more easy to maintain.
- Adds `with_context` from anyhow to include the underlying error. This helps to understand what exactly went wrong.
- Uses ensure and bail as a shorter alternative for `if` checks.
- TestData in test_parse_cmdline is now implements Default to reduce boilerplate code
- Remove `make_err` as it doesn’t make any sense.

Fixes: #2177

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-02 14:28:43 -07:00
Tim Zhang
55c5c871d2 agent: enhance tests of execute_hook
Use which to find the full path of exe before run execute_hook
to avoid error: 'No such file or directory'

Fixes: #2172

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-07-02 14:30:56 +08:00
bin
bd5951247c runtime: add spans and attributes for agent/mount
Add more spans and attributes for agent setup, add devices,
and mount volumes.

Fixes: #1968

Signed-off-by: bin <bin@hyper.sh>
2021-07-02 10:07:28 +08:00
bin
65d2fb5d11 agent: remove instrument attribute for some simple functions
For some simple functions that only process memory data(list/hashmap),
they don't need to be instrumented.

And sometime they may generate non-parent spans, if they are called from
daemon-style "threads".

Fixes: #1968

Signed-off-by: bin <bin@hyper.sh>
2021-07-02 10:07:28 +08:00
bin
cfb8139f36 agent: add more instruments for RPC calls
All RPC calls can get parent span context,
and create new sub-spans for the full trace.

Fixes: #1968

Signed-off-by: bin <bin@hyper.sh>
2021-07-02 10:07:28 +08:00
bin
ae46e7bf97 runtime: pass span context to agent in ttRPC client
Pass span context through ttRPC metadata, that
agent can get parent from the context to create
new sub-spans.

Fixes: #1968

Signed-off-by: bin <bin@hyper.sh>
2021-07-02 10:07:14 +08:00
Fabiano Fidêncio
3fe0af6a9b
Merge pull request #2152 from liubin/fix/2111-update-netlink-libs
agent: update netlink libraries
2021-07-01 12:01:35 +02:00
Bin Liu
15d37d5823
Merge pull request #2040 from lifupan/upgrade_containerd
shimv2: update containerd vendor
2021-07-01 15:55:07 +08:00
bin
66dd8719e3 runtime: refact virtcontainers/pkg/oci
Use common functions wrapping logic of getting values
from annotations, parsing bool/uint32/uint64 and setting
to struct fields.

Fixes: #2082

Signed-off-by: bin <bin@hyper.sh>
2021-07-01 10:14:47 +08:00
Eric Ernst
d0ad388721
Merge pull request #2065 from ManaSugi/format-golang-proto
runtime: Format golang proto code
2021-06-30 11:08:57 -07:00
fupan.lfp
d671f78952 agent: fix the issue of convert OCI spec to RPC spec
Since the rpc spec used an interface to represen the ErrnoRet,
thus the transform function of OCItoGRPC should take care of
this case.

Depends-on: github.com/kata-containers/tests#3629

Fixes: #1441

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2021-06-30 22:56:59 +08:00
fupan.lfp
f607641a6e shimv2: fix the issue bring by updating containerd vendor
Fix the mismatch bring by the upgrading of vendor of  containerd,
cgroup and runtime spec.

Fixes: #1441

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2021-06-30 22:56:51 +08:00
fupan.lfp
79e632bc23 version: update the cri-containerd to v1.5.2
Upgrade the cri-containerd to v1.5.2 for CI.

Fixes: #1441

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2021-06-30 22:53:35 +08:00
fupan.lfp
32c9ae1388 shimv2: update containerd vendor
Since the latest containerd's shimv2 had changed the socket
from abstract unix socket to path unix socket, thus we'd
better to update the vendor to match with the latest containerd.

containerd from v1.3.9, v1.4.3 and v1.5.0 used the path unix socket
instead of abstract socket, thus kata wouldn's support the
containerd's version older than them.

Fixes: #1441

short logs:

15d9703d6 Remove ARM64 releases from release notes
    5d2e8e86d Revert "Release artifacts for Linux ARM64"
    7942ae68b Revert "Specify seccomp target arch for CC"
    3187b6dc8 tests: Adds consumed memory stats test
    969ec8949 Specify seccomp target arch for CC
    c19b7b64d RELEASES.md: recommend alternatives for deprecated
features
    8a62aa1c3 Deprecate built-in aufs snapshotter
    4e7915f80 CI: allow Go 1.13 for Docker/Moby compatibility
    8e589e873 Vagrantfile: update to Fedora 34
    5847340a7 tests: Refactors container image usage
    9f43eade6 Prepare v1.5.0-rc.3 release notes
    4c7b960cb prow needs some additional setup for docker buildx
    2e4c1d4b7 Use the multi-arch version of the test images
    4e00c4b65 integration tests needs lsof
    177273680 Add script to build test images
    1b5d59dfe Add multi-arch support for test images
    78e529727 add integration tests
    2b0e6cdd4 Separate jobs for build and test for openlab/arm64
    cdd075853 Release artifacts for Linux ARM64
    efcb18742 Add unit tests for PID NamespaceMode_TARGET validation
    b48f27df6 Support PID NamespaceMode_TARGET
    909660ea9 process: use the unbuffered channel as the done signal
    0f332dadd Update cgroups for regenerated protos
    391b123a5 adds quiet option for ref
    ab1654d0e Fix PushHandler cannot push image that contains duplicated
blobs
    00f8d32ef add not found debug out for check cmd; update usage
    55734b1c5 Prepare 1.5.0-rc.2 release notes
    3ef337ae3 Update containerd vendors to tags
    fbe1e140f Update Go to 1.16.3
    c1d1edbad gha: use sudo -E in some places to prevent dropping
env-vars
    7966a6652 Cleanup code
    5d79d3adb go.mod: update kubernetes to v1.20.6
    1c03c377e go.mod: github.com/containerd/fifo v1.0.0
    12a2a2108 go.mod: github.com/google/uuid v1.2.0
    3292ea586 pkg/seccomp: use sync.Once to speed up IsEnabled
    00b5c99b1 pkg/seccomp: simplify IsEnabled, update doc
    6dd29c25f go.mod: github.com/containerd/aufs
    330a2a809 go.mod: github.com/containerd/zfs
    34780d67a runtime/shim: check the namespace flag first
    c3dde8c4b freebsd: add zfs to the default plugins
    b431fe4fc freebsd: don't run shim delete in deleted dir
    1f4192daf freebsd: exclude v1 runtimes
    cb1580937 metadata: improve deleting a non-empty namespace's error
message
    5bf84034d Remove junit test result processor
    b83d04f91 Add variable names to runtime's interface definitions
    993b86399 Add shim start opts
    9e576b889 Optimize backoff
    5c02688b5 converter: use OpenWriter helper function
    fcf3b275f Add lock for ListPids
    fdb76f55d Fix backword-compatibility issue of non-versioned config
file
    d21fe4625 adds log for each failed host and status not found on host
    8a4cbabc6 Reimport windows layers when comitting snapshots
    2de38a926 fix(windows): create debug npipe failure
    41fc516a2 docs/rootless.md: recommend "easy way" over "hard way"
    864a3322b go.mod: github.com/containerd/go-cni v1.0.2
    ee34caccb go.mod: github.com/Microsoft/go-winio v0.4.17
    d478676d3 go.mod: github.com/containerd/imgcrypt v1.1.1
    1dd45d51c go.mod: github.com/containerd/typeurl v1.0.2
    abd4be07a fix the 404 url
    978ebbef6 Prepare 1.5.0-rc.1 release
    ce116d4c5 go.mod: github.com/containerd/imgcrypt
v1.1.1-0.20210412181126-0bed51b9522c
    0550c3233 containerd-stress: add snapshotter option for stress test
to use
    8a04bd052 address recent runtimes config confusion
    c4778fe1b go.mod: github.com/containernetworking/plugins v0.9.1
    5ce35ac39 devmapper: log pool status when mkfs fails
    75097b8ca hcsshim seems to have been updated
    9ad087947 Switch all our tests to version 2
    e96d2a5d9 Revert "remove two very old no longer used runtime
options"
    14f357b90 CI: update crun to 0.19
    294331060 go.mod: github.com/containerd/console v1.0.2
    bb6c0c2de Add more bolt utils
    0ad8c0a16 Decouple shim start from task creation
    c7504987e Implement windowsDiff.Compare via hcsshim/pkg/ociwclayer
    a64a76846 Replace inline applyWindowsLayer using hcsshim
    149fa366f Don't tease the logger with a %-less format string
    b399e2ef6 Don't lose Compare failure if aborting diff upload fails
    36bf3f0e8 go.mod: github.com/Microsoft/hcsshim v0.8.16
    8e1a8ecd8 Prepare v1.5.0-rc.0
    45df696bf Fix return event publishing error
    4bc8f692f optimize cri redirect logs
    9bc8d63c9 cri/server: use containerd/oci instead of
libcontainer/devices
    dd16b006e merge in the move to the new options type
    9144ce967 shows our runc.v2 default options in the containerd
default config
    3d20fa930 fix TestSetOOMScoreBoundaries
    4d4117415 Change CRI config runtime options type
    21ebeef74 integration: use busybox:1.32.0 since latest is
unavailable
    f9bcf4a8a add section link
    d4be6aa8f rm mirror defaults; doc registry deprecations
    7bb73da6b runtime/v2/shim: remove unused SetScore() and remove
sys.OOMScoreMaxKillable
    91e7d21ee sys: add AdjustOOMScore() utility
    44240116a sys: add boundary checks to SetOOMScore()
    ace1912bb sys: use assert for error checks in OOM tests
    6e7271522 sys: add missing pre-condition checks in tests
    badd60d3f sys: un-export runningPrivileged(), remove
runningUnprivileged()
    21a175860 go.mod github.com/klauspost/compress v1.11.13
    58c5fd09e re-enable cri test
    da998c81e move to gcr.io/k8s-staging-cri-tools test images
    8ba8533bd pkg/cri/opts.WithoutRunMount -> oci.WithoutRunMount
    92ea98eda cri-cni-release: add imgcrypt binaries (v1.1.0)
    4c1fa5719 remotes/docker: Only return "already exists" on push when
the upload was successful
    0186a329e remove two very old no longer used runtime options
    58a07754a Temporarily disable cri-tools critest
    7ae0a60fb Add OCI ref.name to unique key in remotes handler
    5ada2f74a Keep host order as defined in TOML file
    d9ff8ebef support multi-arch images for windows via ctr
    af1e2af72 ci: upload junit formatted test results
    6866b36ab Add workaround to keep docker hosts structs private
    c54d92c79 image: use generic decompressor for calculating DiffID
    1faca349e integration/client: rename package to "client"
    6fc9e4500 synchronize replace rules in integration/client go.mod
with main go.mod
    9e19a2984 Fix hosts test on Windows
    3f406d4af Cleanup vendor
    d56b49c13 Rewrite Docker hosts parser
    e1f51ba73 Use os.File#Seek() to get the size of a block device
    ddd4298a1 Migrate current TOML code to github.com/pelletier/go-toml
    499c2f7d4 Vendor github.com/pelletier/go-toml
    61c749036 integration/util: remove dependency on k8s.io/klog/v2
    d9765f7bf Extend default timeout for nested VM integration run
    5e94745f2 ctr: add --user for task exec
    f8c2f0475 remotes/ctr: allow to limit max concurrent uploads like
downloads
    4674ad7be Ignore some tests on darwin
    55450e773 Run unit tests on CI for MacOS
    311e326a1 Add CI job to cross compile all the things
    10a498c7c Update go-winio to fix compile error on armv7
    1a9c6f557 Revendor zfs to to fix integer overflow
    1fd3d12f9 `go mod tidy` the client integration test module
    da7d96ba3 Clean up WCOW layers after tests in the correct order
    9ad87b9ba adds critools-version
    72b7f4bab task: allow checkpoint on pause state
    e4b9b1038 Make CRI registry docs more clear
    ec4d7736d Increase timeout for linux integration tests
    eb7c7c71e Fix oom tests on non Linux
    708299ca4 Move RunningInUserNS() to its own package
    0886ceaea Fix reference ordering in CRI image store
    bf9db47e8 add caller info to the testHook
    305b42583 use happy-eyeballs for port-forwarding
    22ef69d77 Support HTTP debug in ctr
    01765d097 night ci fix: add packages for ubuntu 20.04
    8cdc1f13b go.mod: github.com/containerd/zfs
v0.0.0-20210322090317-0e92c2247fb7
    30e1e66e5 runtime/v2: Fix defer cleanup
    33776ada0 Use specific image for user namespaces tests
    7704fe72d Specifically mention "mkfs.ext4" on the error from the
command
    1410220d8 Fix error log when copy file
    fe787efa2 Fix error log when kill shim
    8d8c15ca5 contentproxy: ensure grpc stream is closed on commit
    6e343f25e Switch test image to a non rate-limited manifest list
    9fdc96c09 runtime/v2: add comment for checkCopyShimLogError
    24602e7a9 change default runtime for containerd-stress app
    8731888ec Re-enable CRIU tests by not using overlayfs snapshotter
    b520428b5 Fix CRIU
    4e76bcf06 gofmt -s -w all the things
    569023fd5 go.mod: github.com/containerd/nri
v0.0.0-20210316161719-dbaa18c31c14
    0e1f59e89 go.mod: github.com/containerd/zfs
v0.0.0-20210315114300-dde8f0fda960
    ffff68866 upgrade pause image to 3.5 for non-root
    88d3881e1 go.mod: github.com/containerd/fifo
v0.0.0-20210316144830-115abcc95a1d
    a22c43fa4 go.mod: github.com/containerd/aufs
v0.0.0-20210316121734-20793ff83c97
    f6f861736 go.mod: github.com/containerd/btrfs
v0.0.0-20210316141732-918d888fb676
    460b35236 go.mod: kubernetes v1.20.4
    5e484c961 runtime/v2/runc: fix the defer cleanup of the NewContainer
    e6086d9c0 Prepare release notes for v1.5.0-beta.4
    34b7a5f09 Update mailmap
    ba8f9845e move overlay-checks to an overlayutils package
    7776e5ef2 Support adding devices by dir
    d895118c7 runtime/v2/runc: fix leaking socket path
    a76cefd12 plugin status should be skip, not error
    766e7953a Change dgst to digest in debug
    4e8b2f309 rootfs: fix the error handling of the createInitLayer
    d3ad7f390 cmd/ctr: use e.g. in the command usage
    231bbdc37 cmd/ctr: fix export command
    ecb881e5e add imgcrypt stream processors to the default config
    ac2726e12 cmd/containerd: deduplicate config*.go
    9a7ca39cb defaults: add DefaultConfigDir
    8f863afd3 Use net.IP.IsLoopback() to match loopback addresses
    eabd9b98b runtime: ignore file-already-closed error if dead shim

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2021-06-30 22:53:24 +08:00
Fabiano Fidêncio
550029c473
Merge pull request #2060 from liubin/2059/delete-some-lint-attributes
agent: delete some lint attributes
2021-06-30 16:51:07 +02:00
Fabiano Fidêncio
7d05739f01
Merge pull request #2135 from GabyCT/topic/fixdocvirtiofs
docs: Fix url in virtiofs documentation
2021-06-30 16:47:01 +02:00
bin
aa264f915f agent: update netlink libraries
Update rtnetlink to use crate.io to make cargo vendor work.
Add vendor/ to .gitignore.

Fixes: #2111

Signed-off-by: bin <bin@hyper.sh>
2021-06-30 22:39:50 +08:00
Gabriela Cervantes
34bdddbeb5 docs: Fix url in virtiofs documentation
This PR updates the url for virtiofs documentation.

Fixes #2134

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2021-06-30 13:48:29 +00:00
Fabiano Fidêncio
d78e396a33
Merge pull request #2127 from sameo/topic/agent-ctl-build-fix
tools: agent-ctl: Fix build failure
2021-06-30 11:47:02 +02:00
Fabiano Fidêncio
7d37fbfdfb
Merge pull request #2115 from sameo/topic/rust-nix
cargo: Use latest nix crate for all Rust code bases
2021-06-28 08:18:53 +02:00
Fabiano Fidêncio
a8bb8269fe
Merge pull request #2047 from Jakob-Naucke/s390x-skip-hotplug
virtcontainers: Don't fail memory hotplug
2021-06-28 08:18:31 +02:00
Eric Ernst
69bf7e7519
Merge pull request #1964 from egernst/inotify
Add "watchable-mounts" concept to allow for  inotify support of specific types of mounts.
2021-06-25 12:59:04 -07:00
Samuel Ortiz
3e8a07c415 tools: agent-ctl: Fix build failure
Two nix packages with the same version are specified from the lock file.

Fixes #2126

Signed-off-by: Samuel Ortiz <samuel.e.ortiz@protonmail.com>
2021-06-25 12:11:38 +02:00
Samuel Ortiz
f6294226e8 cargo: Use latest nix crate for all Rust code bases
Our dependencies already bring several versions of nix, we should avoid
adding even more fragementation.

Fixes #2114

Signed-off-by: Samuel Ortiz <samuel.e.ortiz@protonmail.com>
2021-06-25 03:38:37 +02:00
Eric Ernst
064dfb164b runtime: Add "watchable-mounts" concept for inotify support
To workaround virtiofs' lack of inotify support, we'll special case
particular mounts which are typically watched, and pass on information
to the agent so it can ensure that the mount presented to the container
is indeed watchable (see applicable agent commit).

This commit will:
 - identify watchable mounts based on file count and mount source
 - create a watchable-bind storage object for these mounts to
   communicate intent to the agent
 - update the OCI spec to take the updated watchable mount source into account

Unit tests added and updated for the newly introduced
functionality/functions.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-06-24 10:07:06 -07:00
Eric Ernst
3f0f1ceba0 docs: inotify: add initial documentation
We're introducing a workaround for enabling users to utilize inotify on
mounts that are backed by virtiofs. Let's add some documentation on how
this work.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-06-24 10:07:06 -07:00
Maksym Pavlenko
6a93e5d593 agent: Initial watchable-bind implementation
Add support for watchable-bind storage driver. When watchable-bind storage
is present, the agent will create a watchable path in a tmpfs, and poll the
watchable-bind source to keep this new mount-point up to date.

This poll will allow the agent to present the mount-point to the
container, allowing for inotify usage by the container workload.

If a mount becomes too large, either in file count or in overall size,
we want to stop treating it as watchable, and instead just treat as a
bindmount. This'll help avoid DoS by growing tmpfs too large, as well
as limiting time spent scanning files. If a watchable-bind grows beyond
8 files (arbitrary sane number for certs/secrets) or 1MB (limit on ConfigMap size),
we treat it as a normal bind.

Fixes: #1879

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Samuel Ortiz <samuel.e.ortiz@protonmail.com>

agent: watcher: SandboxStorages check loop cleanup
2021-06-24 10:07:06 -07:00
Eric Ernst
57c0cee0a5 runtime: Cleanup mountSharedDirMounts, shareFile parameters
There's no reason to pass the paths; they can be
determined when they are actually used.

Let's make the return values more comparable to the other mount handling
functions (we'll add storage object in future commit), and pass the mount maps as
function parameters.

...No functional changes here...

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-06-24 10:07:06 -07:00
Chelsea Mafrica
ac0bd57748
Merge pull request #2003 from cmaf/fix-span-runHooks
tracing: Make runHooks() span creation return context
2021-06-24 07:50:42 -07:00