Skip to content
Closed
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
28 changes: 28 additions & 0 deletions modules/ztp-deploying-a-site.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,34 @@ The `enable-crun-master.yaml` and `enable-crun-worker.yaml` CR files are in the
For more information, see "Customizing extra installation manifests in the {ztp} pipeline".
====

.. Optional: To reduce the number of policies for a deployment, you can use hub-side templates with a `PolicyGenTemplate`.
You can use the `spec.clusters.siteConfigMap` section of the `SiteConfig` custom resource (CR) to specify per-site data to be used for hub-side templating.
The following is an example use of the `data` field in `SiteConfig`:
+
[source,yaml]
----
siteConfigMap:
name: site-example-sno <1>
namespace: ztp-pgs <2>
data:
sno-1-sriov-network-vlan-1: "140"
sno-1-sriov-network-vlan-2: "150"
updateConfigMapWithThisValue: "3"
----
<1> Specifies the name of the `ConfigMap` to be created. If unspecified, the default name is `ztp-site-<cluster_name>`.
<2> The default namesapce is `ztp-site`. For a successful integration with the `PolicyGenTemplate`, the `siteConfigMap.namespace` you specify must be the same as the namespace used by the `PolicyGenTemplate` resources.
+
[IMPORTANT]
====
The `spec.clusters.siteConfigMap` section is available for `SiteConfig` CRs with `apiVersion: ran.openshift.io/v2` only.
Earlier versions do not support this function.
====
+
[NOTE]
====
As an alternative to populating the `siteConfigMap` section in the `SiteConfig` CR, you can store site-specific template data in the {ztp} repo, as `ConfigMap` CRs, and have them synced to the hub cluster.
====

. Add the `SiteConfig` CR to the `kustomization.yaml` file in the `generators` section, similar to the example shown in `out/argocd/example/siteconfig/kustomization.yaml`.

. Commit the `SiteConfig` CR and associated `kustomization.yaml` changes in your Git repository and push the changes.
Expand Down
12 changes: 12 additions & 0 deletions modules/ztp-the-policygentemplate.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,15 @@ spec:
domainNumber 24
.....
----

The following example uses hub-side templating to generate `PerformanceProfile` {rh-rhacm} policies for clusters that match the labels defined under `spec.bindingRules`.
[source,yaml]
----
include::snippets/ztp_example-pgt-hub-side-templating.yaml[]
----

Using the `fromConfigMap` function, {rh-rhacm} selects the site-specific configuration for each cluster defined in the `PolicyGenTemplate`.
This example generates policies for clusters that have the labels:

* 'group-du-sno-zone: "zone-1"'
* 'hardware-type: "dell-poweredge-xr12"'
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ include::modules/ztp-pgt-config-best-practices.adoc[leveloffset=+1]
.Additional resources

* For recommendations about scaling clusters with {rh-rhacm}, see link:https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/2.6/html/install/installing#performance-and-scalability[Performance and scalability].
* For information on working with templates, see link:https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/2.8/html-single/governance/index#template-processing[Template processing].

[NOTE]
====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ include::modules/ztp-deploying-a-site.adoc[leveloffset=+1]
.Additional resources

* xref:../../scalability_and_performance/ztp_far_edge/ztp-deploying-far-edge-sites.adoc#ztp-sno-siteconfig-config-reference_ztp-deploying-far-edge-sites[{sno-caps} SiteConfig CR installation reference]
* For information on working with templates, see xref:../../scalability_and_performance/ztp_far_edge/ztp-advanced-policy-config.html#ztp-using-hub-cluster-templates_ztp-advanced-policy-config[Using hub templates in PolicyGenTemplate CRs].
* For information on the `fromConfigmap` function, see link:https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/2.8/html-single/governance/index#fromConfigMap-func[fromConfigmap function].

include::modules/ztp-sno-siteconfig-config-reference.adoc[leveloffset=+2]

Expand Down
39 changes: 39 additions & 0 deletions snippets/ztp_example-pgt-hub-side-templating.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# For this PGT, we've considered an SNO managed cluster with the following labels:
# group-du-sno-zone: zone-1
# hardware-type: dell-poweredge-xr12
---
apiVersion: ran.openshift.io/v1
kind: PolicyGenTemplate
metadata:
# The name will be used to generate the placementBinding and placementRule names as {name}-placementBinding and {name}-placementRule
name: "group-du-sno-zone-1"
namespace: "ztp-du-sno"
spec:
bindingRules:
# These policies will correspond to all clusters with these labels
group-du-sno-zone: "zone-1"
hardware-type: "dell-poweredge-xr12"
mcp: "master"
sourceFiles:
# config-policy
###
- fileName: PerformanceProfile.yaml # wave 10
policyName: "config-policy"
metadata:
name: openshift-node-performance-profile
spec:
additionalKernelArgs:
- rcupdate.rcu_normal_after_boot=0
- vfio_pci.enable_sriov=1
- vfio_pci.disable_idle_d3=1
- efi=runtime
cpu:
isolated: '{{hub fromConfigMap "" (printf "site-%s-configmap" .ManagedClusterName) (printf "%s-cpu-isolated" (index .ManagedClusterLabels "hardware-type")) hub}}'
reserved: '{{hub fromConfigMap "" (printf "site-%s-configmap" .ManagedClusterName) (printf "%s-cpu-reserved" (index .ManagedClusterLabels "hardware-type")) hub}}'
hugepages:
defaultHugepagesSize: '{{hub fromConfigMap "" (printf "site-%s-configmap" .ManagedClusterName) (printf "%s-hugepages-default" (index .ManagedClusterLabels "hardware-type")) hub}}'
pages:
- size: '{{hub fromConfigMap "" (printf "site-%s-configmap" .ManagedClusterName) (printf "%s-hugepages-size" (index .ManagedClusterLabels "hardware-type")) hub}}'
count: '{{hub fromConfigMap "" (printf "site-%s-configmap" .ManagedClusterName) (printf "%s-hugepages-count" (index .ManagedClusterLabels "hardware-type")) | toInt hub}}'
realTimeKernel:
enabled: true