Add helm chart for galera arbitrator

As part of the work to enable clustered database, a new helm chart is
needed to define how to run the galera arbitrator.  This chart makes
use of the newly-created stx-mariadb Docker image which has the galera
arbitrator added to the upstream openstack-helm mariadb Docker image.

Since we have a new system chart, add sysinv support to handle any
system overrides.  Initially this just means specifying the Docker
image.

When we go to merge this upstream, we should try to add the galera
arbitrator to the existing upstream Docker image and the existing
mariadb helm chart.  One upstream dev has said that they'd be willing
to accept this.

Change-Id: If0362916d3b575adabf9d6c8cc467e488b249b7b
Story: 2004712
Task: 29054
Signed-off-by: Chris Friesen <chris.friesen@windriver.com>
This commit is contained in:
Chris Friesen 2019-01-28 10:05:01 -06:00
parent 91f88e9afc
commit 860c97767b
13 changed files with 389 additions and 2 deletions

View File

@ -1,3 +1,3 @@
SRC_DIR="stx-openstack-helm"
COPY_LIST_TO_TAR="$PKG_BASE/../../../helm-charts/rbd-provisioner"
TIS_PATCH_VER=1
COPY_LIST_TO_TAR="$PKG_BASE/../../../helm-charts/rbd-provisioner $PKG_BASE/../../../helm-charts/garbd"
TIS_PATCH_VER=2

View File

@ -57,6 +57,7 @@ helm repo add local http://localhost:8879/charts
# Make the charts. These produce a tgz file
make nova-api-proxy
make rbd-provisioner
make garbd
# terminate helm server (the last backgrounded task)
kill %1

View File

@ -0,0 +1,18 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
description: OpenStack-Helm Garbd
name: garbd
version: 0.1.0

View File

@ -0,0 +1,18 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
version: 0.1.0

View File

@ -0,0 +1,21 @@
#!/bin/sh
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
set -ex
exec garbd --group=${GROUP_NAME} --address="${GROUP_ADDRESS}"

View File

