更新时间:2025-08-06 GMT+08:00
分享

ccictl apply set-last-applied

操作背景

设置 last-applied-configuration 注解使之与某文件内容相匹配。 这会导致 last-applied-configuration 被更新,就像运行了 ccictl apply -f <file> 一样, 但是不会更新对象的任何其他部分。

ccictl apply set-last-applied -f FILENAME

示例

# 设置资源的 last-applied-configuration,使之与某文件内容相同
ccictl apply set-last-applied -f deploy.yaml

# 针对目录中的每一个配置文件执行 set-last-applied 操作
ccictl apply set-last-applied -f path/

# 设置资源的 last-applied-configuration 注解,使之与某文件内容匹配;如果该注解尚不存在,则会被创建。
ccictl apply set-last-applied -f deploy.yaml --create-annotation=true

选项

--allow-missing-template-keys     默认值:true

如果为 true,在模板中字段或映射键缺失时忽略模板中的错误。 仅适用于 golang 和 jsonpath 输出格式。

--create-annotation

如果当前的对象没有 'last-applied-configuration' 注解,将该注解会被创建。

-f, --filename strings

包含 last-applied-configuration 注解的文件的文件名、目录或 URL 的列表。

-h, --help

关于 set-last-applied 的帮助信息。

-o, --output string

输出格式。可选值为: json、yaml、name、go-template、go-template-file、template、templatefile、jsonpath、jsonpath-as-json、jsonpath-file。

--template string

当指定 `-o=go-template` 、`-o=go-template-file` 时使用的模板字符串或模板文件路径。 模板格式为 golang 模板 [http://golang.org/pkg/text/template/#pkg-overview]。

ccictl选项亦可在子命令中生效,列表如下:

父命令ccictl选项列表

相关文档