VsphereVMTemplate

Available since 2.24.0 as TechPreview

This section describes the VsphereVMTemplate custom resource (CR) used in the Container Cloud API. It contains all necessary information to build your own VM templates for the vSphere-based clusters.

For demonstration purposes, we split the Container Cloud VsphereVMTemplate CR into the following sections:

Warning

The fields in this resource are available for viewing only. They are automatically generated by the vSphere cloud provider and must not be modified using the Container Cloud API.

metadata

The Container Cloud VsphereVMTemplate custom resource (CR) contains the following fields:

  • apiVersion

    kaas.mirantis.com/v1alpha1

  • kind

    Object type that is VsphereVMTemplate

The metadata object field of the VsphereVMTemplate resource contains the following fields:

  • name

    String. Name of the VsphereVMTemplate object.

  • labels

    • kaas.mirantis.com/region

      Region name that matches the region name in the Cluster object.

Configuration example:

apiVersion: kaas.mirantis.com/v1alpha1
kind: VsphereVMTemplate
metadata:
  name: kaas-mgmt-vsphere-template
  labels:
    kaas.mirantis.com/region: region-one

VsphereVMTemplate configuration

The spec object field contains configuration for a VM template and references for other objects, if any. It contains the following fields:

  • packerImageOSName

    String. Name of an operating system to be used for the template. Only one of the following values is allowed: ubuntu, centos, rhel (case sensitive).

  • packerImageOSVersion

    String. Version of the selected operating system to use for the template:

    Operating system

    Supported versions

    ubuntu

    20.04

    centos

    7.9

    rhel

    7.9, 8.7

  • packerISOImage

    String. Path to the ISO file containing an installation image or the virtual hard drive (VHD or VHDX) file to clone within a datastore. For example, [<datastoreName>] /<path/to>/ubuntu-20.04.iso.

    Note

    The support of the URL format for packerISOImage is experimental. For example, https://example.com/direct-download-file.iso.

    The matching checksum applies only to the centos and ubuntu operating systems. The rhel ISO files have no capability of using cache.

  • vsphereCredentialsName

    String. Reference to the existing VsphereCredential object in the format <namespaceName>/<vSphereCredsName>. If namespace is omitted, the default namespace applies. Configuration and authentication details for the vSphere server are sourced from this object.

  • vsphereClusterName

    String. Name of the vSphere cluster in vCenter. Do not confuse with the name of the vSphere cluster in Container Cloud.

  • vsphereNetwork

    String. Path to the vSphere network.

  • vsphereDatastore

    String. Datastore to use for the template.

  • vsphereFolder

    String. Folder to store the template.

  • vsphereResourcePool

    String. Path to the vSphere resource pool.

  • scsiControllerType

    String. Small Computer System Interface (SCSI) controller type that is pvscsi. Other types are not supported.

  • numCPUs

    Integer. CPUs number of the template. Minimum number is 8.

  • ram

    Integer or string. RAM size of the template. An integer value is considered as bytes. The minimum size is 16Gi. You can use the following human-readable units:

    Possible unit values for RAM size

    Unit

    Description

    k

    Kilobytes

    Ki

    Kibibytes

    M

    Megabytes

    Mi

    Mebibytes

    G

    Gigabytes

    Gi

    Gibibytes

    T

    Terabytes

    Ti

    Tebibytes

    P

    Petabytes

    Pi

    Pebibytes

    E

    Exabytes

    Ei

    Exbibytes

  • diskSize

    Integer or string. Disk size of the template. An integer value is considered as bytes. You can use human-readable units. For details, see the above table. The minimum size is 120Gi.

  • networkBootProtocol

    String. Boot protocol type: dhcp (default) or static.

  • machineNetworkParams

    Map. Mandatory and applies only for the static network protocol. Network boot parameters of a machine:

    • netMask

      String. IPv4 network mask in the decimal format. For example, 255.255.255.0.

    • gateway

      String. IPv4 address of a gateway.

    • ip

      String. IPv4 address of a network device.

    • dnsServer

      String. IPv4 address of a DNS server.

  • rhelLicenseName

    String. Mandatory for RHEL-based templates. Reference name of an existing RHELLicense object.

  • virtWhoUsername

    Optional. String. For RHEL-based templates, a user name of the virt-who service.

  • virtWhoPassword

    Optional. Map. For RHEL-based templates, the password of the virt-who service user.

    • value

      String. User password. For example:

      virtWhoPassword:
        value: "foobar"
      
  • proxyName

    Optional. String. Reference name of an existing Proxy object.

  • timezone

    Optional. String. Time zone of a machine in the IANA Timezone Database format.

  • sshTimeout

    Optional. String. Time to wait for SSH to become available. For example, 1h2m3s.

  • actionOnError

    Optional. String. Action to apply to a VM if build failed. Possible values:

    • cleanup - removes the VM and creates a new one on the next retry

    • abort - preserves the VM and prevents retries

  • packerJobBackoffLimit

    Optional. Integer. Number of retries to apply in case of failure before considering the VsphereVMTemplate build as Failed. Equals 0 if you set actionOnError to abort.

Configuration example:

...
spec:
   packerImageOSName: "ubuntu"
   packerImageOSVersion: "20.04"
   packerISOImage: "[<datastoreName>] /iso/ubuntu-20.04.iso"
   vsphereCredentialsName: "default/cloud-config"
   vsphereClusterName: "/DATACENTER/host/<ClusterName>"
   vsphereNetwork: "/DATACENTER/network/<VMwareNetworkName>"
   vsphereDatastore: "/DATACENTER/<datastoreName>/<storageExample>"
   vsphereFolder: "/DATACENTER/templates/<templateFolderName>"
   vsphereResourcePool: "/DATACENTER/host/<ClusterName>/Resources/<ResPoolName>"
   numCPUs: 8
   ram: "24Gi"
   diskSize: "120Gi"

VsphereVMTemplate status

The status field of the VsphereVMTemplate object contains the build status of the VM template and the VM template status itself:

  • templatePath

    Full path to the template.

  • templateStatus

    Status of the template on the vSphere server. Possible values are Present or Not Present.

  • buildStatus

    Build status of the template:

    • status

      Progress of building the template. Possible values are: Failed, In Progress, or Success.

    • message

      Human-readable error message. Available only if the build fails.

templatePath: /MIRANTIS/vm/BareMetal/ubuntu-url-ubuntu-20.04-template-1.34.14-106-657181dd
templateStatus: Present
buildStatus:
  status: Success