Merge "Support changing project network underlay via spaces" into main
This commit is contained in:
commit
18361b097a
@ -25,3 +25,6 @@ options:
|
||||
use-migration-binding:
|
||||
default: False
|
||||
type: boolean
|
||||
use-data-binding:
|
||||
default: False
|
||||
type: boolean
|
||||
|
@ -39,6 +39,7 @@ provides:
|
||||
|
||||
extra-bindings:
|
||||
migration:
|
||||
data: # this binding will be used to support project networking between hypervisors
|
||||
|
||||
# This charm has no peer relation by design. This charm needs to scale to
|
||||
# hundreds of units and this is limited by the peer relation.
|
||||
|
@ -68,6 +68,7 @@ from utils import (
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
MIGRATION_BINDING = "migration"
|
||||
DATA_BINDING = "data"
|
||||
MTLS_USAGES = {x509.OID_SERVER_AUTH, x509.OID_CLIENT_AUTH}
|
||||
|
||||
|
||||
@ -213,6 +214,20 @@ class HypervisorOperatorCharm(sunbeam_charm.OSBaseOperatorCharm):
|
||||
return None
|
||||
return str(address)
|
||||
|
||||
@property
|
||||
def data_address(self) -> Optional[str]:
|
||||
"""Get address from data binding."""
|
||||
use_binding = self.model.config.get("use-data-binding")
|
||||
if not use_binding:
|
||||
return None
|
||||
binding = self.model.get_binding(DATA_BINDING)
|
||||
if binding is None:
|
||||
return None
|
||||
address = binding.network.bind_address
|
||||
if address is None:
|
||||
return None
|
||||
return str(address)
|
||||
|
||||
def check_relation_exists(self, relation_name: str) -> bool:
|
||||
"""Check if a relation exists or not."""
|
||||
if self.model.get_relation(relation_name):
|
||||
@ -418,7 +433,9 @@ class HypervisorOperatorCharm(sunbeam_charm.OSBaseOperatorCharm):
|
||||
"external-bridge-address"
|
||||
)
|
||||
or "10.20.20.1/24",
|
||||
"network.ip-address": config("ip-address") or local_ip,
|
||||
"network.ip-address": self.data_address
|
||||
or config("ip-address")
|
||||
or local_ip,
|
||||
"network.ovn-key": base64.b64encode(
|
||||
contexts.certificates.key.encode()
|
||||
).decode(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user