Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions content/en/docs/concepts/override.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ spec:
{"cluster-name":"${MEMBER-CLUSTER-NAME}"}
```

> Note: Using `op: add` with the path `/metadata/labels` (pointing to the entire labels map) will **replace all existing labels** with the value provided. To add a single label without affecting existing ones, use a more specific path such as `/metadata/labels/cluster-name`.

The `ClusterResourceOverride` object above will add a label `cluster-name` with the value of the `memberCluster` name to the `ClusterRole` named `secret-reader` on clusters with the label `env: prod`.

#### Example: Using `${MEMBER-CLUSTER-LABEL-KEY-...}` in a `ClusterResourceOverride`
Expand Down Expand Up @@ -165,6 +167,8 @@ spec:
value: "${MEMBER-CLUSTER-LABEL-KEY-region}"
```

> Note: To replace an existing label value, use `op: replace` instead (e.g., `op: replace` with path `/metadata/labels/cluster-region`). However, `op: replace` will fail with an error if the label does not already exist on the resource.

When applied to a cluster with the label `region: us-west`, the `ClusterRole` will receive the label
`cluster-region: us-west`. When applied to a cluster with `region: eu-central`, the label will be
`cluster-region: eu-central`.
Expand Down
4 changes: 3 additions & 1 deletion content/en/docs/how-tos/cluster-resource-override.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ spec:
{"cluster-name":"${MEMBER-CLUSTER-NAME}"}
```

> Note: To add a new label to the existing labels, please use the below configuration:
> Note: Using `op: add` with the path `/metadata/labels` (pointing to the entire labels map) will **replace all existing labels** with the value provided. To add a new label to the existing labels, please use the below configuration:
>
> ```yaml
> - op: add
Expand Down Expand Up @@ -208,6 +208,8 @@ spec:

When applied to a cluster with the label `region: us-west`, the `ClusterRole` will receive the label `cluster-region: us-west`.

> Note: To replace an existing label value, use `op: replace` instead (e.g., `op: replace` with path `/metadata/labels/cluster-region`). However, `op: replace` will fail with an error if the label does not already exist on the resource.

You can also use multiple label variables together. For example, to add annotations sourced from cluster labels:

```yaml
Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/how-tos/resource-override.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ spec:
{"cluster-name":"${MEMBER-CLUSTER-NAME}"}
```

> Note: To add a new label to the existing labels, please use the below configuration:
> Note: Using `op: add` with the path `/metadata/labels` (pointing to the entire labels map) will **replace all existing labels** with the value provided. To add a new label to the existing labels, please use the below configuration:
>
> ```yaml
> - op: add
Expand Down