fix some bug

This commit is contained in:
xiafan 2023-06-29 18:18:54 +08:00
parent 38d4d046a6
commit ca454b86fd
4 changed files with 35 additions and 2 deletions

View File

@ -60,13 +60,13 @@ def install_kata():
if not archive or os.path.getsize(archive) == 0:
status.maintenance('Installing Kata via apt')
gpg_key = requests.get(
'http://download.opensuse.org/repositories/home:/katacontainers:/'
'http://ftp.lysator.liu.se/pub/opensuse/repositories/home:/katacontainers:/'
'releases:/{}:/master/x{}/Release.key'.format(arch, release)).text
import_key(gpg_key)
with open('/etc/apt/sources.list.d/kata-containers.list', 'w') as f:
f.write(
'deb http://download.opensuse.org/repositories/home:/'
'deb http://ftp.lysator.liu.se/pub/opensuse/repositories/home:/'
'katacontainers:/releases:/{}:/master/x{}/ /'
.format(arch, release)
)

View File

@ -170,6 +170,17 @@ def get_ingress_address(endpoint_name, ignore_addresses=None):
# doesn't support spaces, so just return the private address
return hookenv.unit_get("private-address")
excluded_ips = []
excluded_interfaces = ["vxlan", "kube", "wg", "docker", "cali", "virbr", "cni", "flannel"]
for addr in network_info["bind-addresses"]:
for prefix in excluded_interfaces:
if addr["interface-name"].startswith(prefix):
for ip in addr["addresses"]:
excluded_ips.append(ip["value"])
ingress_addresses = network_info["ingress-addresses"]
network_info["ingress-addresses"] = [ip for ip in ingress_addresses if ip not in excluded_ips]
addresses = network_info["ingress-addresses"]
if ignore_addresses:

View File

@ -170,6 +170,17 @@ def get_ingress_address(endpoint_name, ignore_addresses=None):
# doesn't support spaces, so just return the private address
return hookenv.unit_get("private-address")
excluded_ips = []
excluded_interfaces = ["vxlan", "kube", "wg", "docker", "cali", "virbr", "cni", "flannel"]
for addr in network_info["bind-addresses"]:
for prefix in excluded_interfaces:
if addr["interface-name"].startswith(prefix):
for ip in addr["addresses"]:
excluded_ips.append(ip["value"])
ingress_addresses = network_info["ingress-addresses"]
network_info["ingress-addresses"] = [ip for ip in ingress_addresses if ip not in excluded_ips]
addresses = network_info["ingress-addresses"]
if ignore_addresses:

View File

@ -170,6 +170,17 @@ def get_ingress_address(endpoint_name, ignore_addresses=None):
# doesn't support spaces, so just return the private address
return hookenv.unit_get("private-address")
excluded_ips = []
excluded_interfaces = ["vxlan", "kube", "wg", "docker", "cali", "virbr", "cni", "flannel"]
for addr in network_info["bind-addresses"]:
for prefix in excluded_interfaces:
if addr["interface-name"].startswith(prefix):
for ip in addr["addresses"]:
excluded_ips.append(ip["value"])
ingress_addresses = network_info["ingress-addresses"]
network_info["ingress-addresses"] = [ip for ip in ingress_addresses if ip not in excluded_ips]
addresses = network_info["ingress-addresses"]
if ignore_addresses: