From 8127c768379a50915080f29a034e32d020fd3546 Mon Sep 17 00:00:00 2001 From: Alexandra Molnar Date: Fri, 15 Nov 2024 12:28:25 +0000 Subject: [PATCH] https://issues.redhat.com/browse/ACM-15508 - provide more info about extraLabels for SiteConfig --- apis/clusterinstance.json.adoc | 38 +++++++- .../siteconfig_installation_templates.adoc | 92 ++++++++++++++++++- 2 files changed, 125 insertions(+), 5 deletions(-) diff --git a/apis/clusterinstance.json.adoc b/apis/clusterinstance.json.adoc index 7e2d625741..aa636d5374 100644 --- a/apis/clusterinstance.json.adoc +++ b/apis/clusterinstance.json.adoc @@ -362,9 +362,24 @@ 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.|object +__optional__|Specify additional cluster-level labels to be applied to the rendered templates by using the following format: + +[source,yaml] +---- +extraLabels: + ManagedCluster: + common: "true" + label-a : "value-a" +---- +|object |*extraManifestsRefs* + __optional__|Specify the list of the `ConfigMap` object references that contain additional manifests to be applied to the cluster.|array |*holdInstallation* + @@ -438,9 +453,24 @@ 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.|object +__optional__|Specify additional node-level labels to be applied to the rendered templates. + +[source,yaml] +---- +extraLabels: + ManagedCluster: + common: "true" + label-a : "value-a" +---- +|object |*hostName* + __required__|Define the host name.|string |*installerArgs* + diff --git a/mce_acm_integration/siteconfig/siteconfig_installation_templates.adoc b/mce_acm_integration/siteconfig/siteconfig_installation_templates.adoc index 4b90ec24ba..11b7273466 100644 --- a/mce_acm_integration/siteconfig/siteconfig_installation_templates.adoc +++ b/mce_acm_integration/siteconfig/siteconfig_installation_templates.adoc @@ -14,6 +14,7 @@ For more information about installation templates, see the following documentati * <> * <> * <> +* <> [#template-functions] == Template functions @@ -70,6 +71,8 @@ The {sco} provides the following default, validated, and immutable set of templa `NetworkSecret` |=== +For more information about the `ClusterInstance` API, see link:../../apis/clusterinstance.json.adoc#clusterinstance-api[ClusterInstance API]. + [#special-template-variables] == Special template variables @@ -136,4 +139,91 @@ metadata: namespace: example-namespace ---- -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. \ No newline at end of file +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-annotations-labels] +== Configuration of additional annotations and labels + +You can configure 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` resource. + +When creating your additional annotations and labels, you must specify a manifest type to allow the {sco} to apply them to all the matching manifests. +However, the annotations and labels are arbitrary and you can set any key and value pairs that are meaningful to your applications. + +*Note:* The additional annotations and labels are only applied to the resources that were rendered through the referenced templates. + +View the following example application of extraAnnotations and extraLabels: + +.Example application of `extraAnnotations` and `extraLabels` +[source,yaml] +---- +apiVersion: siteconfig.open-cluster-management.io/v1alpha1 +kind: ClusterInstance +metadata: + name: "example-sno" + namespace: "example-sno" +spec: + [...] + clusterName: "example-sno" + extraAnnotations: <1> + ClusterDeployment: + myClusterAnnotation: success + extraLabels: <1> + ManagedCluster: + common: "true" + group-du: "" + nodes: + - hostName: "example-sno.example.redhat.com" + role: "master" + extraAnnotations: <2> + BareMetalHost: + myNodeAnnotation: success + extraLabels: <2> + BareMetalHost: + "testExtraLabel": "success" +---- +<1> This field supports cluster-level annotations and labels that the {sco} applies to the the `ManagedCluster` and `ClusterDeployment` manifests. +<2> This field supports 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 +---- + +View the following example of applied labels: + +.Example applied labels +[source,json] +---- +{ + "common": "true", + "group-du": "", + ... +} +---- +-- + +* 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 +---- + +View the following example of applied annotations: + +.Example applied annotation +[source,json] +---- +{ + "myNodeAnnotation": "success", + ... +} +---- +-- \ No newline at end of file