Skip to content

Commit 4ac6b1e

Browse files
authored
Merge pull request #77475 from rohennes/TELCODOCS-1707-preparing-configmap-objects-gitops
TELCODOCS-1707: Preparing configmap objects GitOps
2 parents cc7441f + 24bc2a3 commit 4ac6b1e

File tree

5 files changed

+257
-4
lines changed

5 files changed

+257
-4
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,8 +3107,8 @@ Topics:
31073107
File: cnf-image-based-upgrade-generate-seed
31083108
- Name: Creating ConfigMap objects for the image-based upgrade with Lifecycle Agent
31093109
File: cnf-image-based-upgrade-prep-resources
3110-
# - Name: Creating ConfigMap objects for the image-based upgrade with Lifecycle Agent using GitOps ZTP
3111-
# File: ztp-image-based-upgrade-prep-resources
3110+
- Name: Creating ConfigMap objects for the image-based upgrade with Lifecycle Agent using GitOps ZTP
3111+
File: ztp-image-based-upgrade-prep-resources
31123112
# - Name: Performing an image-based upgrade for single-node OpenShift clusters
31133113
# File: cnf-image-based-upgrade-base
31143114
# - Name: Performing an image-based upgrade for single-node OpenShift clusters using GitOps ZTP

edge_computing/image_based_upgrade/cnf-understanding-image-based-upgrade.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ include::_attributes/common-attributes.adoc[]
66

77
toc::[]
88