@ -0,0 +1,32 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.configmap_bin }}
{{- $envAll := . }}
{{- $configMapBinName := printf "%s-%s" $envAll.Release.Name "garbd-bin" }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $configMapBinName }}
data:
{{- if .Values.images.local_registry.active }}
image-repo-sync.sh: |
{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }}
{{- end }}
garbd.sh: |
{{ tuple "bin/_garbd.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}

View File

@ -0,0 +1,76 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.deployment }}
{{- $envAll := . }}
{{- $rcControllerName := printf "%s-%s" $envAll.Release.Name "garbd" }}
{{- $configMapBinName := printf "%s-%s" $envAll.Release.Name "garbd-bin" }}
{{ tuple $envAll "garbd" $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $rcControllerName | quote }}
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
labels:
{{ tuple $envAll "garbd" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
replicas: {{ .Values.pod.replicas.server }}
selector:
matchLabels:
{{ tuple $envAll "garbd" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
template:
metadata:
annotations:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
labels:
{{ tuple $envAll "garbd" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
shareProcessNamespace: true
serviceAccountName: {{ $rcControllerName | quote }}
affinity:
{{ tuple $envAll "garbd" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector:
{{ .Values.labels.server.node_selector_key }}: {{ .Values.labels.server.node_selector_value | quote }}
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.garbd.timeout | default "30" }}
initContainers:
{{ tuple $envAll "garbd" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: garbd
{{ tuple $envAll "garbd" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
env:
- name: GROUP_NAME
value: {{ .Values.conf.garbd.group_name | quote }}
- name: GROUP_ADDRESS
value: {{ .Values.conf.garbd.group_address | quote }}
command:
- /tmp/garbd.sh
volumeMounts:
- name: garbd-bin
mountPath: /tmp/garbd.sh
subPath: garbd.sh
readOnly: true
volumes:
- name: garbd-bin
configMap:
name: {{ $configMapBinName | quote }}
defaultMode: 0555
{{- end }}

View File

@ -0,0 +1,20 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }}
{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "garbd" -}}
{{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }}
{{- end }}

View File

@ -0,0 +1,19 @@
{{/*
Copyright 2017-2018 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.network_policy -}}
{{- $netpol_opts := dict "envAll" . "name" "application" "label" "garbd" -}}
{{ $netpol_opts | include "helm-toolkit.manifests.kubernetes_network_policy" }}
{{- end -}}

View File

@ -0,0 +1,125 @@
# Copyright 2017 The Openstack-Helm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Default values for garbd.
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# name: value
conf:
garbd:
group_name: mariadb-server_openstack
group_address: gcomm://mariadb-server-0.mariadb-discovery.openstack.svc.cluster.local,mariadb-server-1.mariadb-discovery.openstack.svc.cluster.local
dependencies:
dynamic:
common:
local_image_registry:
jobs:
- garbd-image-repo-sync
services:
- endpoint: node
service: local_image_registry
static:
image_repo_sync:
services:
- endpoint: internal
service: local_image_registry
endpoints:
cluster_domain_suffix: cluster.local
local_image_registry:
name: docker-registry
namespace: docker-registry
hosts:
default: localhost
internal: docker-registry
node: localhost
host_fqdn_override:
default: null
port:
registry:
node: 5000
kube_dns:
namespace: kube-system
name: kubernetes-dns
hosts:
default: kube-dns
host_fqdn_override:
default: null
path:
default: null
scheme: http
port:
dns_tcp:
default: 53
dns:
default: 53
protocol: UDP
network_policy:
garbd:
ingress:
- {}
images:
pull_policy: IfNotPresent
tags:
dep_check: 'quay.io/stackanetes/kubernetes-entrypoint:v0.3.1'
garbd: 'docker.io/starlingx/stx-mariadb:dev-centos-pike-latest'
image_repo_sync: docker.io/docker:17.07.0
local_registry:
active: false
exclude:
- image_repo_sync
labels:
server:
node_selector_key: openstack-compute-node
node_selector_value: enabled
manifests:
configmap_bin: true
deployment: true
network_policy: false
pod:
affinity:
anti:
topologyKey:
default: kubernetes.io/hostname
type:
default: preferredDuringSchedulingIgnoredDuringExecution
lifecycle:
upgrades:
deployments:
pod_replacement_strategy: RollingUpdate
revision_history: 3
rolling_update:
max_surge: 3
max_unavailable: 1
termination_grace_period:
garbd:
timeout: 10
replicas:
server: 1
resources:
enabled: false
garbd:
limits:
cpu: "2000m"
memory: "1024Mi"
requests:
cpu: "500m"
memory: "128Mi"

View File

@ -78,6 +78,7 @@ systemconfig.helm_plugins =
barbican = sysinv.helm.barbican:BarbicanHelm
ceilometer = sysinv.helm.ceilometer:CeilometerHelm
cinder = sysinv.helm.cinder:CinderHelm
garbd = sysinv.helm.garbd:GarbdHelm
glance = sysinv.helm.glance:GlanceHelm
gnocchi = sysinv.helm.gnocchi:GnocchiHelm
heat = sysinv.helm.heat:HeatHelm

View File

@ -1392,6 +1392,7 @@ HELM_CHART_AODH = 'aodh'
HELM_CHART_BARBICAN = 'barbican'
HELM_CHART_CEILOMETER = 'ceilometer'
HELM_CHART_CINDER = 'cinder'
HELM_CHART_GARBD = 'garbd'
HELM_CHART_GLANCE = 'glance'
HELM_CHART_GNOCCHI = 'gnocchi'
HELM_CHART_HEAT = 'heat'
@ -1416,6 +1417,7 @@ SUPPORTED_HELM_CHARTS = [
HELM_CHART_BARBICAN,
HELM_CHART_CEILOMETER,
HELM_CHART_CINDER,
HELM_CHART_GARBD,
HELM_CHART_GLANCE,
HELM_CHART_GNOCCHI,
HELM_CHART_HEAT,
@ -1448,6 +1450,7 @@ SUPPORTED_HELM_APP_CHARTS = {
HELM_CHART_INGRESS,
HELM_CHART_RBD_PROVISIONER,
HELM_CHART_MARIADB,
HELM_CHART_GARBD,
HELM_CHART_RABBITMQ,
HELM_CHART_MEMCACHED,
HELM_CHART_KEYSTONE,

View File

@ -0,0 +1,53 @@
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.common import constants
from sysinv.common import exception
from sysinv.openstack.common import log as logging
from sysinv.helm import common
from sysinv.helm import base
LOG = logging.getLogger(__name__)
class GarbdHelm(base.BaseHelm):
"""Class to encapsulate helm operations for the galera arbitrator chart"""
# The service name is used to build the standard docker image location.
# It is intentionally "mariadb" and not "garbd" as they both use the
# same docker image.
SERVICE_NAME = 'mariadb'
CHART = constants.HELM_CHART_GARBD
SUPPORTED_NAMESPACES = [
common.HELM_NS_OPENSTACK
]
def get_namespaces(self):
return self.SUPPORTED_NAMESPACES
def get_overrides(self, namespace=None):
overrides = {
common.HELM_NS_OPENSTACK: {
'images': self._get_images_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_images_overrides(self):
return {
'tags': {
'garbd': self.docker_image
}
}