Skip to content

Commit 5e56631

Browse files
authored
Merge pull request #66195 from amolnar-rh/TELCODOCS-1537-4.13
2 parents 12459df + f9de62c commit 5e56631

File tree

2 files changed

+113
-39
lines changed

2 files changed

+113
-39
lines changed

modules/ztp-adding-new-content-to-gitops-ztp.adoc

Lines changed: 113 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,150 @@
44

55
:_content-type: PROCEDURE
66
[id="ztp-adding-new-content-to-gitops-ztp_{context}"]
7-
= Adding new content to the {ztp} pipeline
8-
9-
The source CRs in the {ztp-first} site generator container provide a set of critical features and node tuning settings for RAN Distributed Unit (DU) applications. These are applied to the clusters that you deploy with {ztp}. To add or modify existing source CRs in the `ztp-site-generate` container, rebuild the `ztp-site-generate` container and make it available to the hub cluster, typically from the disconnected registry associated with the hub cluster. Any valid {product-title} CR can be added.
7+
= Adding custom content to the {gitops-shortname} ZTP pipeline
108

119
Perform the following procedure to add new content to the {ztp} pipeline.
1210

1311
.Procedure
1412

15-
. Create a directory containing a Containerfile and the source CR YAML files that you want to include in the updated `ztp-site-generate` container, for example:
13+
. Create a subdirectory named `source-crs` in the directory containing the `kustomization.yaml` file for the `PolicyGenTemplate` custom resource (CR).
14+
15+
. Add your custom CRs to the `source-crs` subdirectory, as shown in the following example:
1616
+
1717
[source,text]
1818
----
19-
ztp-update/
20-
├── example-cr1.yaml
21-
├── example-cr2.yaml
22-
└── ztp-update.in
19+
example
20+
└── policygentemplates
21+
├── dev.yaml
22+
├── kustomization.yaml
23+
├── mec-edge-sno1.yaml
24+
├── sno.yaml
25+
└── source-crs <1>
26+
├── PaoCatalogSource.yaml
27+
├── PaoSubscription.yaml
28+
├── custom-crs
29+
| ├── apiserver-config.yaml
30+
| └── disable-nic-lldp.yaml
31+
└── elasticsearch
32+
├── ElasticsearchNS.yaml
33+
└── ElasticsearchOperatorGroup.yaml
2334
----
35+
<1> The `source-crs` subdirectory must be in the same directory as the `kustomization.yaml` file.
2436

25-
. Add the following content to the `ztp-update.in` Containerfile:
2637
+
27-
[source,text,subs="attributes+"]
28-
----
29-
FROM registry.redhat.io/openshift4/ztp-site-generate-rhel8:v{product-version}
38+
[IMPORTANT]
39+
====
40+
To use your own resources, ensure that the custom CR names differ from the default source CRs provided in the ZTP container.
41+
====
3042

31-
ADD example-cr2.yaml /kustomize/plugin/ran.openshift.io/v1/policygentemplate/source-crs/
32-
ADD example-cr1.yaml /kustomize/plugin/ran.openshift.io/v1/policygentemplate/source-crs/
33-
----
34-
35-
. Open a terminal at the `ztp-update/` folder and rebuild the container:
43+
. Update the required `PolicyGenTemplate` CRs to include references to the content you added in the `source-crs/custom-crs` directory, as shown in the following example:
3644
+
37-
[source,terminal,subs="attributes+"]
45+
[source,yaml]
3846
----
39-
$ podman build -t ztp-site-generate-rhel8-custom:v{product-version}-custom-1
47+
apiVersion: ran.openshift.io/v1
48+
kind: PolicyGenTemplate
49+
metadata:
50+
name: "group-dev"
51+
namespace: "ztp-clusters"
52+
spec:
53+
bindingRules:
54+
dev: "true"
55+
mcp: "master"
56+
sourceFiles:
57+
# These policies/CRs come from the internal container Image
58+
#Cluster Logging
59+
- fileName: ClusterLogNS.yaml
60+
remediationAction: inform
61+
policyName: "group-dev-cluster-log-ns"
62+
- fileName: ClusterLogOperGroup.yaml
63+
remediationAction: inform
64+
policyName: "group-dev-cluster-log-operator-group"
65+
- fileName: ClusterLogSubscription.yaml
66+
remediationAction: inform
67+
policyName: "group-dev-cluster-log-sub"
68+
#Local Storage Operator
69+
- fileName: StorageNS.yaml
70+
remediationAction: inform
71+
policyName: "group-dev-lso-ns"
72+
- fileName: StorageOperGroup.yaml
73+
remediationAction: inform
74+
policyName: "group-dev-lso-operator-group"
75+
- fileName: StorageSubscription.yaml
76+
remediationAction: inform
77+
policyName: "group-dev-lso-sub"
78+
#These are custom local polices that come from the source-crs directory in the git repo
79+
# Performance Addon Operator
80+
- fileName: PaoSubscriptionNS.yaml
81+
remediationAction: inform
82+
policyName: "group-dev-pao-ns"
83+
- fileName: PaoSubscriptionCatalogSource.yaml
84+
remediationAction: inform
85+
policyName: "group-dev-pao-cat-source"
86+
spec:
87+
image: <image_URL_here>
88+
- fileName: PaoSubscription.yaml
89+
remediationAction: inform
90+
policyName: "group-dev-pao-sub"
91+
#Elasticsearch Operator
92+
- fileName: elasticsearch/ElasticsearchNS.yaml <1>
93+
remediationAction: inform
94+
policyName: "group-dev-elasticsearch-ns"
95+
- fileName: elasticsearch/ElasticsearchOperatorGroup.yaml
96+
remediationAction: inform
97+
policyName: "group-dev-elasticsearch-operator-group"
98+
#Custom Resources
99+
- fileName: custom-crs/apiserver-config.yaml <1>
100+
remediationAction: inform
101+
policyName: "group-dev-apiserver-config"
102+
- fileName: custom-crs/disable-nic-lldp.yaml
103+
remediationAction: inform
104+
policyName: "group-dev-disable-nic-lldp"
40105
----
106+
<1> Set `fileName` to include the custom CR subdirectory from the `/source-crs` parent, such as `<subdirectory>/<filename>`.
107+
108+
. Commit the `PolicyGenTemplate` change in Git, and then push to the Git repository that is monitored by the GitOps ZTP Argo CD policies application.
41109

