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 3, 2024
1 parent f2bf012 commit 31a125f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 22 deletions.
18 changes: 16 additions & 2 deletions apis/clusterinstance.json.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,14 @@ The default value is `None`.|string
|*diskEncryption* +
__optional__|Enable or disable disk encryption for the cluster.|object
|*extraAnnotations* +
__optional__|Specify additional cluster-level annotations to be applied to the rendered templates.|object
__optional__|Specify additional cluster-level annotations to be applied to the rendered templates by using the following format: +
[source,yaml]
----
extraAnnotations:
ClusterDeployment:
myClusterAnnotation: success
----
|object
|*extraLabels* +
__optional__|Specify additional cluster-level labels to be applied to the rendered templates by using the following format: +
[source,yaml]
Expand Down Expand Up @@ -446,7 +453,14 @@ The following values are supported:
* `UEFISecureBoot`
* `legacy`|string
|*extraAnnotations* +
__optional__|Specify additional node-level annotations to be applied to the rendered templates.|object
__optional__|Specify additional node-level annotations to be applied to the rendered templates by using the following format: +
[source,yaml]
----
extraAnnotations:
BareMetalHost:
myNodeAnnotation: success
----
|object
|*extraLabels* +
__optional__|Specify additional node-level labels to be applied to the rendered templates. +
[source,yaml]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For more information about installation templates, see the following documentati
* <<default-templates,Default set of templates>>
* <<special-template-variables,Special template variables>>
* <<custom-manifest-order,Customization of the manifests order>>
* <<extra-annotations-labels,Configuration of additional annotations and labels>>
[#template-functions]
== Template functions
Expand Down Expand Up @@ -140,16 +141,16 @@ 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
[#extra-annotations-labels]
== Configuration of additional annotations and labels

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 additional annotations and labels to both cluster-level and node-level installation manifests by using the `extraAnnotations` and `extraLabels` fields in the `ClusterInstance` API.
The {sco} applies your additional annotations and labels to the manifests that you specify in the `ClusterInstance` additional 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 additional annotations and labels, you must specify a manifest type to allow the {sco} to apply them to the appropriate manifest.
However, the annotations and labels are arbitrary and you can set any key and value pairs that are meaningful to your applications.

.Example application of extraLabels
.Example application of extraAnnotations and extraLabels
[source,yaml]
----
apiVersion: siteconfig.open-cluster-management.io/v1alpha1
Expand All @@ -160,41 +161,59 @@ 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 annotations and labels that the {sco} applies to the the `ManagedCluster` and `ClusterDeployment` manifests.
<2> These are node-level annotations and labels that the {sco} applies to the `BareMetalHost` manifest.

. You can verify that your additional 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 additional 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 annotation
[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 31a125f

Please sign in to comment.