The `--config` flag on the
[`update`](https://docs.cloud.google.com/sdk/gcloud/reference/alpha/container/fleet/config-management/update.md.txt)
command accepts fields to configure the behavior of Config Sync on
membership clusters. The `--fleet-default-member-config` flag on the `update`
and
[`enable`](https://docs.cloud.google.com/sdk/gcloud/reference/alpha/container/fleet/config-management/enable.md.txt)
commands accepts the same set of fields to configure the
[fleet-default](https://docs.cloud.google.com/kubernetes-engine/fleet-management/docs/manage-features.md.txt)
Config Sync behavior.

Unlike the `--config` flag on the
[`apply`](https://docs.cloud.google.com/sdk/gcloud/reference/beta/container/fleet/config-management/apply)
command, which defines a Google Cloud CLI
[representation](https://docs.cloud.google.com/kubernetes-engine/config-sync/docs/reference/gcloud-apply-fields.md.txt#config_sync)
of the underlying configuration API fields, the `--config` and
`--fleet-default-member-config` flags on the `update` command directly adopt the
schema of the
[Spec API field](https://docs.cloud.google.com/kubernetes-engine/fleet-management/docs/reference/rpc/google.cloud.gkehub.configmanagement.v2alpha.md.txt#google.cloud.gkehub.configmanagement.v2alpha.Spec)
and
[MembershipSpec API field](https://docs.cloud.google.com/kubernetes-engine/fleet-management/docs/reference/rpc/google.cloud.gkehub.configmanagement.v1alpha.md.txt#google.cloud.gkehub.configmanagement.v1alpha.MembershipSpec),
respectively. The `--fleet-default-member-config` flag on the
`enable` command has likewise migrated from the Google Cloud CLI
[representation](https://docs.cloud.google.com/kubernetes-engine/config-sync/docs/reference/gcloud-apply-fields.md.txt#config_sync)
to the `MembershipSpec` API field schema in the
[`alpha`](https://docs.cloud.google.com/sdk/gcloud/reference/alpha/container/fleet/config-management/enable.md.txt)
release track, but the previous representation is supported for backward
compatibility.

This page documents the additional gcloud CLI-specific handling of
the configuration fields in the API field schema before the `--config` and
`--fleet-default-member-config` flags send them to the API.

> [!NOTE]
> **Note:** These flags support configuration fields in both `camelCase` and `snake_case`.

## Default field values

| Field | Description |
|---|---|
| `configSync.enabled` | If the user specifies the `configSync` field, `configSync.enabled` defaults to `true`. |
| `version` | For the `--config` flag, the Config Sync version defaults to its existing value in the membership configuration, or if it's not configured, the version of Config Sync installed on the membership cluster. Use the [describe](https://docs.cloud.google.com/sdk/gcloud/reference/container/fleet/config-management/describe.md.txt) command to view these values. If Config Sync is not installed on the membership cluster, gcloud CLI leaves the version unset in the API request. For `--config` and `--fleet-default-member-config`, see the description of the `version` sub-field in the [Spec API field](https://docs.cloud.google.com/kubernetes-engine/fleet-management/docs/reference/rpc/google.cloud.gkehub.configmanagement.v2alpha.md.txt#google.cloud.gkehub.configmanagement.v2alpha.Spec) and [MembershipSpec API field](https://docs.cloud.google.com/kubernetes-engine/fleet-management/docs/reference/rpc/google.cloud.gkehub.configmanagement.v1alpha.md.txt#google.cloud.gkehub.configmanagement.v1alpha.MembershipSpec), respectively, to determine the API's default Config Sync version behavior. |

## Unsupported fields

The `--config` and `--fleet-default-member-config` flags on the
[`update`](https://docs.cloud.google.com/sdk/gcloud/reference/alpha/container/fleet/config-management/update.md.txt)
and
[`enable`](https://docs.cloud.google.com/sdk/gcloud/reference/alpha/container/fleet/config-management/enable.md.txt)
commands error if any legacy fields are set. To avoid setting those fields,
follow the workarounds in their API field descriptions, which are defined under
the
[Spec API field](https://docs.cloud.google.com/kubernetes-engine/fleet-management/docs/reference/rpc/google.cloud.gkehub.configmanagement.v2alpha.md.txt#google.cloud.gkehub.configmanagement.v2alpha.Spec)
for the `--config` flag and the
[MembershipSpec API field](https://docs.cloud.google.com/kubernetes-engine/fleet-management/docs/reference/rpc/google.cloud.gkehub.configmanagement.v1alpha.md.txt#google.cloud.gkehub.configmanagement.v1alpha.MembershipSpec)
for the `--fleet-default-member-config` flag.

The following is a list of legacy fields:

- `configSync.metricsGcpServiceAccountEmail`
- `policyController`
- `hierarchyController`
- `binauthz`
- `management`

## Example configuration files

This section provides examples of configurations which can be passed to the
`--config` and `--fleet-default-member-config` flags on the
[`update`](https://docs.cloud.google.com/sdk/gcloud/reference/alpha/container/fleet/config-management/update.md.txt)
and
[`enable`](https://docs.cloud.google.com/sdk/gcloud/reference/alpha/container/fleet/config-management/enable.md.txt)
commands.

Compared to the
[examples on the `apply` command page](https://docs.cloud.google.com/kubernetes-engine/config-sync/docs/reference/gcloud-apply-fields.md.txt#example_gcloud_apply_spec),
the following configurations don't contain `applySpecVersion` and `spec` fields.
The `configSync.deploymentOverrides[].deploymentName` field is
`spec.configSync.deploymentOverrides[].name` for the `apply` command.
Other fields, including ones not in the following examples, are named
differently as well.

The following example shows a basic configuration:

```yaml
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
```

The following example shows a more complex configuration:

```yaml
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
```