Skip to content

Commit a801456

Browse files
author
Shikha Jhala
committed
CNV-28092: Added procedure to run storage checkup
1 parent ed9c9cb commit a801456

File tree

3 files changed

+228
-0
lines changed

3 files changed

+228
-0
lines changed
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/monitoring/virt-running-cluster-checkups.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-checking-storage-configuration_{context}"]
7+
= Running a storage checkup
8+
9+
Use a predefined checkup to verify that the {product-title} cluster storage is configured optimally to run {VirtProductName} workloads.
10+
11+
12+
.Prerequisites
13+
* You have installed the OpenShift CLI (`oc`).
14+
* The cluster administrator has created the required `cluster-reader` permissions for the storage checkup service account and namespace, such as in the following example:
15+
+
16+
[source,yaml]
17+
----
18+
apiVersion: rbac.authorization.k8s.io/v1
19+
kind: ClusterRoleBinding
20+
metadata:
21+
name: kubevirt-storage-checkup-clustereader
22+
roleRef:
23+
apiGroup: rbac.authorization.k8s.io
24+
kind: ClusterRole
25+
name: cluster-reader
26+
subjects:
27+
- kind: ServiceAccount
28+
name: storage-checkup-sa
29+
namespace: <target_namespace> # <1>
30+
----
31+
<1> The namespace where the checkup is to be run.
32+
33+
34+
.Procedure
35+
36+
. Create a `ServiceAccount`, `Role`, and `RoleBinding` manifest file for the storage checkup:
37+
+
38+
.Example service account, role, and rolebinding manifest
39+
[%collapsible]
40+
====
41+
[source,yaml]
42+
----
43+
---
44+
apiVersion: v1
45+
kind: ServiceAccount
46+
metadata:
47+
name: storage-checkup-sa
48+
---
49+
apiVersion: rbac.authorization.k8s.io/v1
50+
kind: Role
51+
metadata:
52+
name: storage-checkup-role
53+
rules:
54+
- apiGroups: [ "" ]
55+
resources: [ "configmaps" ]
56+
verbs: ["get", "update"]
57+
- apiGroups: [ "kubevirt.io" ]
58+
resources: [ "virtualmachines" ]
59+
verbs: [ "create", "delete" ]
60+
- apiGroups: [ "kubevirt.io" ]
61+
resources: [ "virtualmachineinstances" ]
62+
verbs: [ "get" ]
63+
- apiGroups: [ "subresources.kubevirt.io" ]
64+
resources: [ "virtualmachineinstances/addvolume", "virtualmachineinstances/removevolume" ]
65+
verbs: [ "update" ]
66+
- apiGroups: [ "kubevirt.io" ]
67+
resources: [ "virtualmachineinstancemigrations" ]
68+
verbs: [ "create" ]
69+
- apiGroups: [ "cdi.kubevirt.io" ]
70+
resources: [ "datavolumes" ]
71+
verbs: [ "create", "delete" ]
72+
- apiGroups: [ "" ]
73+
resources: [ "persistentvolumeclaims" ]
74+
verbs: [ "delete" ]
75+
---
76+
apiVersion: rbac.authorization.k8s.io/v1
77+
kind: RoleBinding
78+
metadata:
79+
name: storage-checkup-role
80+
subjects:
81+
- kind: ServiceAccount
82+
name: storage-checkup-sa
83+
roleRef:
84+
apiGroup: rbac.authorization.k8s.io
85+
kind: Role
86+
name: storage-checkup-role
87+
----
88+
====
89+
90+
. Apply the `ServiceAccount`, `Role`, and `RoleBinding` manifest in the target namespace:
91+
+
92+
[source,terminal]
93+
----
94+
$ oc apply -n <target_namespace> -f <storage_sa_roles_rolebinding>.yaml
95+
----
96+
97+
. Create a `ConfigMap` and `Job` manifest file. The config map contains the input parameters for the checkup job.
98+
+
99+
.Example input config map and job manifest
100+
[source,yaml,subs="attributes+"]
101+
----
102+
---
103+
apiVersion: v1
104+
kind: ConfigMap
105+
metadata:
106+
name: storage-checkup-config
107+
namespace: $CHECKUP_NAMESPACE
108+
data:
109+
spec.timeout: 10m
110+
---
111+
apiVersion: batch/v1
112+
kind: Job
113+
metadata:
114+
name: storage-checkup
115+
namespace: $CHECKUP_NAMESPACE
116+
spec:
117+
backoffLimit: 0
118+
template:
119+
spec:
120+
serviceAccount: storage-checkup-sa
121+
restartPolicy: Never
122+
containers:
123+
- name: storage-checkup
124+
image: quay.io/kiagnose/kubevirt-storage-checkup:main
125+
imagePullPolicy: Always
126+
env:
127+
- name: CONFIGMAP_NAMESPACE
128+
value: $CHECKUP_NAMESPACE
129+
- name: CONFIGMAP_NAME
130+
value: storage-checkup-config
131+
----
132+
133+
. Apply the `ConfigMap` and `Job` manifest file in the target namespace to run the checkup:
134+
+
135+
[source,terminal]
136+
----
137+
$ oc apply -n <target_namespace> -f <storage_configmap_job>.yaml
138+
----
139+
140+
. Wait for the job to complete:
141+
+
142+
[source,terminal]
143+
----
144+
$ oc wait job storage-checkup -n <target_namespace> --for condition=complete --timeout 10m
145+
----
146+
147+
. Review the results of the checkup by running the following command:
148+
+
149+
[source,terminal]
150+
----
151+
$ oc get configmap storage-checkup-config -n <target_namespace> -o yaml
152+
----
153+
+
154+
.Example output config map (success)
155+
[source,yaml,subs="attributes+"]
156+
----
157+
apiVersion: v1
158+
kind: ConfigMap
159+
metadata:
160+
name: storage-checkup-config
161+
labels:
162+
kiagnose/checkup-type: kubevirt-storage
163+
data:
164+
spec.timeout: 10m
165+
status.succeeded: "true" # <1>
166+
status.failureReason: "" # <2>
167+
status.startTimestamp: "2023-07-31T13:14:38Z" # <3>
168+
status.completionTimestamp: "2023-07-31T13:19:41Z" # <4>
169+
status.result.cnvVersion: 4.15.2
170+
status.result.defaultStorageClass: trident-nfs <5>
171+
status.result.goldenImagesNoDataSource: <data_import_cron_list> # <6>
172+
status.result.goldenImagesNotUpToDate: <data_import_cron_list> # <7>
173+
status.result.ocpVersion: 4.15.0
174+
status.result.storageMissingVolumeSnapshotClass: <storage_class_list>
175+
status.result.storageProfilesWithEmptyClaimPropertySets: <storage_profile_list> # <8>
176+
status.result.storageProfilesWithSpecClaimPropertySets: <storage_profile_list>
177+
status.result.storageWithRWX: |-
178+
ocs-storagecluster-ceph-rbd
179+
ocs-storagecluster-ceph-rbd-virtualization
180+
ocs-storagecluster-cephfs
181+
trident-iscsi
182+
trident-minio
183+
trident-nfs
184+
windows-vms
185+
status.result.vmBootFromGoldenImage: VMI "vmi-under-test-dhkb8" successfully booted
186+
status.result.vmHotplugVolume: |-
187+
VMI "vmi-under-test-dhkb8" hotplug volume ready
188+
VMI "vmi-under-test-dhkb8" hotplug volume removed
189+
status.result.vmLiveMigration: VMI "vmi-under-test-dhkb8" migration completed
190+
status.result.vmVolumeClone: 'DV cloneType: "csi-clone"'
191+
status.result.vmsWithNonVirtRbdStorageClass: <vm_list> # <9>
192+
status.result.vmsWithUnsetEfsStorageClass: <vm_list> # <10>
193+
----
194+
<1> Specifies if the checkup is successful (`true`) or not (`false`).
195+
<2> The reason for failure if the checkup fails.
196+
<3> The time when the checkup started, in RFC 3339 time format.
197+
<4> The time when the checkup has completed, in RFC 3339 time format.
198+
<5> Specifies if there is a default storage class.
199+
<6> The list of golden images whose data source is not ready.
200+
<7> The list of golden images whose data import cron is not up-to-date.
201+
<8> The list of storage profiles with unknown provisioners.
202+
<9> The list of virtual machines that use the Ceph RBD storage class when the virtualization storage class exists.
203+
<10> The list of virtual machines that use an Elastic File Store (EFS) storage class where the GID and UID are not set in the storage class.
204+
205+
206+
. Delete the job and config map that you previously created by running the following commands:
207+
+
208+
[source,terminal]
209+
----
210+
$ oc delete job -n <target_namespace> storage-checkup
211+
----
212+
+
213+
[source,terminal]
214+
----
215+
$ oc delete config-map -n <target_namespace> storage-checkup-config
216+
----
217+
218+
. Optional: If you do not plan to run another checkup, delete the `ServiceAccount`, `Role`, and `RoleBinding` manifest:
219+
+
220+
[source,terminal]
221+
----
222+
$ oc delete -f <storage_sa_roles_rolebinding>.yaml
223+
----

