Command line
This page lists every myks command, how the positional selectors pick
environments and applications, and every global flag. Run
myks <command> --help for the same information in the terminal.
Commands
Section titled “Commands”| Command | What it does |
|---|---|
render |
Syncs external sources and renders manifests. See render. |
init |
Creates a new project in the current directory. See init. |
inspect |
Shows environments, applications, prototypes, data values and their origin. See inspect.md. |
cleanup |
Removes rendered output and cache entries that no environment uses. See cleanup. |
migrate |
Converts a ytt data-values project to the KCL configuration layer. See migration.md. |
print-config |
Prints the effective configuration: .myks.yaml, MYKS_* variables and flags merged. |
completion |
Generates a shell completion script (bash, zsh, fish, powershell). |
ytt, vendir, kbld |
Runs the embedded copy of the tool, for example myks ytt -f config.yaml. |
<plugin> |
Runs a plugin for the selected applications. See plugins.md. |
myks --version prints the version, commit and build date.
Selecting environments and applications
Section titled “Selecting environments and applications”render, inspect apps and plugin commands take up to two positional
arguments:
myks render [environments [applications]]- environments is a comma-separated list. Each item is a directory path
under
envs/(theenvs/prefix is optional) and selects every environment at or below that directory.myks render prodprocessesenvs/prod/eu,envs/prod/usand any other environment underenvs/prod. An item can also be an environment ID (prod-eu) once the environment has been rendered: myks findsrendered/envs/prod-euand resolves it back to its directory. In KCL mode IDs always resolve. - applications is a comma-separated list of application names (not prototype names). When omitted, all applications of the selected environments are processed.
ALLin either position means “all”.- No arguments turns on Smart Mode for
renderand plugin commands: myks processes only what your Git changes affect.inspectandcleanupnever use Smart Mode; without arguments they cover everything.
myks render # Smart Modemyks render ALL # every application in every environmentmyks render prod # everything under envs/prodmyks render prod/eu,stage frontend # one application in two subtreesmyks render ALL frontend,backend # two applications wherever they are deployedrender
Section titled “render”myks render [environments [applications]] [--sync | --render]Runs both stages for the selected applications: sync downloads sources with
vendir and builds Helm dependencies, render runs the
render pipeline and writes the result to rendered/.
| Flag | Effect |
|---|---|
-s, --sync |
Only sync sources. |
-r, --render |
Only render, reusing the sources of the last sync. Mutually exclusive with --sync. |
With --render, myks warns about applications whose sources look unsynced (no
sync has run, or a vendored directory is missing), because they may render with
missing sources.
All selected applications are processed even when some fail; the command exits non-zero if any of them failed.
After processing, myks deletes the rendered output
(rendered/envs/<env-id>/<app>/ and rendered/argocd/<env-id>/app-<app>.yaml)
of applications that are no longer listed in a processed environment.
myks render ALL (a single ALL) also deletes the rendered output of
environments that no longer exist; myks render ALL ALL and Smart Mode runs do
not. Use cleanup to do it explicitly.
Credentials for private sources are passed with VENDIR_SECRET_* environment
variables, see sources.md.
myks init [--force] [--argocd] [--ci github] [--print] [--components <list>]Creates envs/, prototypes/, rendered/envs/, .gitignore and .myks.yaml
in the current directory, plus two sample environments (dev and prod) that
run one sample Helm chart. It refuses to overwrite any of these unless you pass
--force.
| Flag | Effect |
|---|---|
-f, --force |
Overwrite existing files. |
--argocd |
Also generate Argo CD resources for both environments, and add an Argo CD installation to dev. Without it, argocd.enabled is false. |
--ci github |
Also write GitHub Actions workflows that render pull requests and catch stale output on the default branch, see GitOps and CI. |
--print |
Print files instead of writing them. Applies to the config, gitignore, schema and ci-github components. |
--components <list> |
Comma-separated subset of config, environments, gitignore, prototypes, schema, ci-github. Default: all but ci-github. environments and prototypes control the samples. |
myks init --print --components schema prints the built-in data-values schema,
which is the reference for every myks setting (argocd, helm, kbld,
render, yttPkg). myks init --print --components config prints a
.myks.yaml with all
naming conventions spelled
out.
init scaffolds a ytt data-values project. See
kcl-mode.md for KCL projects.
cleanup
Section titled “cleanup”myks cleanup [--manifests] [--cache] [--dry-run]| Flag | Effect |
|---|---|
--manifests |
Delete rendered output of environments and applications that are no longer configured. |
--cache |
Delete entries in .myks/vendir-cache/ that no application links to. |
--dry-run |
Log what would be deleted, delete nothing. |
Without --manifests and --cache, both run. cleanup always considers all
environments and takes no positional arguments. See
optimizations.md.
print-config
Section titled “print-config”Prints the configuration myks runs with, after merging .myks.yaml, MYKS_*
environment variables and flags. Useful to check which config file and root
directory are picked up.
Global flags
Section titled “Global flags”Every flag can also be set in .myks.yaml (same key) or as an environment
variable: prefix MYKS_, upper case, . and - replaced with _. Flags win
over environment variables, which win over the config file. See
configuration.md.
| Flag | Environment variable | Default | Effect |
|---|---|---|---|
-a, --async <n> |
MYKS_ASYNC |
0 |
Applications processed in parallel; 0 means no limit. Applies to sync, render, inspect and plugins. |
-l, --log-level <level> |
MYKS_LOG_LEVEL |
info |
trace, debug, info, warn, error, fatal, panic. debug logs every executed command, see inspect.md. |
--smart-mode.base-revision <rev> |
MYKS_SMART_MODE_BASE_REVISION |
none | Git revision Smart Mode compares the working tree with. Without it, only uncommitted changes count. See smart-mode.md. |
--smart-mode.only-print[=fmt] |
MYKS_SMART_MODE_ONLY_PRINT |
off | Print what Smart Mode (or the given selectors) would process and exit. text (default without a value) or json. |
--buffer-plugin-output |
MYKS_BUFFER_PLUGIN_OUTPUT |
false |
Collect each plugin run’s stdout and stderr and print them when it finishes, instead of streaming. Keeps output of parallel plugin runs apart. |
--print-stats |
MYKS_PRINT_STATS |
false |
Print the run summary (tool calls, timings, memory, parallelism, lock contention, sync deduplication) to stdout instead of the log on stderr. |
--config <file> |
— | none | Config file to use instead of the first .myks.yaml found in the current directory or its parents. |
Set NO_COLOR to disable colored output; it is also disabled when stdout is not
a terminal.