mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-30 23:37:45 +00:00
Merge pull request #1027 from knittl/feature/kata-subcommands-aliases
cli: Provide aliases for kata-* subcommands and options
This commit is contained in:
@@ -104,7 +104,7 @@ The build will create the following:
|
||||
You can check if your system is capable of creating a Kata Container by running the following:
|
||||
|
||||
```
|
||||
$ sudo kata-runtime kata-check
|
||||
$ sudo kata-runtime check
|
||||
```
|
||||
|
||||
If your system is *not* able to run Kata Containers, the previous command will error out and explain why.
|
||||
|
@@ -25,7 +25,7 @@ All documents must:
|
||||
- Have a `.md` file extension.
|
||||
- Include a TOC (table of contents) at the top of the document with links to
|
||||
all heading sections. We recommend using the
|
||||
[`kata-check-markdown`](https://github.com/kata-containers/tests/tree/master/cmd/check-markdown)
|
||||
[`check-markdown`](https://github.com/kata-containers/tests/tree/master/cmd/check-markdown)
|
||||
tool to generate the TOC.
|
||||
- Be linked to from another document in the same repository.
|
||||
|
||||
|
@@ -48,10 +48,10 @@ Alternatively, if you are using Kata Containers version 1.12.0 or newer, you
|
||||
can check for newer releases using the command line:
|
||||
|
||||
```bash
|
||||
$ kata-runtime kata-check --check-version-only
|
||||
$ kata-runtime check --check-version-only
|
||||
```
|
||||
|
||||
There are various other related options. Run `kata-runtime kata-check --help`
|
||||
There are various other related options. Run `kata-runtime check --help`
|
||||
for further details.
|
||||
|
||||
# Configuration changes
|
||||
|
@@ -18,7 +18,7 @@
|
||||
>
|
||||
> - If you decide to proceed and install a Kata Containers release, you can
|
||||
> still check for the latest version of Kata Containers by running
|
||||
> `kata-runtime kata-check --only-list-releases`.
|
||||
> `kata-runtime check --only-list-releases`.
|
||||
>
|
||||
> - These instructions will not work for Fedora 31 and higher since those
|
||||
> distribution versions only support cgroups version 2 by default. However,
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* [Install Kata](#install-kata)
|
||||
* [Create a Kata-enabled Image](#create-a-kata-enabled-image)
|
||||
|
||||
Kata Containers on Google Compute Engine (GCE) makes use of [nested virtualization](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances). Most of the installation procedure is identical to that for Kata on your preferred distribution, but enabling nested virtualization currently requires extra steps on GCE. This guide walks you through creating an image and instance with nested virtualization enabled. Note that `kata-runtime kata-check` checks for nested virtualization, but does not fail if support is not found.
|
||||
Kata Containers on Google Compute Engine (GCE) makes use of [nested virtualization](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances). Most of the installation procedure is identical to that for Kata on your preferred distribution, but enabling nested virtualization currently requires extra steps on GCE. This guide walks you through creating an image and instance with nested virtualization enabled. Note that `kata-runtime check` checks for nested virtualization, but does not fail if support is not found.
|
||||
|
||||
As a pre-requisite this guide assumes an installed and configured instance of the [Google Cloud SDK](https://cloud.google.com/sdk/downloads). For a zero-configuration option, all of the commands below were been tested under [Google Cloud Shell](https://cloud.google.com/shell/) (as of Jun 2018). Verify your `gcloud` installation and configuration:
|
||||
|
||||
|
@@ -54,7 +54,7 @@ to enable nested virtualization can be found on the
|
||||
[KVM Nested Guests page](https://www.linux-kvm.org/page/Nested_Guests)
|
||||
|
||||
Alternatively, and for other architectures, the Kata Containers built in
|
||||
[`kata-check`](../../src/runtime/README.md#hardware-requirements)
|
||||
[`check`](../../src/runtime/README.md#hardware-requirements)
|
||||
command can be used *inside Minikube* once Kata has been installed, to check for compatibility.
|
||||
|
||||
## Setting up Minikube
|
||||
|
@@ -65,7 +65,7 @@ The runtime has a built-in command to determine if your host system is capable
|
||||
of running and creating a Kata Container:
|
||||
|
||||
```bash
|
||||
$ kata-runtime kata-check
|
||||
$ kata-runtime check
|
||||
```
|
||||
|
||||
> **Note:**
|
||||
@@ -135,7 +135,7 @@ To see details of your systems runtime environment (including the location of
|
||||
the configuration file being used), run:
|
||||
|
||||
```bash
|
||||
$ kata-runtime kata-env
|
||||
$ kata-runtime env
|
||||
```
|
||||
|
||||
## Logging
|
||||
|
@@ -36,10 +36,6 @@ var commit = "@COMMIT@"
|
||||
// version is the runtime version.
|
||||
var version = "@VERSION@"
|
||||
|
||||
// project-specific command names
|
||||
var envCmd = fmt.Sprintf("%s-env", projectPrefix)
|
||||
var checkCmd = fmt.Sprintf("%s-check", projectPrefix)
|
||||
|
||||
// project-specific option names
|
||||
var configFilePathOption = fmt.Sprintf("%s-config", projectPrefix)
|
||||
var showConfigPathsOption = fmt.Sprintf("%s-show-default-config-paths", projectPrefix)
|
||||
|
@@ -306,8 +306,9 @@ func genericHostIsVMContainerCapable(details vmContainerCapableDetails) error {
|
||||
}
|
||||
|
||||
var kataCheckCLICommand = cli.Command{
|
||||
Name: checkCmd,
|
||||
Usage: "tests if system can run " + project,
|
||||
Name: "check",
|
||||
Aliases: []string{"kata-check"},
|
||||
Usage: "tests if system can run " + project,
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "check-version-only",
|
||||
@@ -344,36 +345,36 @@ EXAMPLES:
|
||||
|
||||
- Perform basic checks:
|
||||
|
||||
$ %s %s
|
||||
$ %s check
|
||||
|
||||
- Local basic checks only:
|
||||
|
||||
$ %s %s --no-network-checks
|
||||
$ %s check --no-network-checks
|
||||
|
||||
- Perform further checks:
|
||||
|
||||
$ sudo %s %s
|
||||
$ sudo %s check
|
||||
|
||||
- Just check if a newer version is available:
|
||||
|
||||
$ %s %s --check-version-only
|
||||
$ %s check --check-version-only
|
||||
|
||||
- List available releases (shows output in format "version;release-date;url"):
|
||||
|
||||
$ %s %s --only-list-releases
|
||||
$ %s check --only-list-releases
|
||||
|
||||
- List all available releases (includes pre-release versions):
|
||||
|
||||
$ %s %s --only-list-releases --include-all-releases
|
||||
$ %s check --only-list-releases --include-all-releases
|
||||
`,
|
||||
project,
|
||||
noNetworkEnvVar,
|
||||
name, checkCmd,
|
||||
name, checkCmd,
|
||||
name, checkCmd,
|
||||
name, checkCmd,
|
||||
name, checkCmd,
|
||||
name, checkCmd,
|
||||
name,
|
||||
name,
|
||||
name,
|
||||
name,
|
||||
name,
|
||||
name,
|
||||
),
|
||||
|
||||
Action: func(context *cli.Context) error {
|
||||
@@ -386,7 +387,7 @@ EXAMPLES:
|
||||
return err
|
||||
}
|
||||
|
||||
span, _ := katautils.Trace(ctx, "kata-check")
|
||||
span, _ := katautils.Trace(ctx, "check")
|
||||
defer span.Finish()
|
||||
|
||||
if context.Bool("no-network-checks") == false && os.Getenv(noNetworkEnvVar) == "" {
|
||||
@@ -413,7 +414,7 @@ EXAMPLES:
|
||||
|
||||
runtimeConfig, ok := context.App.Metadata["runtimeConfig"].(oci.RuntimeConfig)
|
||||
if !ok {
|
||||
return errors.New("kata-check: cannot determine runtime config")
|
||||
return errors.New("check: cannot determine runtime config")
|
||||
}
|
||||
|
||||
err = setCPUtype(runtimeConfig.HypervisorType)
|
||||
|
@@ -437,8 +437,9 @@ func writeJSONSettings(env EnvInfo, file *os.File) error {
|
||||
}
|
||||
|
||||
var kataEnvCLICommand = cli.Command{
|
||||
Name: envCmd,
|
||||
Usage: "display settings. Default to TOML",
|
||||
Name: "env",
|
||||
Aliases: []string{"kata-env"},
|
||||
Usage: "display settings. Default to TOML",
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "json",
|
||||
|
@@ -272,7 +272,7 @@ func beforeSubcommands(c *cli.Context) error {
|
||||
ignoreConfigLogs := false
|
||||
var traceRootSpan string
|
||||
|
||||
subCmdIsCheckCmd := (c.NArg() >= 1 && (c.Args()[0] == checkCmd))
|
||||
subCmdIsCheckCmd := (c.NArg() >= 1 && ((c.Args()[0] == "kata-check") || (c.Args()[0] == "check")))
|
||||
if subCmdIsCheckCmd {
|
||||
// checkCmd will use the default logrus logger to stderr
|
||||
// raise the logger default level to warn
|
||||
@@ -313,7 +313,7 @@ func beforeSubcommands(c *cli.Context) error {
|
||||
// (meaning any spans created at this point will be silently ignored).
|
||||
setExternalLoggers(context.Background(), kataLog)
|
||||
|
||||
if c.NArg() == 1 && c.Args()[0] == envCmd {
|
||||
if c.NArg() == 1 && (c.Args()[0] == "kata-env" || c.Args()[0] == "env") {
|
||||
// simply report the logging setup
|
||||
ignoreConfigLogs = true
|
||||
}
|
||||
|
@@ -63,6 +63,8 @@ _kata_subcmd_needs_existing_container()
|
||||
for cmd in \
|
||||
'kata-check' \
|
||||
'kata-env' \
|
||||
'check' \
|
||||
'env' \
|
||||
'create' \
|
||||
'help' \
|
||||
'list' \
|
||||
|
@@ -210,7 +210,7 @@ Advice:
|
||||
|
||||
- You can check the latest version of Kata Containers by running:
|
||||
|
||||
$ kata-runtime kata-check --only-list-releases
|
||||
$ kata-runtime check --only-list-releases
|
||||
|
||||
EOT
|
||||
}
|
||||
|
Reference in New Issue
Block a user