virt/monitoring/virt-monitoring-overview.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ xref:../../virt/monitoring/virt-running-cluster-checkups.adoc#virt-running-clust
1616
Run automated tests on your cluster with the {product-title} cluster checkup framework to check the following conditions:
1717
* Network connectivity and latency between two VMs attached to a secondary network interface
1818
* VM running a Data Plane Development Kit (DPDK) workload with zero packet loss
19+
* Cluster storage is optimally configured for {VirtProductName}
1920
endif::openshift-rosa,openshift-dedicated[]
2021

2122
//:FeatureName: The {product-title} cluster checkup framework

virt/monitoring/virt-running-cluster-checkups.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ xref:../../virt/monitoring/virt-running-cluster-checkups.adoc#virt-measuring-lat
1212
Verifies network connectivity and measures latency between two virtual machines (VMs) that are attached to a secondary network interface.
1313
xref:../../virt/monitoring/virt-running-cluster-checkups.adoc#virt-checking-cluster-dpdk-readiness_virt-running-cluster-checkups[DPDK checkup]::
1414
Verifies that a node can run a VM with a Data Plane Development Kit (DPDK) workload with zero packet loss.
15+
xref:../../virt/monitoring/virt-running-cluster-checkups.adoc#virt-checking-storage-configuration_virt-running-cluster-checkups[Storage checkup]::
16+
Verifies if the cluster storage is optimally configured for {VirtProductName}.
1517

1618
:FeatureName: The {VirtProductName} cluster checkup framework
1719
include::snippets/technology-preview.adoc[]
@@ -26,6 +28,8 @@ include::modules/virt-dpdk-config-map-parameters.adoc[leveloffset=+3]
2628

2729
include::modules/virt-building-vm-containerdisk-image.adoc[leveloffset=+3]
2830

31+
include::modules/virt-checking-storage-configuration.adoc[leveloffset=+2]
32+
2933
ifndef::openshift-rosa,openshift-dedicated[]
3034
[role="_additional-resources"]
3135
[id="additional-resources_running-cluster-checkups"]

0 commit comments

Comments
 (0)