Skip to content

Commit 4557974

Browse files
committed
OCPBUGS-30993: Updated RHACM procs
1 parent 2204496 commit 4557974

7 files changed

+387
-429
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Module included in the following assemblies:
2+
//
3+
// storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="lvms-creating-lvmcluster-using-rhacm_{context}"]
7+
= Creating an LVMCluster CR by using {rh-rhacm}
8+
9+
After you have installed {lvms} by using {rh-rhacm}, you must create an `LVMCluster` custom resource (CR).
10+
11+
.Prerequisites
12+
13+
* You have installed {lvms} by using {rh-rhacm}.
14+
* You have access to the {rh-rhacm} cluster using an account with `cluster-admin` permissions.
15+
* You read the "About the LVMCluster custom resource" section. See the "Additional resources" section.
16+
17+
.Procedure
18+
19+
. Log in to the {rh-rhacm} CLI using your {product-title} credentials.
20+
21+
. Create a `ConfigurationPolicy` CR YAML file with the configuration to create an `LVMCluster` CR:
22+
+
23+
.Example `ConfigurationPolicy` CR YAML file to create an `LVMCluster` CR
24+
[source,yaml]
25+
----
26+
apiVersion: policy.open-cluster-management.io/v1
27+
kind: ConfigurationPolicy
28+
metadata:
29+
name: lvms
30+
spec:
31+
object-templates:
32+
- complianceType: musthave
33+
objectDefinition:
34+
apiVersion: lvm.topolvm.io/v1alpha1
35+
kind: LVMCluster
36+
metadata:
37+
name: my-lvmcluster
38+
namespace: openshift-storage
39+
spec:
40+
storage:
41+
deviceClasses: <1>
42+
# ...
43+
deviceSelector: <2>
44+
# ...
45+
thinPoolConfig: <3>
46+
# ...
47+
nodeSelector: <4>
48+
# ...
49+
remediationAction: enforce
50+
severity: low
51+
----
52+
<1> Contains the configuration to assign the local storage devices to the LVM volume groups.
53+
<2> Contains the configuration to specify the paths to the devices that you want to add to the LVM volume group, and force wipe the devices that are added to the LVM volume group.
54+
<3> Contains the LVM thin pool configuration.
55+
<4> Contains the configuration to choose the nodes on which you want to create the LVM volume groups. If this field is empty, then all nodes without no-schedule taints are considered.
56+
57+
. Create the `ConfigurationPolicy` CR by running the following command:
58+
+
59+
[source,terminal]
60+
----
61+
$ oc create -f <file_name> -n <cluster_namespace> <1>
62+
----
63+
<1> Namespace of the {product-title} cluster on which {lvms} is installed.
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
// Module included in the following assemblies:
2+
//
3+
// storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="lvms-deleting-lvmcluster-using-rhacm_{context}"]
7+
= Deleting an LVMCluster CR by using {rh-rhacm}
8+
9+
If you have installed {lvms} by using {rh-rhacm-first}, you can delete an `LVMCluster` CR by using {rh-rhacm}.
10+
11+
.Prerequisites
12+
13+
* You have access to the {rh-rhacm} cluster as a user with `cluster-admin` permissions.
14+
* You have deleted the persistent volume claims (PVCs), volume snapshots, and volume clones provisioned by {lvms}. You have also deleted the applications that are using these resources.
15+
16+
.Procedure
17+
18+
. Log in to the {rh-rhacm} CLI using your {product-title} credentials.
19+
. Delete the `ConfigurationPolicy` CR YAML file that was created for the `LVMCluster` CR:
20+
+
21+
[source,terminal]
22+
----
23+
$ oc delete -f <file_name> -n <cluster_namespace> <1>
24+
----
25+
<1> Namespace of the {product-title} cluster on which {lvms} is installed.
26+
27+
. Create a `Policy` CR YAML file to delete the `LVMCluster` CR:
28+
+
29+
.Example `Policy` CR to delete the `LVMCluster` CR
30+
[source,yaml]
31+
----
32+
apiVersion: policy.open-cluster-management.io/v1
33+
kind: Policy
34+
metadata:
35+
name: policy-lvmcluster-delete
36+
annotations:
37+
policy.open-cluster-management.io/standards: NIST SP 800-53
38+
policy.open-cluster-management.io/categories: CM Configuration Management
39+
policy.open-cluster-management.io/controls: CM-2 Baseline Configuration
40+
spec:
41+
remediationAction: enforce
42+
disabled: false
43+
policy-templates:
44+
- objectDefinition:
45+
apiVersion: policy.open-cluster-management.io/v1
46+
kind: ConfigurationPolicy
47+
metadata:
48+
name: policy-lvmcluster-removal
49+
spec:
50+
remediationAction: enforce <1>
51+
severity: low
52+
object-templates:
53+
- complianceType: mustnothave
54+
objectDefinition:
55+
kind: LVMCluster
56+
apiVersion: lvm.topolvm.io/v1alpha1
57+
metadata:
58+
name: my-lvmcluster
59+
namespace: openshift-storage <2>
60+
---
61+
apiVersion: policy.open-cluster-management.io/v1
62+
kind: PlacementBinding
63+
metadata:
64+
name: binding-policy-lvmcluster-delete
65+
placementRef:
66+
apiGroup: apps.open-cluster-management.io
67+
kind: PlacementRule
68+
name: placement-policy-lvmcluster-delete
69+
subjects:
70+
- apiGroup: policy.open-cluster-management.io
71+
kind: Policy
72+
name: policy-lvmcluster-delete
73+
---
74+
apiVersion: apps.open-cluster-management.io/v1
75+
kind: PlacementRule
76+
metadata:
77+
name: placement-policy-lvmcluster-delete
78+
spec:
79+
clusterConditions:
80+
- status: "True"
81+
type: ManagedClusterConditionAvailable
82+
clusterSelector: <3>
83+
matchExpressions:
84+
- key: mykey
85+
operator: In
86+
values:
87+
- myvalue
88+
----
89+
<1> The `spec.remediationAction` in `policy-template` is overridden by the preceding parameter value for `spec.remediationAction`.
90+
<2> This `namespace` field must have the `openshift-storage` value.
91+
<3> Configure the requirements to select the clusters. {lvms} is uninstalled on the clusters that match the selection criteria.
92+
93+
. Create the `Policy` CR by running the following command:
94+
+
95+
[source,terminal]
96+
----
97+
$ oc create -f <file_name> -n <namespace>
98+
----
99+
100+
. Create a `Policy` CR YAML file to check if the `LVMCluster` CR has been deleted:
101+
+
102+
.Example `Policy` CR to check if the `LVMCluster` CR has been deleted
103+
[source,yaml]
104+
----
105+
apiVersion: policy.open-cluster-management.io/v1
106+
kind: Policy
107+
metadata:
108+
name: policy-lvmcluster-inform
109+
annotations:
110+
policy.open-cluster-management.io/standards: NIST SP 800-53
111+
policy.open-cluster-management.io/categories: CM Configuration Management
112+
policy.open-cluster-management.io/controls: CM-2 Baseline Configuration
113+
spec:
114+
remediationAction: inform
115+
disabled: false
116+
policy-templates:
117+
- objectDefinition:
118+
apiVersion: policy.open-cluster-management.io/v1
119+
kind: ConfigurationPolicy
120+
metadata:
121+
name: policy-lvmcluster-removal-inform
122+
spec:
123+
remediationAction: inform <1>
124+
severity: low
125+
object-templates:
126+
- complianceType: mustnothave
127+
objectDefinition:
128+
kind: LVMCluster
129+
apiVersion: lvm.topolvm.io/v1alpha1
130+
metadata:
131+
name: my-lvmcluster
132+
namespace: openshift-storage <2>
133+
---
134+
apiVersion: policy.open-cluster-management.io/v1
135+
kind: PlacementBinding
136+
metadata:
137+
name: binding-policy-lvmcluster-check
138+
placementRef:
139+
apiGroup: apps.open-cluster-management.io
140+
kind: PlacementRule
141+
name: placement-policy-lvmcluster-check
142+
subjects:
143+
- apiGroup: policy.open-cluster-management.io
144+
kind: Policy
145+
name: policy-lvmcluster-inform
146+
---
147+
apiVersion: apps.open-cluster-management.io/v1
148+
kind: PlacementRule
149+
metadata:
150+
name: placement-policy-lvmcluster-check
151+
spec:
152+
clusterConditions:
153+
- status: "True"
154+
type: ManagedClusterConditionAvailable
155+
clusterSelector:
156+
matchExpressions:
157+
- key: mykey
158+
operator: In
159+
values:
160+
- myvalue
161+
----
162+
<1> The `policy-template` `spec.remediationAction` is overridden by the preceding parameter value for `spec.remediationAction`.
163+
<2> The `namespace` field must have the `openshift-storage` value.
164+
165+
. Create the `Policy` CR by running the following command:
166+
+
167+
[source,terminal]
168+
----
169+
$ oc create -f <file_name> -n <namespace>
170+
----
171+
172+
.Verification
173+
174+
* Check the status of the `Policy` CRs by running the following command:
175+
+
176+
[source,terminal]
177+
----
178+
$ oc get policy -n <namespace>
179+
----
180+
+
181+
.Example output
182+
[source,terminal]
183+
----
184+
NAME REMEDIATION ACTION COMPLIANCE STATE AGE
185+
policy-lvmcluster-delete enforce Compliant 15m
186+
policy-lvmcluster-inform inform Compliant 15m
187+
----
188+
+
189+
[IMPORTANT]
190+
====
191+
The `Policy` CRs must be in `Compliant` state.
192+
====

0 commit comments

Comments
 (0)