kubevirt: Add hostname and subdomain parameters (#57223)

pull/58338/head
Ondra Machacek 5 years ago committed by Martin Krizek
parent 60378e991b
commit d50ee592d0

@ -0,0 +1,3 @@
---
minor_changes:
- Added new parameters hostname and subdomain to kubevirt_vm module.

@ -50,6 +50,8 @@ VM_SPEC_DEF_ARG_SPEC = {
VM_COMMON_ARG_SPEC = {
'name': {'required': True},
'namespace': {'required': True},
'hostname': {'type': 'str'},
'subdomain': {'type': 'str'},
'state': {
'default': 'present',
'choices': ['present', 'absent'],
@ -322,6 +324,8 @@ class KubeVirtRawModule(KubernetesRawModule):
node_affinity = params.get('node_affinity')
vm_affinity = params.get('affinity')
vm_anti_affinity = params.get('anti_affinity')
hostname = params.get('hostname')
subdomain = params.get('subdomain')
template_spec = template['spec']
# Merge additional flat parameters:
@ -411,6 +415,12 @@ class KubeVirtRawModule(KubernetesRawModule):
'matchExpressions': affinity.get('term').get('match_expressions'),
})
if hostname:
template_spec['hostname'] = hostname
if subdomain:
template_spec['subdomain'] = subdomain
# Define disks
self._define_disks(disks, template_spec, defaults)

@ -106,6 +106,17 @@ options:
description:
- "Specify tablets to be used as input devices"
type: list
hostname:
description:
- "Specifies the hostname of the virtual machine. The hostname will be set either by dhcp, cloud-init if configured or virtual machine
name will be used."
version_added: 2.9
subdomain:
description:
- "If specified, the fully qualified virtual machine hostname will be hostname.subdomain.namespace.svc.cluster_domain. If not specified,
the virtual machine will not have a domain name at all. The DNS entry will resolve to the virtual machine, no matter if the virtual machine
itself can pick up a hostname."
version_added: 2.9
requirements:
- python >= 2.7
- openshift >= 0.8.2

Loading…
Cancel
Save