Filters
The unikraft CLI's --filter and --until flags accept filter expressions that match resources based on their field values.
These flags are available on list, wait, and delete subcommands throughout the unikraft CLI.
They aren't available in the legacy kraft cloud CLI.
The syntax extends the containerd filter grammar with negated regex matching, wildcards, and alternative quoting.
Grammar
Code
A quoted-string uses Go string syntax (double quotes with standard
backslash escapes: \n, \t, \\, \", \xNN, \uNNNN, \UNNNNNNNN,
octal \NNN).
A regex-string may only appear after ~= or !~=.
You can delimit it with / or | instead of ", which is convenient when the pattern contains double-quotes or backslashes (for example, name~=/[abc]{0,2}/ or path~=|foo/bar|).
An unquoted-string is any run of non-whitespace, non-comma characters.
Operators
| Operator | Alias | Description | Example |
|---|---|---|---|
== | = | Equals | state==running |
!= | !== | Not equals | state!=stopped |
~= | Matches regular expression | name~="^web-.*" | |
!~= | Doesn't match regular expression | name!~="^test-" | |
| (none) | Field is present and non-empty | description |
Regular expressions use Go regexp syntax.
Field paths
Fields use their output name (the name shown in kv or table output).
Nested fields use dot-separated paths.
Code
Wildcards
A * in a field path iterates over all entries of a map or array field.
The wildcard can appear at any level, and you can chain wildcards.
Code
Negation semantics with wildcards: positive operators (==, ~=) match if
any entry meets the condition.
Negated operators (!=, !~=) match only if all entries meet the condition (that is, no entry matches the negated pattern).
Indexed access
You can also access array elements by zero-based numeric index.
Code
Combining expressions
And (comma-separated within one flag)
Comma-separated selectors within a single --filter value must all match for the filter to include a resource.
Code
Or (repeated flags)
When you specify --filter several times, the filter includes a resource if it matches any of the expressions.
Code
Combining both operators
The two mechanisms compose:
Code
This matches resources that are (running in fra0) or (stopped in was1).
The --until flag
The --until flag uses the same expression syntax as --filter.
It's available on wait subcommands (and aliases to --filter there).
The command polls until every targeted resource matches the expression.
Code
Special fields
The metro field receives special handling: when present in a filter, it restricts which metros the CLI queries rather than filtering results after the fact.
This means --filter metro==fra0 avoids fetching data from other metros entirely.
Examples
Code