feat: getting LISTEN IP for CIDR
`CIDR` is easier to manage than `interface` on clusters with different hardware. Change-Id: I1266eb37c1355b95f23efd33856a79f259020017
This commit is contained in:
parent
0be32dd415
commit
91bea58ee0
@ -14,7 +14,7 @@ apiVersion: v1
|
||||
appVersion: v1.0.0
|
||||
description: OpenStack-Helm Nova
|
||||
name: nova
|
||||
version: 0.3.30
|
||||
version: 0.3.31
|
||||
home: https://docs.openstack.org/nova/latest/
|
||||
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Nova/OpenStack_Project_Nova_vertical.png
|
||||
sources:
|
||||
|
@ -26,7 +26,11 @@ migration_interface="{{- .Values.conf.libvirt.live_migration_interface -}}"
|
||||
if [[ -z $migration_interface ]]; then
|
||||
# search for interface with default routing
|
||||
# If there is not default gateway, exit
|
||||
migration_interface=$(ip -4 route list 0/0 | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1
|
||||
migration_network_cidr="{{- .Values.conf.libvirt.live_migration_network_cidr -}}"
|
||||
if [ -z "${migration_network_cidr}" ] ; then
|
||||
migration_network_cidr="0/0"
|
||||
fi
|
||||
migration_interface=$(ip -4 route list ${migration_network_cidr} | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1
|
||||
fi
|
||||
|
||||
migration_address=$(ip a s $migration_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -1)
|
||||
@ -45,7 +49,11 @@ hypervisor_interface="{{- .Values.conf.hypervisor.host_interface -}}"
|
||||
if [[ -z $hypervisor_interface ]]; then
|
||||
# search for interface with default routing
|
||||
# If there is not default gateway, exit
|
||||
hypervisor_interface=$(ip -4 route list 0/0 | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1
|
||||
hypervisor_network_cidr="{{- .Values.conf.hypervisor.host_network_cidr -}}"
|
||||
if [ -z "${hypervisor_network_cidr}" ] ; then
|
||||
hypervisor_network_cidr="0/0"
|
||||
fi
|
||||
hypervisor_interface=$(ip -4 route list ${hypervisor_network_cidr} | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1
|
||||
fi
|
||||
|
||||
hypervisor_address=$(ip a s $hypervisor_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -1)
|
||||
|
@ -21,25 +21,25 @@ console_kind="{{- .Values.console.console_kind -}}"
|
||||
if [ "${console_kind}" == "novnc" ] ; then
|
||||
client_address="{{- .Values.conf.nova.vnc.server_proxyclient_address -}}"
|
||||
client_interface="{{- .Values.console.novnc.compute.vncserver_proxyclient_interface -}}"
|
||||
client_network_cidr="{{- .Values.console.novnc.compute.vncserver_proxyclient_network_cidr -}}"
|
||||
listen_ip="{{- .Values.conf.nova.vnc.server_listen -}}"
|
||||
elif [ "${console_kind}" == "spice" ] ; then
|
||||
client_address="{{- .Values.conf.nova.spice.server_proxyclient_address -}}"
|
||||
client_interface="{{- .Values.console.spice.compute.server_proxyclient_interface -}}"
|
||||
client_network_cidr="{{- .Values.console.spice.compute.server_proxyclient_network_cidr -}}"
|
||||
listen_ip="{{- .Values.conf.nova.spice.server_listen -}}"
|
||||
fi
|
||||
|
||||
if [ -z "${client_address}" ] ; then
|
||||
if [ -z "${client_interface}" ] ; then
|
||||
if [ -x "$(command -v route)" ] ; then
|
||||
# search for interface with default routing, if multiple default routes exist then select the one with the lowest metric.
|
||||
client_interface=$(route -n | awk '/^0.0.0.0/ { print $5 " " $NF }' | sort | awk '{ print $NF; exit }')
|
||||
else
|
||||
client_interface=$(ip r | grep default | awk '{print $5}')
|
||||
if [ -z "${client_network_cidr}" ] ; then
|
||||
client_network_cidr="0/0"
|
||||
fi
|
||||
client_interface=$(ip -4 route list ${client_network_cidr} | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1
|
||||
fi
|
||||
|
||||
# determine client ip dynamically based on interface provided
|
||||
client_address=$(ip a s $client_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -n 1)
|
||||
client_address=$(ip a s $client_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -1)
|
||||
fi
|
||||
|
||||
if [ -z "${listen_ip}" ] ; then
|
||||
|
@ -21,25 +21,25 @@ console_kind="{{- .Values.console.console_kind -}}"
|
||||
if [ "${console_kind}" == "novnc" ] ; then
|
||||
client_address="{{- .Values.conf.nova.vnc.server_proxyclient_address -}}"
|
||||
client_interface="{{- .Values.console.novnc.vncproxy.vncserver_proxyclient_interface -}}"
|
||||
client_network_cidr="{{- .Values.console.novnc.vncproxy.vncserver_proxyclient_network_cidr -}}"
|
||||
listen_ip="{{- .Values.conf.nova.vnc.server_listen -}}"
|
||||
elif [ "${console_kind}" == "spice" ] ; then
|
||||
client_address="{{- .Values.conf.nova.spice.server_proxyclient_address -}}"
|
||||
client_interface="{{- .Values.console.spice.proxy.server_proxyclient_interface -}}"
|
||||
client_network_cidr="{{- .Values.console.spice.proxy.server_proxyclient_network_cidr -}}"
|
||||
listen_ip="{{- .Values.conf.nova.spice.server_listen -}}"
|
||||
fi
|
||||
|
||||
if [ -z "${client_address}" ] ; then
|
||||
if [ -z "${client_interface}" ] ; then
|
||||
if [ -x "$(command -v route)" ] ; then
|
||||
# search for interface with default routing, if multiple default routes exist then select the one with the lowest metric.
|
||||
client_interface=$(route -n | awk '/^0.0.0.0/ { print $5 " " $NF }' | sort | awk '{ print $NF; exit }')
|
||||
else
|
||||
client_interface=$(ip r | grep default | awk '{print $5}')
|
||||
if [ -z "${client_network_cidr}" ] ; then
|
||||
client_network_cidr="0/0"
|
||||
fi
|
||||
client_interface=$(ip -4 route list ${client_network_cidr} | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1
|
||||
fi
|
||||
|
||||
# determine client ip dynamically based on interface provided
|
||||
client_address=$(ip a s $client_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -n 1)
|
||||
client_address=$(ip a s $client_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -1)
|
||||
fi
|
||||
|
||||
if [ -z "${listen_ip}" ] ; then
|
||||
|
@ -26,7 +26,15 @@ done
|
||||
IFS=''
|
||||
|
||||
subnet_address="{{- .Values.network.ssh.from_subnet -}}"
|
||||
|
||||
if [ -z "${subnet_address}" ] ; then
|
||||
subnet_address="0.0.0.0/0"
|
||||
fi
|
||||
listen_interface=$(ip -4 route list ${subnet_address} | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1
|
||||
listen_address=$(ip a s $listen_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}' | head -1)
|
||||
|
||||
cat > /tmp/sshd_config_extend <<EOF
|
||||
ListenAddress $listen_address
|
||||
PasswordAuthentication no
|
||||
Match Address $subnet_address
|
||||
PermitRootLogin without-password
|
||||
|
@ -494,17 +494,25 @@ console:
|
||||
spice:
|
||||
compute:
|
||||
# IF blank, search default routing interface
|
||||
server_proxyclient_interface:
|
||||
server_proxyclient_interface: null
|
||||
# or set network cidr
|
||||
server_proxyclient_network_cidr: 0/0
|
||||
proxy:
|
||||
# IF blank, search default routing interface
|
||||
server_proxyclient_interface:
|
||||
server_proxyclient_interface: null
|
||||
# or set network cidr
|
||||
server_proxyclient_network_cidr: 0/0
|
||||
novnc:
|
||||
compute:
|
||||
# IF blank, search default routing interface
|
||||
vncserver_proxyclient_interface:
|
||||
vncserver_proxyclient_interface: null
|
||||
# or set network cidr
|
||||
vncserver_proxyclient_network_cidr: 0/0
|
||||
vncproxy:
|
||||
# IF blank, search default routing interface
|
||||
vncserver_proxyclient_interface:
|
||||
vncserver_proxyclient_interface: null
|
||||
# or set network cidr
|
||||
vncserver_proxyclient_network_cidr: 0/0
|
||||
address_search_enabled: true
|
||||
|
||||
ceph_client:
|
||||
@ -1345,11 +1353,16 @@ conf:
|
||||
# When "address_search_enabled", get the IP address to be used as the target for live migration
|
||||
# traffic using interface name.
|
||||
# If this option is set to None, the hostname of the migration target compute node will be used.
|
||||
live_migration_interface:
|
||||
live_migration_interface: null
|
||||
# or set cidr
|
||||
live_migration_network_cidr: 0/0
|
||||
hypervisor:
|
||||
address_search_enabled: true
|
||||
# my_ip can be set automatically through this interface name.
|
||||
host_interface:
|
||||
host_interface: null
|
||||
# If host_interface is null there is a fallback mechanism to search
|
||||
# for interface with routing using host network cidr.
|
||||
host_network_cidr: 0/0
|
||||
# This list is the keys to exclude from the config file ingested by nova-compute
|
||||
nova_compute_redactions:
|
||||
- database
|
||||
|
@ -99,4 +99,5 @@ nova:
|
||||
- 0.3.28 Add ability to define extra command(s) for the nova cell setup job
|
||||
- 0.3.29 Add ability to define extra command(s) for the nova service cleaner job
|
||||
- 0.3.30 Add the conditional statement for log_config_append
|
||||
- 0.3.31 Add getting LISTEN IP for CIDR
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user