Skip to content

Commit 95335fd

Browse files
authored
Merge pull request #46996 from apinnick/CNV-18558-importing-https-image
CNV-18558: Importing VM images from HTTPS endpoint
2 parents 7d8bcf8 + e9b11a3 commit 95335fd

8 files changed

+76
-80
lines changed

_topic_maps/_topic_map.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3240,7 +3240,7 @@ Topics:
32403240
File: virt-tls-certificates-for-dv-imports
32413241
- Name: Importing virtual machine images with data volumes
32423242
File: virt-importing-virtual-machine-images-datavolumes
3243-
- Name: Importing virtual machine images to block storage with data volumes
3243+
- Name: Importing virtual machine images into block storage with data volumes
32443244
File: virt-importing-virtual-machine-images-datavolumes-block
32453245
# Cloning virtual machines
32463246
- Name: Cloning virtual machines

modules/virt-importing-vm-datavolume.adoc

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,82 +4,79 @@
44

55
:_content-type: PROCEDURE
66
[id="virt-importing-vm-datavolume_{context}"]
7-
= Importing a virtual machine image into a persistent volume claim by using a data volume
7+
= Importing a virtual machine image into storage by using a data volume
88

9-
You can import a virtual machine image into a persistent volume claim (PVC) by using a data volume.
9+
You can import a virtual machine image into storage by using a data volume.
1010

11-
The virtual machine image can be hosted at an HTTP or HTTPS endpoint, or the image can be built into a container disk and stored in a container registry.
11+
The virtual machine image can be hosted at an HTTP or HTTPS endpoint or the image can be built into a container disk and stored in a container registry.
1212

13-
To create a virtual machine from an imported virtual machine image, specify the image or container disk endpoint in the `VirtualMachine` configuration file before you create the virtual machine.
13+
You specify the data source for the image in a `VirtualMachine` configuration file. When the virtual machine is created, the data volume with the virtual machine image is imported into storage.
1414

1515
.Prerequisites
1616

17-
* You have installed the OpenShift CLI (`oc`).
18-
* Your cluster has at least one available persistent volume.
1917
* To import a virtual machine image you must have the following:
20-
** A virtual machine disk image in RAW, ISO, or QCOW2 format, optionally
21-
compressed by using `xz` or `gz`.
22-
** An HTTP endpoint where the image is hosted, along with any authentication
23-
credentials needed to access the data source. For example: `http://www.example.com/path/to/data`
24-
* To import a container disk you must have the following:
25-
** A container disk built from a virtual machine image stored in your container image registry, along with any authentication credentials needed to access the data source. For example: `docker://registry.example.com/container-image`
18+
** A virtual machine disk image in RAW, ISO, or QCOW2 format, optionally compressed by using `xz` or `gz`.
19+
** An HTTP or HTTPS endpoint where the image is hosted, along with any authentication credentials needed to access the data source.
20+
* To import a container disk, you must have a virtual machine image built into a container disk and stored in a container registry, along with any authentication credentials needed to access the data source.
21+
* If the virtual machine must communicate with servers that use self-signed certificates or certificates not signed by the system CA bundle, you must create a config map in the same namespace as the data volume.
2622
2723
.Procedure
2824

29-
. Optional: If your data source requires authentication credentials, edit the
30-
`endpoint-secret.yaml` file, and apply the updated configuration to the cluster:
25+
. If your data source requires authentication, create a `Secret` manifest, specifying the data source credentials, and save it as `endpoint-secret.yaml`:
3126
+
3227
[source,yaml]
3328
----
3429
apiVersion: v1
3530
kind: Secret
3631
metadata:
37-
name: <endpoint-secret>
32+
name: endpoint-secret <1>
3833
labels:
3934
app: containerized-data-importer
4035
type: Opaque
4136
data:
42-
accessKeyId: "" <1>
43-
secretKey: "" <2>
37+
accessKeyId: "" <2>
38+
secretKey: "" <3>
4439
----
45-
<1> Optional: your key or user name, base64 encoded
46-
<2> Optional: your secret or password, base64 encoded
40+
<1> Specify the name of the `Secret`.
41+
<2> Specify the Base64-encoded key ID or user name.
42+
<3> Specify the Base64-encoded secret key or password.
43+
44+
. Apply the `Secret` manifest:
4745
+
4846
[source,terminal]
4947
----
5048
$ oc apply -f endpoint-secret.yaml
5149
----
5250

