$ oc create namespace <mycustomnamespace>
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 on the Virtualization → templates page for different operating systems.
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.
Install the OKD CLI oc
.
Log in as a user with cluster-admin privileges.
Use the following command to create your custom namespace:
$ oc create namespace <mycustomnamespace>
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
.
View the list of virtual machine templates that are available in the openshift
namespace.
$ oc get templates -n openshift
Edit the HyperConverged
CR in your default editor by running the following command:
$ oc edit hco -n openshift-cnv kubevirt-hyperconverged
View the list of virtual machine templates that are available in the custom namespace.
$ oc get templates -n customnamespace
Add the commontemplatesNamespace
attribute and specify the custom namespace. Example:
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
spec:
commontemplatesNamespace: customnamespace (1)
1 | The custom namespace for deploying templates. |
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.
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.
Edit the HyperConverged
CR in your default editor by running the following command:
$ oc edit hco -n openshift-cnv kubevirt-hyperconverged
Remove the commontemplateNamespace
attribute.
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
name: kubevirt-hyperconverged
spec:
commontemplatesNamespace: customnamespace (1)
1 | The commontemplatesNamespace attribute to be deleted. |
Delete a specific template from the custom namespace that was removed.
$ oc delete templates -n customnamespace <template_name>
Verify that the template was deleted from the custom namespace.
$ oc get templates -n customnamespace