mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
90 lines
3.0 KiB
Plaintext
90 lines
3.0 KiB
Plaintext
// Module included in the following assembly:
|
|
//
|
|
// * virt/storage/virt-automatic-bootsource-updates.adoc
|
|
//
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="virt-configuring-storage-class-bootsource-update_{context}"]
|
|
= Configuring a storage class for custom boot source updates
|
|
|
|
You can override the default storage class by editing the `HyperConverged` custom resource (CR).
|
|
|
|
[IMPORTANT]
|
|
====
|
|
Boot sources are created from storage using the default storage class. If your cluster does not have a default storage class, you must define one before configuring automatic updates for custom boot sources.
|
|
====
|
|
|
|
.Procedure
|
|
|
|
. Open the `HyperConverged` CR in your default editor by running the following command:
|
|
+
|
|
[source,terminal,subs="attributes+"]
|
|
----
|
|
$ oc edit hyperconverged kubevirt-hyperconverged -n {CNVNamespace}
|
|
----
|
|
|
|
. Define a new storage class by entering a value in the `storageClassName` field:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: hco.kubevirt.io/v1beta1
|
|
kind: HyperConverged
|
|
metadata:
|
|
name: kubevirt-hyperconverged
|
|
spec:
|
|
dataImportCronTemplates:
|
|
- metadata:
|
|
name: rhel8-image-cron
|
|
spec:
|
|
template:
|
|
spec:
|
|
storageClassName: <new_storage_class> <1>
|
|
schedule: "0 */12 * * *" <2>
|
|
managedDataSource: <data_source> <3>
|
|
# ...
|
|
----
|
|
<1> Define the storage class.
|
|
<2> Required: Schedule for the job specified in cron format.
|
|
<3> Required: The data source to use.
|
|
+
|
|
--
|
|
[NOTE]
|
|
----
|
|
For the custom image to be detected as an available boot source, the value of the `spec.dataVolumeTemplates.spec.sourceRef.name` parameter in the VM template must match this value.
|
|
----
|
|
--
|
|
|
|
. Remove the `storageclass.kubernetes.io/is-default-class` annotation from the current default storage class.
|
|
.. Retrieve the name of the current default storage class by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get storageclass
|
|
----
|
|
+
|
|
.Example output
|
|
[source,text]
|
|
----
|
|
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
|
|
csi-manila-ceph manila.csi.openstack.org Delete Immediate false 11d
|
|
hostpath-csi-basic (default) kubevirt.io.hostpath-provisioner Delete WaitForFirstConsumer false 11d <1>
|
|
----
|
|
+
|
|
<1> In this example, the current default storage class is named `hostpath-csi-basic`.
|
|
|
|
.. Remove the annotation from the current default storage class by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc patch storageclass <current_default_storage_class> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}' <1>
|
|
----
|
|
<1> Replace `<current_default_storage_class>` with the `storageClassName` value of the default storage class.
|
|
|
|
. Set the new storage class as the default by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc patch storageclass <new_storage_class> -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' <1>
|
|
----
|
|
<1> Replace `<new_storage_class>` with the `storageClassName` value that you added to the `HyperConverged` CR.
|