Add ha interface
This commit is contained in:
parent
c8b72613ca
commit
23eb7e6fb2
|
@ -2,3 +2,5 @@ build
|
|||
layers
|
||||
.tox
|
||||
interfaces
|
||||
builds
|
||||
deps
|
||||
|
|
3
Makefile
3
Makefile
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/make
|
||||
LAYER_PATH := layers
|
||||
INTERFACE_PATH := interfaces
|
||||
|
||||
clean:
|
||||
rm -Rf build
|
||||
|
||||
generate: clean
|
||||
LAYER_PATH=$(LAYER_PATH) tox -e generate
|
||||
LAYER_PATH=$(LAYER_PATH) INTERFACE_PATH=$(INTERFACE_PATH) tox -e generate
|
||||
|
|
|
@ -23,3 +23,23 @@ options:
|
|||
default: 'email@example.com'
|
||||
type: string
|
||||
description: Email address of the person responsible for the domain.
|
||||
vip:
|
||||
type: string
|
||||
default:
|
||||
description: |
|
||||
Virtual IP(s) to use to front API services in HA configuration.
|
||||
|
||||
If multiple networks are being used, a VIP should be provided for each
|
||||
network, separated by spaces.
|
||||
vip_iface:
|
||||
type: string
|
||||
default: eth0
|
||||
description: |
|
||||
Default network interface to use for HA vip when it cannot be
|
||||
automatically determined.
|
||||
vip_cidr:
|
||||
type: int
|
||||
default: 24
|
||||
description: |
|
||||
Default CIDR netmask to use for HA vip when it cannot be automatically
|
||||
determined.
|
||||
|
|
|
@ -1 +1 @@
|
|||
includes: ['layer:openstack-api', 'interface:bind-rndc']
|
||||
includes: ['layer:openstack-api', 'interface:bind-rndc', 'interface:hacluster']
|
||||
|
|
|
@ -21,3 +21,6 @@ provides:
|
|||
requires:
|
||||
dns-backend:
|
||||
interface: bind-rndc
|
||||
ha:
|
||||
interface: hacluster
|
||||
scope: container
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
from charmhelpers.core.hookenv import unit_private_ip
|
||||
from charmhelpers.core.hookenv import unit_private_ip, config
|
||||
from charms.reactive import (
|
||||
hook,
|
||||
when,
|
||||
)
|
||||
from charm.openstack.designate import DesignateCharmFactory
|
||||
import ipaddress
|
||||
|
||||
from relations.hacluster.common import CRM
|
||||
from relations.hacluster.common import ResourceDescriptor
|
||||
from charm.openstack.charm import VirtualIP
|
||||
|
||||
@hook('install')
|
||||
def install_packages():
|
||||
|
@ -51,3 +55,12 @@ def render_stuff(amqp_interface, identity_interface, db_interface,
|
|||
charm.db_sync()
|
||||
charm.create_domains()
|
||||
charm.render_full_config()
|
||||
|
||||
@when('ha.connected')
|
||||
def cluster_connected(hacluster):
|
||||
user_config = config()
|
||||
resources = CRM()
|
||||
resources.add(VirtualIP(user_config['vip']))
|
||||
|
||||
hacluster.bind_on(iface=user_config['vip_iface'], mcastport=4440)
|
||||
hacluster.manage_resources(resources)
|
||||
|
|
Loading…
Reference in New Issue