53-
. Edit the virtual machine configuration file, specifying the data source for
54-
the virtual machine image you want to import. In this example, a Fedora image is imported from an `http` source:
51+
. Edit the `VirtualMachine` manifest, specifying the data source for the virtual machine image you want to import, and save it as `vm-fedora-datavolume.yaml`:
5552
+
53+
[%collapsible]
5654
[source,yaml]
55+
====
5756
----
5857
apiVersion: kubevirt.io/v1
5958
kind: VirtualMachine
6059
metadata:
6160
creationTimestamp: null
6261
labels:
6362
kubevirt.io/vm: vm-fedora-datavolume
64-
name: vm-fedora-datavolume
63+
name: vm-fedora-datavolume <1>
6564
spec:
6665
dataVolumeTemplates:
6766
- metadata:
6867
creationTimestamp: null
69-
name: fedora-dv
68+
name: fedora-dv <2>
7069
spec:
71-
pvc:
72-
accessModes:
73-
- ReadWriteOnce
70+
storage:
7471
resources:
7572
requests:
7673
storage: 10Gi
7774
storageClassName: local
7875
source:
79-
http: <1>
80-
url: "https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2" <2>
81-
secretRef: "" <3>
82-
certConfigMap: "" <4>
76+
http: <3>
77+
url: "https://mirror.arizona.edu/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2" <4>
78+
secretRef: endpoint-secret <5>
79+
certConfigMap: "" <6>
8380
status: {}
8481
running: true
8582
template:
@@ -95,7 +92,7 @@ spec:
9592
bus: virtio
9693
name: datavolumedisk1
9794
machine:
98-
type: "" <5>
95+
type: ""
9996
resources:
10097
requests:
10198
memory: 1.5Gi
@@ -106,46 +103,48 @@ spec:
106103
name: datavolumedisk1
107104
status: {}
108105
----
109-
<1> The source type to import the image from. This example uses an HTTP endpoint. To import a container disk from a registry, replace `http` with `registry`.
110-
<2> The source of the virtual machine image you want to import. This example references a virtual machine image at an HTTP endpoint. An example of a container registry endpoint is `url: "docker://kubevirt/fedora-cloud-container-disk-demo:latest"`.
111-
<3> The `secretRef` parameter is optional.
112-
<4> The `certConfigMap` is required for communicating with servers that use self-signed certificates or certificates not signed by the system CA bundle. The referenced config map must be in the same namespace as the data volume.
113-
<5> Specify `type: dataVolume` or `type: ""`. If you specify any other value for `type`, such as `persistentVolumeClaim`, a warning is displayed, and the virtual machine does not start.
106+
<1> Specify the name of the virtual machine.
107+
<2> Specify the name of the data volume.
108+
<3> Specify `http` for an HTTP or HTTPS endpoint. Specify `registry` for a container disk image imported from a registry.
109+
<4> The source of the virtual machine image you want to import. This example references a virtual machine image at an HTTPS endpoint. An example of a container registry endpoint is `url: "docker://kubevirt/fedora-cloud-container-disk-demo:latest"`.
110+
<5> Required if you created a `Secret` for the data source.
111+
<6> Optional: Specify a CA certificate config map.
112+
====
114113

115114
. Create the virtual machine:
116115
+
117116
[source,terminal]
118117
----
119-
$ oc create -f vm-<name>-datavolume.yaml
118+
$ oc create -f vm-fedora-datavolume.yaml
120119
----
121120
+
122121
[NOTE]
123122
====
124-
The `oc create` command creates the data volume and the virtual machine. The CDI controller creates an underlying PVC with the correct annotation, and the import process begins. When the import completes, the data volume status changes to `Succeeded`, and the virtual machine is allowed to start.
123+
The `oc create` command creates the data volume and the virtual machine. The CDI controller creates an underlying PVC with the correct annotation and the import process begins. When the import is complete, the data volume status changes to `Succeeded`. You can start the virtual machine.
125124
126-
Data volume provisioning happens in the background, so there is no need to monitor it. You can start the virtual machine, and it will not run until the import is complete.
125+
Data volume provisioning happens in the background, so there is no need to monitor the process.
127126
====
128127

129128
.Verification
129+
130130
. The importer pod downloads the virtual machine image or container disk from the specified URL and stores it on the provisioned PV. View the status of the importer pod by running the following command:
131131
+
132132
[source,terminal]
133133
----
134134
$ oc get pods
135135
----
136136

