cub unit import
cub unit import
Import a unit from various sources using unified import filters
Synopsis
Import a unit from various sources using unified import filters.
A target must be attached to the unit (cub unit set-target can be used to add one), and the worker corresponding to the target must be connected and ready (cub worker get can be used to get the worker status).
Default mode (with config-file):
cub unit import myunit resources.json
Unified import filter mode currently supports Kubernetes resource filtering:
Examples:
# Include custom resources
cub unit import myunit --where-resource "metadata.namespace = 'import-test-default' AND import.include_custom = true"
# Combined scenario
cub unit import myunit --where-resource "metadata.namespace = 'import-test-default' AND import.include_system = true AND import.include_custom = true"
# Resource type filtering
cub unit import myunit --where-resource "kind = 'ConfigMap' AND metadata.namespace IN ('import-test-default', 'import-test-production')"
# Complex path filtering with wildcards
cub unit import myunit --where-resource "metadata.namespace IN ('import-test-default', 'import-test-production') AND spec.template.spec.containers.*.image = 'nginx:latest'"
cub unit import <slug> [config-file] [flags]
Options
--dry-run Preview imported results
-h, --help help for import
--jq string jq expression, suppressing default output
--json JSON output, suppressing default output
--quiet No default output.
--target string target slug to import into
--timeout string completion timeout as a duration with units, such as 10s or 2m (default "10m0s")
--verbose Detailed output, additive with default output
--wait wait for completion
--where-resource string Resource filter expression using SQL-inspired syntax, similar to the where-filter function. Supports conjunctions with AND. String operators: =, !=, <, >, <=, >=, LIKE, ILIKE, ~~, !~~, ~, ~*, !~, !~*. Pattern matching with LIKE/ILIKE uses % and _ wildcards. Regex operators (~, ~*, !~, !~*) support POSIX regular expressions. Kubernetes-specific filters include import.include_system for system namespaces like kube-system, import.include_cluster for cluster-scoped resources like ClusterRole, and import.include_custom for custom resource types.
--yaml YAML output, suppressing default output
--yq string yq expression, suppressing default output
Options inherited from parent commands
--context string The context to use for this command
--debug Debug output
--space string space ID to perform command on
SEE ALSO
- cub unit - Unit commands