9-
:FeatureName: The Lifecycle Agent
10-
119
From {product-title} 4.14.13, the {lcao} provides you with an alternative way to upgrade the platform version of a {sno} cluster.
1210
The image-based upgrade is faster than the standard upgrade method and allows you to directly upgrade from {product-title} <4.y> to <4.y+2>, and <4.y.z> to <4.y.z+n>.
1311

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
[id="ztp-image-based-upgrade-prep-resources"]
3+
= Creating ConfigMap objects for the image-based upgrade with {lcao} using {ztp}
4+
include::_attributes/common-attributes.adoc[]
5+
:context: ztp-gitops
6+
7+
toc::[]
8+
9+
Create your OADP resources, extra manifests, and custom catalog sources wrapped in a `ConfigMap` object to prepare for the image-based upgrade.
10+
11+
include::modules/ztp-image-based-upgrade-prep-oadp.adoc[leveloffset=+1]
12+
13+
14+
include::modules/ztp-image-based-upgrade-prep-label-extramanifests.adoc[leveloffset=+1]
15+
16+
////
17+
[role="_additional-resources"]
18+
.Additional resources
19+
20+
* xref:../../../edge_computing/image_based_upgrade/preparing_for_image_based_upgrade/cnf-image-based-upgrade-shared-container-image.adoc#ztp-image-based-upgrade-shared-container-directory_shared-container-directory[Configuring a shared container directory between ostree stateroots when using GitOps ZTP]
21+
22+
* xref:../../../edge_computing/image_based_upgrade/preparing_for_image_based_upgrade/cnf-image-based-upgrade-install-operators#zp-image-based-upgrade-installing-oadp-with-gitops_install-operators[Installing and configuring the OADP Operator with GitOps ZTP]
23+
24+
* xref:../../../edge_computing/image_based_upgrade/ztp-image-based-upgrade.adoc#ztp-image-based-upgrade-for-sno[Performing an image-based upgrade with Lifecycle Agent and GitOps ZTP]
25+
////
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Module included in the following assemblies:
2+
// * edge_computing/image-based-upgrade/cnf-preparing-for-image-based-upgrade.adoc
3+
4+
:_mod-docs-content-type: PROCEDURE
5+
[id="ztp-image-based-upgrade-prep-label-extramanifests_{context}"]
6+
= Labeling extra manifests for the image-based upgrade with {ztp}
7+
8+
Label your extra manifests so that the {lcao} can extract resources that are labeled with the `lca.openshift.io/target-ocp-version: <target_version>` label.
9+
10+
.Prerequisites
11+
12+
* Provision one or more managed clusters with {ztp}.
13+
* Log in as a user with `cluster-admin` privileges.
14+
* Generate a seed image from a compatible seed cluster.
15+
* Create a separate partition on the target cluster for the container images that is shared between stateroots. For more information, see "Configuring a shared container directory between ostree stateroots when using {ztp}".
16+
* Deploy a version of {lcao} that is compatible with the version used with the seed image.
17+
18+
.Procedure
19+
20+
. Label your required extra manifests with the `lca.openshift.io/target-ocp-version: <target_version>` label in your existing `PolicyGenTemplate` CR:
21+
+
22+
[source,yaml]
23+
----
24+
apiVersion: ran.openshift.io/v1
25+
kind: PolicyGenTemplate
26+
metadata:
27+
name: example-sno
28+
spec:
29+
bindingRules:
30+
sites: "example-sno"
31+
du-profile: "4.15"
32+
mcp: "master"
33+
sourceFiles:
34+
- fileName: SriovNetwork.yaml
35+
policyName: "config-policy"
36+
metadata:
37+
name: "sriov-nw-du-fh"
38+
labels:
39+
lca.openshift.io/target-ocp-version: "4.15" <1>
40+
spec:
41+
resourceName: du_fh
42+
vlan: 140
43+
- fileName: SriovNetworkNodePolicy.yaml
44+
policyName: "config-policy"
45+
metadata:
46+
name: "sriov-nnp-du-fh"
47+
labels:
48+
lca.openshift.io/target-ocp-version: "4.15"
49+
spec:
50+
deviceType: netdevice
51+
isRdma: false
52+
nicSelector:
53+
pfNames: ["ens5f0"]
54+
numVfs: 8
55+
priority: 10
56+
resourceName: du_fh
57+
- fileName: SriovNetwork.yaml
58+
policyName: "config-policy"
59+
metadata:
60+
name: "sriov-nw-du-mh"
61+
labels:
62+
lca.openshift.io/target-ocp-version: "4.15"
63+
spec:
64+
resourceName: du_mh
65+
vlan: 150
66+
- fileName: SriovNetworkNodePolicy.yaml
67+
policyName: "config-policy"
68+
metadata:
69+
name: "sriov-nnp-du-mh"
70+
labels:
71+
lca.openshift.io/target-ocp-version: "4.15"
72+
spec:
73+
deviceType: vfio-pci
74+
isRdma: false
75+
nicSelector:
76+
pfNames: ["ens7f0"]
77+
numVfs: 8
78+
priority: 10
79+
resourceName: du_mh
80+
- fileName: DefaultCatsrc.yaml <2>
81+
policyName: "config-policy"
82+
metadata:
83+
name: default-cat-source
84+
namespace: openshift-marketplace
85+
labels:
86+
lca.openshift.io/target-ocp-version: "4.15"
87+
spec:
88+
displayName: default-cat-source
89+
image: quay.io/example-org/example-catalog:v1
90+
----
91+
<1> Ensure that the `lca.openshift.io/target-ocp-version` label matches either the y-stream or the z-stream of the target {product-title} version that is specified in the `spec.seedImageRef.version` field of the `ImageBasedUpgrade` CR. The {lcao} only applies the CRs that match the specified version.
92+
<2> If you do not want to use custom catalog sources, remove this entry.
93+
94+
. Push the changes to your Git repository.
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// Module included in the following assemblies:
2+
// * edge_computing/image-based-upgrade/cnf-preparing-for-image-based-upgrade.adoc
3+
4+
:_mod-docs-content-type: PROCEDURE
5+
[id="zztp-image-based-upgrade-prep-oadp_{context}"]
6+
= Creating OADP resources for the image-based upgrade with {ztp}
7+
8+
Prepare your OADP resources to restore your application after an upgrade.
9+
10+
.Prerequisites
11+
12+
* Provision one or more managed clusters with {ztp}.
13+
* Log in as a user with `cluster-admin` privileges.
14+
* Generate a seed image from a compatible seed cluster.
15+
* Create a separate partition on the target cluster for the container images that is shared between stateroots. For more information, see "Configuring a shared container directory between ostree stateroots when using {ztp}".
16+
* Deploy a version of {lcao} that is compatible with the version used with the seed image.
17+
* Install the OADP Operator, the `DataProtectionApplication` CR, and its secret on the target cluster.
18+
* Create an S3-compatible storage solution and a ready-to-use bucket with proper credentials configured. For more information, see "Installing and configuring the OADP Operator with {ztp}".
19+
20+
.Procedure
21+
22+
. Ensure that your Git repository that you use with the ArgoCD policies application contains the following directory structure:
23+
+
24+
--
25+
[source,terminal]
26+
----
27+
├── source-crs/
28+
│ ├── ibu/
29+
│ │ ├── ImageBasedUpgrade.yaml
30+
│ │ ├── PlatformBackupRestore.yaml
31+
│ │ ├── PlatformBackupRestoreLvms.yaml
32+
├── ...
33+
├── ibu-upgrade-ranGen.yaml
34+
├── kustomization.yaml
35+
----
36+
37+
[IMPORTANT]
38+
====
39+
The `kustomization.yaml` file must be located in the same directory structure as previously shown to reference the `ibu-upgrade-ranGen.yaml` manifest.
40+
====
41+
42+
The `source-crs/ibu/PlatformBackupRestore.yaml` file is provided in the ZTP container image.
43+
44+
.PlatformBackupRestore.yaml
45+
include::snippets/ibu-PlatformBackupRestore.adoc[]
46+
47+
If you use {lvms} to create persistent volumes, you can use the `source-crs/ibu/PlatformBackupRestoreLvms.yaml` provided in the ZTP container image to back up your {lvms} resources.
48+
49+
.PlatformBackupRestoreLvms.yaml
50+
include::snippets/ibu-PlatformBackupRestoreLvms.adoc[]
51+
--
52+
53+
. Optional: If you need to restore applications after the upgrade, create the OADP `Backup` and `Restore` CRs for your application in the `openshift-adp` namespace:
54+
55+
.. Create the OADP CRs for cluster-scoped application artifacts in the `openshift-adp` namespace:
56+
+
57+
.Example OADP CRs for cluster-scoped application artifacts for LSO and {LVMS}
58+
include::snippets/ibu-ApplicationClusterScopedBackupRestore.adoc[]
59+
60+
.. Create the OADP CRs for your namespace-scoped application artifacts in the `source-crs/custom-crs` directory:
61+
+
62+
--
63+
.Example OADP CRs namespace-scoped application artifacts when LSO is used
64+
include::snippets/ibu-ApplicationBackupRestoreLso.adoc[]
65+
66+
.Example OADP CRs namespace-scoped application artifacts when {lvms} is used
67+
include::snippets/ibu-ApplicationBackupRestoreLvms.adoc[]
68+
69+
[IMPORTANT]
70+
====
71+
The same version of the applications must function on both the current and the target release of {product-title}.
72+
====
73+
--
74+
75+
. Create the `oadp-cm` `ConfigMap` object through the `oadp-cm-policy` in a new `PolicyGenTemplate` called `ibu-upgrade-ranGen.yaml`:
76+
+
77+
[source,yaml]
78+
----
79+
apiVersion: ran.openshift.io/v1
80+
kind: PolicyGenTemplate
81+
metadata:
82+
name: example-group-ibu
83+
namespace: "ztp-group"
84+
spec:
85+
bindingRules:
86+
group-du-sno: ""
87+
mcp: "master"
88+
evaluationInterval:
89+
compliant: 10s
90+
noncompliant: 10s
91+
sourceFiles:
92+
- fileName: ConfigMapGeneric.yaml
93+
complianceType: mustonlyhave
94+
policyName: "oadp-cm-policy"
95+
metadata:
96+
name: oadp-cm
97+
namespace: openshift-adp
98+
----
99+
100+
. Create a `kustomization.yaml` with the following content:
101+
+
102+
[source,yaml]
103+
----
104+
apiVersion: kustomize.config.k8s.io/v1beta1
105+
kind: Kustomization
106+
107+
generators: <1>
108+
- ibu-upgrade-ranGen.yaml
109+
110+
configMapGenerator: <2>
111+
- files:
112+
- source-crs/ibu/PlatformBackupRestore.yaml
113+
#- source-crs/custom-crs/ApplicationClusterScopedBackupRestore.yaml
114+
#- source-crs/custom-crs/ApplicationApplicationBackupRestoreLso.yaml
115+
name: oadp-cm
116+
namespace: ztp-group
117+
generatorOptions:
118+
disableNameSuffixHash: true
119+
120+
121+
patches: <3>
122+
- target:
123+
group: policy.open-cluster-management.io
124+
version: v1
125+
kind: Policy
126+
name: group-ibu-oadp-cm-policy
127+
patch: |-
128+
- op: replace
129+
path: /spec/policy-templates/0/objectDefinition/spec/object-templates/0/objectDefinition/data
130+
value: '{{hub copyConfigMapData "ztp-group" "oadp-cm" hub}}'
131+
----
132+
<1> Generates the `oadp-cm-policy`.
133+
<2> Creates the `oadp-cm` `ConfigMap` object on the hub cluster with `Backup` and `Restore` CRs.
134+
<3> Overrides the data field of `ConfigMap` added in `oadp-cm-policy`. A hub template is used to propagate the `oadp-cm` `ConfigMap` to all target clusters.
135+
136+
. Push the changes to your Git repository.

0 commit comments

Comments
 (0)