Merge "Add support for galera based mariadb replication"

This commit is contained in:
Zuul 2019-02-01 17:03:07 +00:00 committed by Gerrit Code Review
commit a97f859216
8 changed files with 157 additions and 2 deletions

View File

@ -166,6 +166,39 @@ data:
- helm-toolkit
---
schema: armada/Chart/v1
metadata:
schema: metadata/Document/v1
name: openstack-garbd
data:
chart_name: garbd
release: openstack-garbd
namespace: openstack
wait:
timeout: 1800
labels:
release_group: osh-openstack-garbd
install:
no_hooks: false
upgrade:
no_hooks: false
pre:
delete:
- type: job
labels:
release_group: osh-openstack-garbd
values:
labels:
server:
node_selector_key: openstack-compute-node
node_selector_value: enabled
source:
type: tar
location: http://172.17.0.1/helm_charts/garbd-0.1.0.tgz
subpath: garbd
dependencies:
- helm-toolkit
---
schema: armada/Chart/v1
metadata:
schema: metadata/Document/v1
name: openstack-memcached
@ -2446,6 +2479,7 @@ data:
sequenced: true
chart_group:
- openstack-mariadb
- openstack-garbd
---
schema: armada/ChartGroup/v1
metadata:

View File

@ -166,6 +166,39 @@ data:
- helm-toolkit
---
schema: armada/Chart/v1
metadata:
schema: metadata/Document/v1
name: openstack-garbd
data:
chart_name: garbd
release: openstack-garbd
namespace: openstack
wait:
timeout: 1800
labels:
release_group: osh-openstack-garbd
install:
no_hooks: false
upgrade:
no_hooks: false
pre:
delete:
- type: job
labels:
release_group: osh-openstack-garbd
values:
labels:
server:
node_selector_key: openstack-compute-node
node_selector_value: enabled
source:
type: tar
location: http://172.17.0.1/helm_charts/garbd-0.1.0.tgz
subpath: garbd
dependencies:
- helm-toolkit
---
schema: armada/Chart/v1
metadata:
schema: metadata/Document/v1
name: openstack-memcached
@ -2446,6 +2479,7 @@ data:
sequenced: true
chart_group:
- openstack-mariadb
- openstack-garbd
---
schema: armada/ChartGroup/v1
metadata:

View File

@ -1,2 +1,2 @@
SRC_DIR="sysinv"
TIS_PATCH_VER=296
TIS_PATCH_VER=297

View File

@ -686,6 +686,21 @@ class AppOperator(object):
missing_overrides.append(overrides_file)
else:
available_overrides.append(overrides_file)
# Now handle any meta-overrides files. These can affect
# sections of the chart schema other than "values, and can
# affect the chartgroup or even the manifest.
if self._helm.generate_meta_overrides(
chart.name, chart.namespace):
overrides = chart.namespace + '-' + chart.name + \
'-meta' + '.yaml'
overrides_file = os.path.join(common.HELM_OVERRIDES_PATH,
overrides)
if not os.path.exists(overrides_file):
missing_overrides.append(overrides_file)
else:
available_overrides.append(overrides_file)
if missing_overrides:
LOG.error("Missing the following overrides: %s" % missing_overrides)
return None

View File

@ -188,3 +188,16 @@ class BaseHelm(object):
address = self._get_address_by_name(
constants.CONTROLLER_HOSTNAME, constants.NETWORK_TYPE_MGMT)
return address.address
def get_meta_overrides(self, namespace):
"""
Return Armada-formatted chart-specific meta-overrides
This allows a helm chart class to specify overrides (in Armada format)
for things other than the "values" section of a chart. This includes
other sections of a chart, as well as chart groups or even the
overall manifest itself.
May be left blank to indicate that there are no additional overrides.
"""
return {}

View File

@ -29,6 +29,42 @@ class GarbdHelm(base.BaseHelm):
def get_namespaces(self):
return self.SUPPORTED_NAMESPACES
def get_meta_overrides(self, namespace):
def _meta_overrides():
if self._num_controllers() < 2:
# If there are fewer than 2 controllers we'll use a single
# mariadb server and so we don't want to run garbd. This
# will remove "openstack-garbd" from the charts in the
# openstack-mariadb chartgroup.
return {
'schema': 'armada/ChartGroup/v1',
'metadata': {
'schema': 'metadata/Document/v1',
'name': 'openstack-mariadb',
},
'data': {
'description': 'Mariadb',
'sequenced': True,
'chart_group': [
'openstack-mariadb',
]
}
}
else:
return {}
overrides = {
common.HELM_NS_OPENSTACK: _meta_overrides()
}
if namespace in self.SUPPORTED_NAMESPACES:
return overrides[namespace]
elif namespace:
raise exception.InvalidHelmNamespace(chart=self.CHART,
namespace=namespace)
else:
return overrides
def get_overrides(self, namespace=None):
overrides = {
common.HELM_NS_OPENSTACK: {

View File

@ -340,6 +340,18 @@ class HelmOperator(object):
else:
LOG.exception("chart name is required")
@helm_context
def generate_meta_overrides(self, chart_name, chart_namespace):
overrides = {}
if chart_name in self.implemented_charts:
try:
overrides.update(
self.chart_operators[chart_name].get_meta_overrides(
chart_namespace))
except exception.InvalidHelmNamespace:
raise
return overrides
@helm_context
def generate_helm_application_overrides(self, app_name, cnamespace=None,
armada_format=False,
@ -404,6 +416,17 @@ class HelmOperator(object):
overrides[key] = new_overrides
self._write_chart_overrides(chart_name, cnamespace, overrides)
# Write any meta-overrides for this chart. These will be in
# armada format already.
if armada_format:
overrides = self.generate_meta_overrides(chart_name,
cnamespace)
if overrides:
chart_meta_name = chart_name + '-meta'
self._write_chart_overrides(
chart_meta_name, cnamespace, overrides)
elif app_name:
LOG.exception("%s application is not supported" % app_name)
else:

View File

@ -29,7 +29,7 @@ class MariadbHelm(openstack.OpenstackBaseHelm):
common.HELM_NS_OPENSTACK: {
'pod': {
'replicas': {
'server': 1
'server': self._num_controllers()
}
},
'images': self._get_images_overrides(),