Typically, when a DevOps engineer provisions a VM in the vSphere IaaS control plane environment, an OVF template includes hard coded details such as basic network configuration. However, you might not know and often cannot assign certain values to the VM's OVF properties, such as such as IPAM provided network data, until after the VM CR is created. With template strings support, you don’t need to know network information in advance. You can use Golang based templating to populate the OVF property values and configure the VM’s network stack.
Procedure
- Make sure that for all properties to be configured, your OVF file includes the ovf:userConfigurable="true" entry.
This entry enables the system to substitute networking value placeholders, such as nameservers and management IP, with real data after the data gets collected.
Use the following example.
<Property ovf:key="hostname" ovf:type="string" ovf:userConfigurable="true" ovf:value="ubuntuguest">
<Description>Specifies the hostname for the appliance</Description>
</Property>
<Property ovf:key="nameservers" ovf:type="string" ovf:userConfigurable="true" ovf:value="1.1.1.1, 1.0.0.1">
<Label>2.2. DNS</Label>
<Description>A comma-separated list of IP addresses for up to three DNS servers</Description>
</Property>
<Property ovf:key="management_ip" ovf:type="string" ovf:userConfigurable="true">
<Label>2.3. Management IP</Label>
<Description>The static IP address for the appliance on the Management Port Group in CIDR format (Eg. ip/subnet mask bits). This cannot be DHCP.</Description>
</Property>
- Create the VM YAML file with template strings.
The template strings for bootstrap resources will collect the data necessary to populate the OVF property values.
You can use one of the following methods to construct template strings.
- Deploy the VM.
kubectl apply -f file_name.yaml
What to do next
If the customization fails and the VM does not get an IP address, inspect the VM using the vSphere VM web console. See Troubleshoot VMs Using the vSphere VM Web Console.