42-
. Push the built container image to your disconnected registry, for example:
110+
. Update the `ClusterGroupUpgrade` CR to include the changed `PolicyGenTemplate` and save it as `cgu-test.yaml`, as shown in the following example:
43111
+
44-
[source,terminal,subs="attributes+"]
112+
[source,yaml]
45113
----
46-
$ podman push localhost/ztp-site-generate-rhel8-custom:v{product-version}-custom-1 registry.example.com:5000/ztp-site-generate-rhel8-custom:v{product-version}-custom-1
114+
apiVersion: ran.openshift.io/v1alpha1
115+
kind: ClusterGroupUpgrade
116+
metadata:
117+
name: custom-source-cr
118+
namespace: ztp-clusters
119+
spec:
120+
managedPolicies:
121+
- group-dev-config-policy
122+
enable: true
123+
clusters:
124+
- cluster1
125+
remediationStrategy:
126+
maxConcurrency: 2
127+
timeout: 240
47128
----
48129

49-
. Patch the Argo CD instance on the hub cluster to point to the newly built container image:
130+
. Apply the updated `ClusterGroupUpgrade` CR by running the following command:
50131
+
51-
[source,terminal,subs="attributes+"]
132+
[source,terminal]
52133
----
53-
$ oc patch -n openshift-gitops argocd openshift-gitops --type=json -p '[{"op": "replace", "path":"/spec/repo/initContainers/0/image", "value": "registry.example.com:5000/ztp-site-generate-rhel8-custom:v{product-version}-custom-1"} ]'
134+
$ oc apply -f cgu-test.yaml
54135
----
55-
+
56-
When the Argo CD instance is patched, the `openshift-gitops-repo-server` pod automatically restarts.
57136

58137
.Verification
59138

60-
. Verify that the new `openshift-gitops-repo-server` pod has completed initialization and that the previous repo pod is terminated:
139+
* Check that the updates have succeeded by running the following command:
61140
+
62-
[source,terminal]
141+
[source, terminal]
63142
----
64-
$ oc get pods -n openshift-gitops | grep openshift-gitops-repo-server
143+
$ oc get cgu -A
65144
----
66145
+
67146
.Example output
68147
+
69-
[source,terminal]
148+
[source, terminal]
70149
----
71-
openshift-gitops-server-7df86f9774-db682 1/1 Running 1 28s
150+
NAMESPACE NAME AGE STATE DETAILS
151+
ztp-clusters custom-source-cr 6s InProgress Remediating non-compliant policies
152+
ztp-install cluster1 19h Completed All clusters are compliant with all the managed policies
72153
----
73-
+
74-
You must wait until the new `openshift-gitops-repo-server` pod has completed initialization and the previous pod is terminated before the newly added container image content is available.

scalability_and_performance/ztp_far_edge/ztp-advanced-policy-config.adoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ include::modules/ztp-using-pgt-to-update-source-crs.adoc[leveloffset=+1]
1919

2020
include::modules/ztp-adding-new-content-to-gitops-ztp.adoc[leveloffset=+1]
2121

22-
[role="_additional-resources"]
23-
.Additional resources
24-
25-
* Alternatively, you can patch the ArgoCD instance as described in xref:../../scalability_and_performance/ztp_far_edge/ztp-preparing-the-hub-cluster.adoc#ztp-configuring-hub-cluster-with-argocd_ztp-preparing-the-hub-cluster[Configuring the hub cluster with ArgoCD] by modifying `argocd-openshift-gitops-patch.json` with an updated `initContainer` image before applying the patch file.
26-
2722
include::modules/ztp-configuring-pgt-compliance-eval-timeouts.adoc[leveloffset=+1]
2823

2924
include::modules/ztp-creating-a-validator-inform-policy.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)