1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-06-10 00:36:16 +02:00
Commit Graph

31 Commits

Author SHA1 Message Date
Furisto 743820f49f
Add commit id to info cmd 2022-01-05 00:19:11 +01:00
Jian Zeng 21eaf4e020
feat: add --resource option to update subcommand
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2021-12-18 23:56:43 +08:00
Jian Zeng 09ecfba778 fix: address review comments
Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2021-12-16 10:19:28 +08:00
Jian Zeng 37bf9387bb feat: add subcommand update 2021-12-16 10:19:28 +08:00
Jian Zeng c3f15252de refactor: extract a common function create_cgroup_manager 2021-12-16 10:19:28 +08:00
Jonathan Hult 02abc5f3ca
Update version for runc compatibility for Moby
Fix for #529

Signed-off-by: Jonathan Hult <jhult@mythics.com>
2021-12-13 22:31:35 -05:00
Theo Paris 2eef38dfc7
Add shell completion (#515) 2021-12-05 14:39:08 +01:00
Travis Sturzl eb083a162a
Merge pull request #513 from Furisto/systemd-part4
Improvements to cgroup support
2021-12-04 20:15:50 -07:00
David Gibson 3626f4f4ec Move global command line options to liboci-cli crate
The OCI CLI document doesn't define any required global options, but there
are a number which are commonly accepted by most runtimes.  We define this
subset there, and incorporate it into the top-level Parser in Youki using

fixes #508

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-03 12:41:55 +11:00
David Gibson 2b66005d93 Move subcommand enums to liboci-cli crate
Because we want to allow a final user to add extension commands
easily, it doesn't work to entirely move the enum of runtime
subcommands into the liboci-cli crate.  However, using the
incoporate those into the top-level enum defined by youki.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-03 12:41:55 +11:00
David Gibson 88ea432b92 Remove version & author from each subcommand
Currently every individual subcommand of youki has clap attributes giving
the youki version and authors.  That seems a bit redundant, since this
information is also on the top level Opts structure.

Having the tags on each does have an effect though: it means that, e.g.
"youki create --help" will give the version and author, as well as plain
"youki --help".  Likewise "youki create --version" will give a result as
well as "youki --version".

Including this is of limited value, though, since it can be easily obtained
from the top level command.  It also provides a barrier to splitting out
the frontend argument parsing from the rest of youki, so remove it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-03 12:41:55 +11:00
David Gibson 09d9fae8cd Move unspecified, but common subcommands to liboci-cli crate
The OCI Runtime Command Line Interface specification[0] specifies only five
subcommands to implement.  However, there are a number of other subcommands
that are commonly implemented by runtimes, and commonly used by their
clients.

Move the parsing of a number of those subcommands into the liboci-cli
crate.  This leaves only one subcommand "info" parsed in the youki crate.
As far as I can tell this is a youki specific extension, since it doesn't
appear in either runc or crun.

[0] https://github.com/opencontainers/runtime-tools/blob/master/docs/command-line-interface.md

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-03 12:41:55 +11:00
David Gibson bf5577ccc0 Move argument structures for specified subcommands to a new crate
It would be useful to have an independent crate covering solely the OCI
command line front end of youki, to which other backends can then be
written.

To start on that, we create a new "oci-runtime-clap" crate, and move some
subcommand structure definitions into it.  For now we only move the
subcommands which are actually specified in the OCI runtime command line
interface document (v1.0.1):

https://github.com/opencontainers/runtime-tools/blob/master/docs/command-line-interface.md

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-02 17:20:31 +11:00
David Gibson 58cad9a27c Split implementation of OCI commands from the argument structures
Currently youki implements each OCI command as a single "exec()" method on
the structure encoding the arguments for that command.  Tying the
implementation to the argument structure makes it difficult to split the
container backend from the command line front end.

So, rework each command as a standalone function.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-02 17:20:31 +11:00
yihuaf 300b396e32 add a test for logfile 2021-12-01 05:39:35 +01:00
yihuaf 16bc2a598f fix logger implementation
remove env_logger and use our own logger
2021-12-01 05:10:40 +01:00
Furisto b501451a47 Remove dead code attributes 2021-11-30 21:04:22 +01:00
utam0k 8310ac4f56
Merge pull request #499 from Furisto/systemd-part3
Support resource restrictions for rootless containers
2021-11-29 07:26:07 +09:00
utam0k 54cbd15fa8
make complex loglevel decision easy to understand. (#482)
* make complex loglevel decision easy to understand.

* guard env val for unit tests.

* make some unit tests serial to handle env val.
2021-11-27 20:50:46 -08:00
Furisto f92b265b80
Ensure rootless containers work on v1 2021-11-25 20:47:40 +01:00
Furisto 419284137e Check if unprivileged user namespaces are enabled 2021-11-24 19:47:58 +01:00
David Gibson d9233e2411 Use /tmp/youki-<uid> rather than /tmp/youki/<uid> in determine_root_path
determine_root_path goes through various options to find a state storage
location, the last of which is /tmp/youki/<uid>.

If a user (say, UID 1000) uses youki, and this final option is selected,
/tmp/youki will be created as well as /tmp/youki/1000.  Both will be
created owned by UID 1000 and with write permissions only for that user.

Them, if another user (say, UID 1001) attempts to use youki and the same
final option is selected, it will fail, because it cannot create
/tmp/youki/1001 under the /tmp/youki owned by UID 1000.

There's really no way to safely create a multi-user shared subdirectory in
/tmp, so instead we should create our per-user directory directly under
/tmp.  We do this by calling it /tmp/youki-<uid> instead.

fixes #496

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-11-24 14:21:54 +11:00
David Gibson 6a496886a8 Create a subdirectory under XDG_RUNTIME_DIR
When using a root state directory from $XDG_RUNTIME_DIR, or from it's
default value of /run/user/<uid>, we don't add a tag specific to youki
to the path.  That means the directories for individual containers
will be placed directly in the general use runtime dir.

That's against normal conventions, and could mean that "youki list"
will see files or directories from other software as if they were
youki managed containers.  Therefore, add "youki" to the base runtime
path from XDG.

fixes #487

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-11-23 15:43:14 +11:00
unknowndevQwQ acf6e31176
Add debug flag (#465) 2021-11-17 20:35:59 +01:00
unknowndevQwQ 1f3d94ede3 style: adjusting the position of parameters and flag declarations 2021-11-13 20:21:47 +08:00
utam0k 2281b07f29
Merge pull request #451 from Furisto/systemd
Support resource control via systemd
2021-11-07 14:05:09 +09:00
yihuaf 8c9aba47fd implement json logger and refactor 2021-11-01 12:39:24 +01:00
yihuaf c3f3e06e76 refactor logger to include format 2021-11-01 09:12:22 +01:00
Furisto 692f0adf86 Minimal working version 2021-10-28 21:53:58 +02:00
Yashodhan Joshi d44944a849 Update clap to beta 5
Reintroduce forbid_empty_values for container_id in commands
2021-10-27 15:55:16 +05:30
Furisto 52a262f306
Fix ignored files 2021-10-22 22:05:15 +02:00