Updated on 2025-05-30 GMT+08:00

ccictl set selector

Scenario

Set the selector on a resource. A selector must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters. If --resource-version is specified, the updates will use this resource version. Otherwise, the existing resource version will be used.

ccictl set selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]

Constraints

  • Currently, selectors can only be set on Service objects.
  • The new selector will overwrite the old selector if the resource had one prior to the invocation of set selector.

Examples

# Set the selector after a Service is created.
ccictl create service loadbalancer my-svc --tcp=8088:8088 --elb-id="xxx" -o yaml -nt1 | ccictl set selector --local -f - 'environ
ment=qa' -oyaml

Options

--all

If the value is true, all resources in the namespace of the specified resource type are selected.

--allow-missing-template-keys     Default: true

If the value is true, the error in the template is ignored when a field or mapping key is missing in the template. This option applies only to the Golang and JSONPath output formats.

-f, --filename strings

File names to distinguish different resources

-h, --help

Help information for set selector

--local

If the value is true, set selector will not communicate with the API server and will run locally.

-o, --output string

Output format. The value options include json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, and jsonpath-file.

-R, --recursive

Process the directory used in -f or --filename recursively. This option is useful when you want to manage related manifests organized within the same directory.

--resource-version string

If the value is not empty, the selector update succeeds only when the given value is the current resource version of the object. This option is valid only when a single resource is specified.

--template string

Template character string or template file path used when -o is set to go-template or go-template-file. The Golang template format is [http://golang.org/pkg/text/template/#pkg-overview].

The following ccictl options can also be used in subcommands:

Parent command options