mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-07-29 02:44:35 +00:00
Merge pull request #76 from 0xFelix/service-network
feat: Give secondary interfaces a higher priority over services
This commit is contained in:
@@ -110,6 +110,7 @@ options:
|
|||||||
use_service:
|
use_service:
|
||||||
description:
|
description:
|
||||||
- Enable the use of services to establish an SSH connection to the VirtualMachine.
|
- Enable the use of services to establish an SSH connection to the VirtualMachine.
|
||||||
|
- Services are only used if no network_name was provided.
|
||||||
type: bool
|
type: bool
|
||||||
default: True
|
default: True
|
||||||
create_groups:
|
create_groups:
|
||||||
@@ -665,10 +666,14 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
)
|
)
|
||||||
if opts.base_domain is not None:
|
if opts.base_domain is not None:
|
||||||
ansible_host += f".{opts.base_domain}"
|
ansible_host += f".{opts.base_domain}"
|
||||||
elif opts.use_service and service is not None:
|
elif opts.use_service and service is not None and opts.network_name is None:
|
||||||
# Set ansible_host and ansible_port to the host and port from the LoadBalancer
|
# Set ansible_host and ansible_port to the host and port from the LoadBalancer
|
||||||
# or NodePort service exposing SSH
|
# or NodePort service exposing SSH
|
||||||
node_name = f"{vmi.status.nodeName}.{opts.base_domain}" if opts.append_base_domain else vmi.status.nodeName
|
node_name = (
|
||||||
|
f"{vmi.status.nodeName}.{opts.base_domain}"
|
||||||
|
if opts.append_base_domain
|
||||||
|
else vmi.status.nodeName
|
||||||
|
)
|
||||||
host = self.get_host_from_service(service, node_name)
|
host = self.get_host_from_service(service, node_name)
|
||||||
port = self.get_port_from_service(service)
|
port = self.get_port_from_service(service)
|
||||||
if host is not None and port is not None:
|
if host is not None and port is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user