You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= Specifying host NICs in site PolicyGenTemplate CRs with hub cluster templates
7
+
= Specifying group and site configuration in group PolicyGenTemplate CRs with hub templates
8
8
9
-
You can manage host NICs in a single `ConfigMap`CR and use hub cluster templates to populate the custom NIC values in the generated polices that get applied to the cluster hosts.
10
-
Using hub cluster templates in site `PolicyGenTemplate` (PGT) CRs means that you do not need to create multiple single site PGT CRs for each site.
9
+
You can manage the configuration of fleets of clusters with `ConfigMap`CRs by using hub templates to populate the group and site values in the generated policies that get applied to the managed clusters.
10
+
Using hub templates in site `PolicyGenTemplate` (PGT) CRs means that you do not need to create a `PolicyGenTemplate` CR for each site.
11
11
12
-
The following example shows you how to use a single `ConfigMap` CR to manage cluster host NICs and apply them to the cluster as polices by using a single `PolicyGenTemplate` site CR.
12
+
You can group the clusters in a fleet in various categories, depending on the use case, for example hardware type or region.
13
+
Each cluster should have a label corresponding to the group or groups that the cluster is in.
14
+
If you manage the configuration values for each group in different `ConfigMap` CRs, then you require only one group `PolicyGenTemplate` CR to apply the changes to all the clusters in the group by using hub templates.
15
+
16
+
The following example shows you how to use three `ConfigMap` CRs and one group `PolicyGenTemplate` CR to apply both site and group configuration to clusters grouped by hardware type and region.
13
17
14
18
[NOTE]
15
19
====
@@ -27,96 +31,182 @@ The repository must be accessible from the hub cluster and be defined as a sourc
27
31
28
32
.Procedure
29
33
30
-
. Create a `ConfigMap` resource that describes the NICs for a group of hosts. For example:
34
+
. Create three `ConfigMap` CRs that contain the group and site configuration:
35
+
+
36
+
--
37
+
.. Create a `ConfigMap` CR named `group-hardware-types-configmap` to hold the hardware-specific configuration. For example:
.. Create a `ConfigMap` CR named `site-data-configmap` to hold the site-specific configuration. For example:
77
+
+
78
+
[source,yaml]
79
+
----
80
+
apiVersion: v1
81
+
kind: ConfigMap
82
+
metadata:
83
+
name: site-data-configmap
84
+
namespace: ztp-group
85
+
data:
86
+
# SriovNetwork.yaml
87
+
du-sno-1-zone-1-sriov-network-vlan-1: "140"
88
+
du-sno-1-zone-1-sriov-network-vlan-2: "150"
89
+
----
90
+
--
52
91
+
53
92
[NOTE]
54
93
====
55
-
The`ConfigMap` must be in the same namespace with the policy that has the hub template substitution.
94
+
Each`ConfigMap`CR must be in the same namespace as the policy to be generated from the group `PolicyGenTemplate` CR.
56
95
====
57
96
58
-
. Commit the `ConfigMap`CR in Git, and then push to the Git repository being monitored by the Argo CD application.
97
+
. Commit the `ConfigMap`CRs in Git, and then push to the Git repository being monitored by the Argo CD application.
59
98
60
-
. Create a site PGT CR that uses templates to pull the required data from the `ConfigMap` object. For example:
99
+
. Apply the hardware type and region labels to the clusters.
100
+
The following command applies to a single cluster named `du-sno-1-zone-1` and the labels chosen are `"hardware-type": "hardware-type-1"` and `"group-du-sno-zone": "zone-1"`:
. Create a group `PolicyGenTemplate` CR that uses hub templates to obtain the required data from the `ConfigMap` objects.
108
+
This example `PolicyGenTemplate` CR configures logging, VLAN IDs, NICs and Performance Profile for the clusters that match the labels listed under `spec.bindingRules`:
61
109
+
62
110
[source,yaml]
63
111
----
64
112
apiVersion: ran.openshift.io/v1
65
113
kind: PolicyGenTemplate
66
114
metadata:
67
-
name: "site"
68
-
namespace: "ztp-site"
115
+
name: group-du-sno-pgt
116
+
namespace: ztp-group
69
117
spec:
70
-
remediationAction: inform
71
118
bindingRules:
72
-
group-du-sno: ""
119
+
# These policies will correspond to all clusters with these labels
To retrieve site-specific configuration values, use the `.ManagedClusterName` field.
197
+
This is a template context value set to the name of the target managed cluster.
198
+
199
+
To retrieve group-specific configuration, use the `.ManagedClusterLabels` field.
200
+
This is a template context value set to the value of the managed cluster's labels.
201
+
====
116
202
117
203
. Commit the site `PolicyGenTemplate` CR in Git and push to the Git repository that is monitored by the ArgoCD application.
118
204
+
119
205
[NOTE]
120
206
====
121
-
Subsequent changes to the referenced `ConfigMap` CR are not automatically synced to the applied policies. You need to manually sync the new `ConfigMap` changes to update existing PolicyGenTemplate CRs. See "Syncing new ConfigMap changes to existing PolicyGenTemplate CRs".
207
+
Subsequent changes to the referenced `ConfigMap` CR are not automatically synced to the applied policies.
208
+
You need to manually sync the new `ConfigMap` changes to update existing `PolicyGenTemplate` CRs. See "Syncing new ConfigMap changes to existing PolicyGenTemplate CRs".
209
+
210
+
You can use the same `PolicyGenTemplate` CR for multiple clusters.
211
+
If there is a configuration change, then the only modifications you need to make are to the `ConfigMap` objects that hold the configuration for each cluster and the labels of the managed clusters.
0 commit comments