Switch to using hostnames for addressing

K8S pods can change IP during charm upgrades; switch to using
the fully qualified hostname for participating units for
connectivity between units.  Hostnames won't change and are
dynamically managed by K8S.

Depends-On: Ief5c816ab5fbeb55aadf2b83697858f2ecb28807
Change-Id: Ib4629e0d2228ba2b94c7652d75ef861c8324441e
This commit is contained in:
James Page
2022-10-21 09:11:13 +01:00
parent 4f6c7e9241
commit 4ee370ca47
2 changed files with 5 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ LIBAPI = 0
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 1
LIBPATCH = 2
# TODO: add your code here! Happy coding!
@@ -101,11 +101,11 @@ class OVSDBCMSRequires(Object):
logging.debug("OVSDBCMSRequires on_joined")
self.on.connected.emit()
def bound_addresses(self):
return self.get_all_unit_values("bound-address")
def bound_hostnames(self):
return self.get_all_unit_values("bound-hostname")
def remote_ready(self):
return all(self.bound_addresses())
return all(self.bound_hostnames())
def _on_ovsdb_cms_relation_changed(self, event):
"""OVSDBCMS relation changed."""

View File

@@ -27,6 +27,6 @@ ovsdb-server \
--log-file=/var/log/ovn/ovn-relay.log \
--pidfile=/var/run/ovn/ovn-relay.pid \
--unixctl=/var/run/ovn/ovn_relay.sock \
--remote=pssl:6642:{{ ovsdb_cms.local_address }} relay:OVN_Southbound:$REMOTES
--remote=pssl:6642:{{ ovsdb_cms.local_hostname }} relay:OVN_Southbound:$REMOTES
trap stop_svc EXIT