Skip to content

Commit cc7aa82

Browse files
authored
Merge pull request #39535 from lmandavi/CNV-12600-templates-namespace
CNV-12600: Deploy virtual machine templates to a custom namespace
2 parents 87f2de6 + e8fdad0 commit cc7aa82

File tree

5 files changed

+131
-0
lines changed

5 files changed

+131
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3084,6 +3084,8 @@ Topics:
30843084
File: virt-editing-vm-template
30853085
- Name: Enabling dedicated resources for a virtual machine template
30863086
File: virt-dedicated-resources-vm-template
3087+
- Name: Deploying a virtual machine template to a custom namespace
3088+
File: virt-deploying-vm-template-to-custom-namespace
30873089
- Name: Deleting a virtual machine template
30883090
File: virt-deleting-vm-template
30893091
# Virtual machine live migration
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/vm_templates/virt-deploying-vm-template-to-custom-namespace.adoc
4+
5+
[id="virt-adding-templates-to-custom-namespace_{context}"]
6+
= Adding templates to a custom namespace
7+
8+
The `ssp-operator` deploys virtual machine templates to the `openshift` namespace by default. Templates in the `openshift` namespace are publicly availably to all users. When a custom namespace is created and templates are added to that namespace, you can modify or delete virtual machine templates in the `openshift` namespace. To add templates to a custom namespace, edit the `HyperConverged` custom resource (CR) which contains the `ssp-operator`.
9+
10+
.Procedure
11+
12+
. View the list of virtual machine templates that are available in the `openshift` namespace.
13+
+
14+
[source,terminal]
15+
----
16+
$ oc get templates -n openshift
17+
----
18+
+
19+
. Edit the `HyperConverged` CR in your default editor by running the following command:
20+
+
21+
[source,terminal]
22+
----
23+
$ oc edit hco -n openshift-cnv kubevirt-hyperconverged
24+
----
25+
+
26+
. View the list of virtual machine templates that are available in the custom namespace.
27+
+
28+
[source,terminal]
29+
----
30+
$ oc get templates -n customnamespace
31+
----
32+
+
33+
. Add the `commonTemplatesNamespace` attribute and specify the custom namespace. Example:
34+
+
35+
[source,yaml]
36+
----
37+
apiVersion: hco.kubevirt.io/v1beta1
38+
kind: HyperConverged
39+
metadata:
40+
name: kubevirt-hyperconverged
41+
spec:
42+
commonTemplatesNamespace: customnamespace <1>
43+
----
44+
<1> The custom namespace for deploying templates.
45+
+
46+
. Save your changes and exit the editor. The `ssp-operator` adds virtual machine templates that exist in the default `openshift` namespace to the custom namespace.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/vm_templates/virt-deploying-vm-template-to-custom-namespace.adoc
4+
5+
[id="virt-creating-custom-namespace-for-templates_{context}"]
6+
= Creating a custom namespace for templates
7+
8+
You can create a custom namespace that is used to deploy virtual machine templates for use by anyone who has permissions to access those templates. To add templates to a custom namespace, edit the `HyperConverged` custom resource (CR), add `commonTemplatesNamespace` to the spec, and specify the custom namespace for the virtual machine templates. After the `HyperConverged` CR is modified, the `ssp-operator` populates the templates in the custom namespace.
9+
10+
.Prerequisites
11+
12+
* Install the {product-title} CLI `oc`.
13+
* Log in as a user with cluster-admin privileges.
14+
15+
.Procedure
16+
17+
* Use the following command to create your custom namespace:
18+
+
19+
----
20+
$ oc create namespace <mycustomnamespace>
21+
----
22+
+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/vm_templates/virt-deploying-vm-template-to-custom-namespace.adoc
4+
5+
[id="virt-deleting-templates-from-custom-namespace_{context}"]
6+
= Deleting templates from a custom namespace
7+
8+
To delete virtual machine templates from a custom namespace, remove the `commonTemplateNamespace` attribute from the `HyperConverged` custom resource (CR) and delete each template from that custom namespace.
9+
10+
.Procedure
11+
12+
. Edit the `HyperConverged` CR in your default editor by running the following command:
13+
+
14+
[source,terminal]
15+
----
16+
$ oc edit hco -n openshift-cnv kubevirt-hyperconverged
17+
----
18+
+
19+
. Remove the `commonTemplateNamespace` attribute.
20+
+
21+
[source,yaml]
22+
----
23+
apiVersion: hco.kubevirt.io/v1beta1
24+
kind: HyperConverged
25+
metadata:
26+
name: kubevirt-hyperconverged
27+
spec:
28+
commonTemplatesNamespace: customnamespace <1>
29+
----
30+
<1> The `commonTemplatesNamespace` attribute to be deleted.
31+
+
32+
. Delete a specific template from the custom namespace that was removed.
33+
+
34+
[source,terminal]
35+
----
36+
$ oc delete templates -n customnamespace <template_name>
37+
----
38+
39+
.Verification
40+
* Verify that the template was deleted from the custom namespace.
41+
+
42+
[source,terminal]
43+
----
44+
$ oc get templates -n customnamespace
45+
----
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[id="virt-deploying-vm-template-to-custom-namespace"]
2+
= Deploying a virtual machine template to a custom namespace
3+
include::modules/virt-document-attributes.adoc[]
4+
:context: virt-deploying-vm-template-to-custom-namespace
5+
6+
toc::[]
7+
8+
Red Hat provides preconfigured virtual machine templates that are installed in the `openshift` namespace. The `ssp-operator` deploys virtual machine templates to the `openshift` namespace by default. Templates in the `openshift` namespace are publicly available to all users. These templates are listed in the *Templates* tab within the *Virtualization* page for different operating systems.
9+
10+
include::modules/virt-creating-custom-namespace-for-templates.adoc[leveloffset=+1]
11+
include::modules/virt-adding-templates-to-custom-namespace.adoc[leveloffset=+1]
12+
include::modules/virt-deleting-templates-from-custom-namespace.adoc[leveloffset=+1]
13+
14+
[id="additional-resources_deploying-vm-templates-to-custom-namespace"]
15+
== Additional resources
16+
* xref:../../virt/vm_templates/virt-creating-vm-template.adoc#virt-creating-vm-template[Creating virtual machine templates]

0 commit comments

Comments
 (0)