--config 标志在
update
命令上接受用于配置
成员集群上 Config Sync 行为的字段。--fleet-default-member-config 标志在 update
和
enable
命令中接受同一组字段,用于配置
舰队默认
Config Sync 行为。
与 --config 命令中的
apply
标志(用于定义底层配置 API 字段的 Google Cloud CLI
表示法
)不同,--config 和
--fleet-default-member-config 标志在 update 命令中分别直接采用
Spec API 字段
和
MembershipSpec API 字段的
架构。
enable 命令中的 --fleet-default-member-config 标志同样已从 Google Cloud CLI
表示法
迁移到 alpha
发布轨道中的 MembershipSpec API 字段架构,但为了实现向后
兼容性,系统支持之前的表示法。
本页面介绍了在 --config 和 --fleet-default-member-config 标志将配置字段发送到 API 之前,gcloud CLI 对 API 字段架构中的配置字段进行的额外处理。
默认字段值
| 字段 | 说明 |
|---|---|
configSync.enabled |
如果用户指定了 configSync 字段,
configSync.enabled 默认为 true。
|
version |
对于 --config 标志,Config Sync 版本默认为成员配置中的现有值;如果未配置,则默认为成员集群上安装的 Config Sync 版本。使用
describe
命令可查看这些值。如果成员集群上未安装 Config Sync,则 gcloud CLI 会在 API 请求中将版本保留为未设置状态。对于 --config 和 --fleet-default-member-config,请分别参阅 Spec API 字段和 MembershipSpec API 字段中 version 子字段的说明,以确定 API 的默认 Config Sync 版本行为。 |
不支持的字段
如果设置了以下任何旧版字段,--config 和 --fleet-default-member-config 命令中的
update
和
enable
标志会出错:
configSync.metricsGcpServiceAccountEmailpolicyControllerhierarchyControllerbinauthzmanagement
配置文件示例
本部分提供了可传递给
--config 和 --fleet-default-member-config 标志的
update
和
enable
命令的配置示例。
与
命令页面上的示例相比,
以下配置不包含applySpecVersion和spec字段。
apply对于 apply 命令,configSync.deploymentOverrides[].deploymentName 字段为 spec.configSync.deploymentOverrides[].name。
其他字段(包括以下示例中未包含的字段)的命名方式也不同。
以下示例展示了一个基本配置:
configSync:
enabled: true
sourceFormat: unstructured
git:
syncRepo: https://github.com/GoogleCloudPlatform/anthos-config-management-samples
syncBranch: main
secretType: none
policyDir: config-sync-quickstart/multirepo/root
以下示例展示了一个更复杂的配置:
configSync:
enabled: true
stopSyncing: true
sourceFormat: unstructured
git:
syncRepo: https://github.com/GoogleCloudPlatform/anthos-config-management-samples
syncBranch: main
secretType: none
policyDir: config-sync-quickstart/multirepo/root
deploymentOverrides:
- deploymentName: reconciler-manager
deploymentNamespace: config-management-system
containers:
- containerName: reconciler-manager
cpuRequest: 50m
cpuLimit: 100m
memoryRequest: 256Mi
memoryLimit: 512Mi