137-
. Monitor the data volume status until it shows `Succeeded` by running the following command:
137+
. Monitor the data volume until its status is `Succeeded` by running the following command:
138138
+
139139
[source,terminal]
140140
----
141-
$ oc describe dv <datavolume-name> <1>
141+
$ oc describe dv fedora-dv <1>
142142
----
143-
<1> The name of the data volume as specified under `dataVolumeTemplates.metadata.name` in the virtual machine
144-
configuration file. In the example configuration above, this is `fedora-dv`.
143+
<1> Specify the data volume name that you defined in the `VirtualMachine` manifest.
145144

146-
. To verify that provisioning is complete and that the VMI has started, try accessing its serial console by running the following command:
145+
. Verify that provisioning is complete and that the virtual machine has started by accessing its serial console:
147146
+
148147
[source,terminal]
149148
----
150-
$ virtctl console <vm-fedora-datavolume>
149+
$ virtctl console vm-fedora-datavolume
151150
----

modules/virt-importing-vm-to-block-pv.adoc

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,74 @@
44

55
:_content-type: PROCEDURE
66
[id="virt-importing-vm-to-block-pv_{context}"]
7-
= Importing a virtual machine image to a block persistent volume using data volumes
7+
= Importing a virtual machine image into block storage by using a data volume
88

9-
You can import an existing virtual machine image into your {product-title} cluster. {VirtProductName} uses data volumes to automate the importing data and the creation of an underlying persistent volume claim (PVC). You can then reference the data volume in a virtual machine manifest.
9+
You can import a virtual machine image into block storage by using a data volume. You reference the data volume in a `VirtualMachine` manifest before you create a virtual machine.
1010

1111
.Prerequisites
1212

13-
* A virtual machine disk image, in RAW, ISO, or QCOW2 format, optionally compressed by using `xz` or `gz`.
14-
* An `HTTP` or `s3` endpoint where the image is hosted, along with any authentication credentials needed to access the data source
15-
* At least one available block PV.
13+
* A virtual machine disk image in RAW, ISO, or QCOW2 format, optionally compressed by using `xz` or `gz`.
14+
* An HTTP or HTTPS endpoint where the image is hosted, along with any authentication credentials needed to access the data source.
1615
1716
.Procedure
1817

19-
. If your data source requires authentication credentials, edit the `endpoint-secret.yaml` file, and apply the updated configuration to the cluster.
20-
21-
.. Edit the `endpoint-secret.yaml` file with your preferred text editor:
18+
. If your data source requires authentication, create a `Secret` manifest, specifying the data source credentials, and save it as `endpoint-secret.yaml`:
2219
+
2320
[source,yaml]
2421
----
2522
apiVersion: v1
2623
kind: Secret
2724
metadata:
28-
name: <endpoint-secret>
25+
name: endpoint-secret <1>
2926
labels:
3027
app: containerized-data-importer
3128
type: Opaque
3229
data:
33-
accessKeyId: "" <1>
34-
secretKey: "" <2>
30+
accessKeyId: "" <2>
31+
secretKey: "" <3>
3532
----
36-
<1> Optional: your key or user name, base64 encoded
37-
<2> Optional: your secret or password, base64 encoded
33+
<1> Specify the name of the `Secret`.
34+
<2> Specify the Base64-encoded key ID or user name.
35+
<3> Specify the Base64-encoded secret key or password.
3836

39-
.. Update the secret by running the following command:
37+
. Apply the `Secret` manifest:
4038
+
4139
[source,terminal]
4240
----
4341
$ oc apply -f endpoint-secret.yaml
4442
----
4543

