Updated on 2025-04-18 GMT+08:00

ccictl edit

Scenario

Use the default editor to edit resources.

  • The edit command allows you to directly edit any API resource that can be retrieved using the command-line tool. It opens the editor defined by the EDITOR environment variable, or rolls back to using the "vi" of Linux or the "notepad" of Windows. When attempting to open the editor, it first attempts to use the Shell defined in the SHELL environment variable. If no Shell is defined, the default Shell is used. In Linux, the default Shell is /bin/bash. In Windows, the default Shell is cmd.
  • You can edit multiple objects, but only one change is applied at a time. This command accepts the file names and command-line arguments, although the files you point to must be previously saved versions of the resources.
  • Editing is done with the API version used to fetch the resource. To edit using a specific API version, fully qualify the resource, version, and group.
  • The default format is YAML. To edit in JSON, specify -o json.
  • The --windows-line-endings flag can be used to force Windows line endings. Otherwise, the default value for the OS is used.
  • If an error occurs during the update, a temporary file containing the changes that are not applied will be created on the disk. The most common error when updating resources is that another editor has changed the resource on the server. When this happens, you must update the resource to the newer version, or update the temporarily saved copy to include the latest resource version.
ccictl edit (RESOURCE/NAME | -f FILENAME)

Examples

# Edit the Service named registry.
ccictl edit svc/registry

# Use an alternative editor.
EDITOR="nano" ccictl edit svc/registry

# Edit the mydeploy Deployment in JSON using the CCI/v2 API format.
ccictl edit deployment.v2.cci/mydeploy -o json

# Edit the mydeployment Deployment in YAML and save the modified configuration in its annotations.
ccictl edit deployment/mydeployment -o yaml --save-config

Options

-f, --filename strings

List of file names, directories, or file URLs used to edit resources.

-h, --help

Help information for edit

-o, --output string

Output format. The value can be json or yaml.

--output-patch

If the resource is edited, a patch is output.

-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.

--save-config

If the value is true, the configuration of the object is saved in its annotation. Otherwise, the annotation remains unchanged. This flag is useful when you want to run ccictl apply on the object later.

--validate string[="strict"]     Default: "strict"

The value must be one of the following: "strict" (or "true"), "warn", and "ignore" (or "false"). "true" or "strict" will use the pattern definition to validate the input. If the input is invalid, the request fails. "false" or "ignore" will not perform any schema definition checks, but will silently delete all unknown or duplicate fields.

--windows-line-endings

The default value is the native line end format of your platform.

The following ccictl options can also be used in subcommands:

Parent command options