Skip to content

Commit

Permalink
Update with extraAnnotation
Browse files Browse the repository at this point in the history
  • Loading branch information
amolnar-rh committed Dec 2, 2024
1 parent f2bf012 commit 360ca69
Showing 1 changed file with 36 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ metadata:
If the {sco} deletes the resources, `KlusterletAddonConfig` and `ManagedCluster` custom resources are the first to be deleted, while the `AgentClusterInstall` and `ClusterDeployment` custom resources are the last.

[#extra-labels]
== Configuration of custom labels using the extraLabels field
== Configuration of custom labels and annotations

You can configure additional custom labels to both cluster-level and node-level installation manifests by using the `extraLabels` fields in the `ClusterInstance` API.
The {sco} applies your custom labels to the manifests that you specify in the `ClusterInstance` custom resource.
You can configure additional custom labels and annotations to both cluster-level and node-level installation manifests by using the `extraLabels` and `extraAnnotations` fields in the `ClusterInstance` API.
The {sco} applies your custom labels and annotations to the manifests that you specify in the `ClusterInstance` custom resource.

When creating the labels, you must specify a manifest type to allow the {sco} to apply your custom labels to the appropriate manifest.
However, the labels are arbitrary and you can set any key and value pairs.
When creating your custom labels and annotations, you must specify a manifest type to allow the {sco} to apply your them to the appropriate manifest.
However, the labels and annotations are arbitrary and you can set any key and value pairs.

.Example application of extraLabels
[source,yaml]
Expand All @@ -160,41 +160,58 @@ metadata:
spec:
[...]
clusterName: "example-sno"
extraAnnotations: <1>
ClusterDeployment:
myClusterAnnotation: success
extraLabels: <1>
ManagedCluster:
common: "true"
group-du: ""
sites : "example-sno"
vendor: "auto-detect"
nodes:
- hostName: "example-sno.example.redhat.com"
role: "master"
extraAnnotations: <2>
BareMetalHost:
myNodeAnnotation: success
extraLabels: <2>
BareMetalHost:
"testExtraLabel": "success"
----
<1> These are cluster-level labels that the {sco} applies to the the `ManagedCluster` manifest.
<2> This is a node-level label that the {sco} applies to the `BareMetalHost` manifest.
<1> These are cluster-level labels and annotations that the {sco} applies to the the `ManagedCluster` and `ClusterDeployment` manifests.
<2> These are node-level labels and annotations that the {sco} applies to the `BareMetalHost` manifest.

. You can verify that your custom labels are applied by running the following command:
+
--
[source,terminal]
----
$ oc get managedclusters example-sno -ojsonpath='{.metadata.labels}' | jq
----

.Example applied labels
[source,json]
----
{
"cluster.open-cluster-management.io/clusterset": "default",
"common": "true",
"group-du": "",
"name": "example-sno",
"siteconfig.open-cluster-management.io/owned-by": "example-sno_example-sno",
"sites": "example-sno",
"vendor": "auto-detect"
...
}
----
--

. You can verify that your custom annotations are applied by running the following command:
+
--
[source,terminal]
----
$ oc get bmh example-sno.example.redhat.com -n example-sno -ojsonpath='{.metadata.annotations}' | jq
----

.Example applied labels
[source,json]
----
{
"infraenvs.agent-install.openshift.io": "example-sno",
"siteconfig.open-cluster-management.io/owned-by": "example-sno_example-sno",
"testExtraLabel": "success"
"myNodeAnnotation": "success",
...
}
----
----
--

0 comments on commit 360ca69

Please sign in to comment.