46-
. Create a `DataVolume` manifest that specifies the data source for the image you want to import and `volumeMode: Block` so that an available block PV is used.
44+
. Create a `DataVolume` manifest, specifying the data source for the virtual machine image and `Block` for `storage.volumeMode`.
4745
+
4846
[source,yaml]
4947
----
5048
apiVersion: cdi.kubevirt.io/v1beta1
5149
kind: DataVolume
5250
metadata:
53-
name: <import-pv-datavolume> <1>
51+
name: import-pv-datavolume <1>
5452
spec:
5553
storageClassName: local <2>
56-
source:
54+
source:
5755
http:
58-
url: <http://download.fedoraproject.org/pub/fedora/linux/releases/28/Cloud/x86_64/images/Fedora-Cloud-Base-28-1.1.x86_64.qcow2> <3>
59-
secretRef: <endpoint-secret> <4>
60-
pvc:
56+
url: "https://mirror.arizona.edu/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2" <3>
57+
secretRef: endpoint-secret <4>
58+
storage:
6159
volumeMode: Block <5>
62-
accessModes:
63-
- ReadWriteOnce
6460
resources:
6561
requests:
66-
storage: <2Gi>
62+
storage: 10Gi
6763
----
68-
<1> The name of the data volume.
64+
<1> Specify the name of the data volume.
6965
<2> Optional: Set the storage class or omit it to accept the cluster default.
70-
<3> The `HTTP` source of the image to import.
71-
<4> Only required if the data source requires authentication.
72-
<5> Required for importing to a block PV.
66+
<3> Specify the HTTP or HTTPS URL of the image to import.
67+
<4> Required if you created a `Secret` for the data source.
68+
<5> The volume mode and access mode are detected automatically for known storage provisioners. Otherwise, specify `Block`.
7369

74-
. Create the data volume to import the virtual machine image by running the following command:
70+
. Create the data volume to import the virtual machine image:
7571
+
7672
[source,terminal]
7773
----
78-
$ oc create -f <import-pv-datavolume.yaml><1>
74+
$ oc create -f import-pv-datavolume.yaml
7975
----
80-
<1> The file name of the data volume that you created in the previous step.
8176

77+
You can reference this data volume in a `VirtualMachine` manifest before you create a virtual machine.

modules/virt-storage-wizard-fields-web.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
|Create an empty disk.
1616

1717
|Import via URL (creates PVC)
18-
|Import content via URL (HTTP or S3 endpoint).
18+
|Import content via URL (HTTP or HTTPS endpoint).
1919

2020
|Use an existing PVC
2121
|Use a PVC that is already available in the cluster.

modules/virt-template-fields-for-boot-source.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The following table describes the fields for *Add boot source to template* windo
1515
|Upload a file from your local device. Supported file types include gz, xz, tar, and qcow2.
1616

1717
|Import via URL (creates PVC)
18-
|Import content from an image available from an HTTP or S3 endpoint. Obtain the download link URL from the web page where the image download is available and enter that URL link in the *Import via URL (creates PVC)* field. Example: For a Red Hat Enterprise Linux image, log on to the Red Hat Customer Portal, access the image download page, and copy the download link URL for the KVM guest image.
18+
|Import content from an image available from an HTTP or HTTPS endpoint. Obtain the download link URL from the web page where the image download is available and enter that URL link in the *Import via URL (creates PVC)* field. Example: For a Red Hat Enterprise Linux image, log on to the Red Hat Customer Portal, access the image download page, and copy the download link URL for the KVM guest image.
1919

2020
|Clone existing PVC (creates PVC)
2121
|Use a PVC that is already available in the cluster and clone it.

modules/virt-vm-wizard-fields-web.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ endif::[]
5757

5858
.4+|Boot Source
5959
|Import via URL (creates PVC)
60-
|Import content from an image available from an *HTTP* or *S3* endpoint. Example: Obtaining a URL link from the web page with the operating system image.
60+
|Import content from an image available from an HTTP or HTTPS endpoint. Example: Obtaining a URL link from the web page with the operating system image.
6161

6262
|Clone existing PVC (creates PVC)
6363
|Select an existent persistent volume claim available on the cluster and clone it.

virt/virtual_machines/importing_vms/virt-importing-virtual-machine-images-datavolumes-block.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
:_content-type: ASSEMBLY
22
[id="virt-importing-virtual-machine-images-datavolumes-block"]
3-
= Importing virtual machine images to block storage with data volumes
3+
= Importing virtual machine images into block storage with data volumes
44
include::_attributes/common-attributes.adoc[]
55
:context: virt-importing-virtual-machine-images-datavolumes-block
66

virt/virtual_machines/importing_vms/virt-tls-certificates-for-dv-imports.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ include::_attributes/common-attributes.adoc[]
77
toc::[]
88

99
include::modules/virt-adding-tls-certificates-for-authenticating-dv-imports.adoc[leveloffset=+1]
10+
1011
include::modules/virt-example-configmap-tls-certificate.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)