diff --git a/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/build_srpm.data b/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/build_srpm.data index 3f80dec306..6c7b4c74ca 100644 --- a/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/build_srpm.data +++ b/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/build_srpm.data @@ -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 diff --git a/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/stx-openstack-helm.spec b/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/stx-openstack-helm.spec index c613ebfd66..26d346a057 100644 --- a/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/stx-openstack-helm.spec +++ b/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/stx-openstack-helm.spec @@ -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 diff --git a/kubernetes/helm-charts/garbd/Chart.yaml b/kubernetes/helm-charts/garbd/Chart.yaml new file mode 100644 index 0000000000..3aa9379082 --- /dev/null +++ b/kubernetes/helm-charts/garbd/Chart.yaml @@ -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 diff --git a/kubernetes/helm-charts/garbd/requirements.yaml b/kubernetes/helm-charts/garbd/requirements.yaml new file mode 100644 index 0000000000..53782e69b2 --- /dev/null +++ b/kubernetes/helm-charts/garbd/requirements.yaml @@ -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 diff --git a/kubernetes/helm-charts/garbd/templates/bin/_garbd.sh.tpl b/kubernetes/helm-charts/garbd/templates/bin/_garbd.sh.tpl new file mode 100644 index 0000000000..662c583636 --- /dev/null +++ b/kubernetes/helm-charts/garbd/templates/bin/_garbd.sh.tpl @@ -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}" diff --git a/kubernetes/helm-charts/garbd/templates/configmap-bin.yaml b/kubernetes/helm-charts/garbd/templates/configmap-bin.yaml new file mode 100644 index 0000000000..57023aa64d --- /dev/null +++ b/kubernetes/helm-charts/garbd/templates/configmap-bin.yaml @@ -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 }} diff --git a/kubernetes/helm-charts/garbd/templates/deployment.yaml b/kubernetes/helm-charts/garbd/templates/deployment.yaml new file mode 100644 index 0000000000..a67d58c373 --- /dev/null +++ b/kubernetes/helm-charts/garbd/templates/deployment.yaml @@ -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 }} diff --git a/kubernetes/helm-charts/garbd/templates/job-image-repo-sync.yaml b/kubernetes/helm-charts/garbd/templates/job-image-repo-sync.yaml new file mode 100644 index 0000000000..78a2572e47 --- /dev/null +++ b/kubernetes/helm-charts/garbd/templates/job-image-repo-sync.yaml @@ -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 }} diff --git a/kubernetes/helm-charts/garbd/templates/network_policy.yaml b/kubernetes/helm-charts/garbd/templates/network_policy.yaml new file mode 100644 index 0000000000..cf56bb148e --- /dev/null +++ b/kubernetes/helm-charts/garbd/templates/network_policy.yaml @@ -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 -}} diff --git a/kubernetes/helm-charts/garbd/values.yaml b/kubernetes/helm-charts/garbd/values.yaml new file mode 100644 index 0000000000..ddef814153 --- /dev/null +++ b/kubernetes/helm-charts/garbd/values.yaml @@ -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" diff --git a/sysinv/sysinv/sysinv/setup.cfg b/sysinv/sysinv/sysinv/setup.cfg index 1cd04bf484..4ce1245844 100644 --- a/sysinv/sysinv/sysinv/setup.cfg +++ b/sysinv/sysinv/sysinv/setup.cfg @@ -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 diff --git a/sysinv/sysinv/sysinv/sysinv/common/constants.py b/sysinv/sysinv/sysinv/sysinv/common/constants.py index 0927e82a3f..3db8bb831a 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/constants.py +++ b/sysinv/sysinv/sysinv/sysinv/common/constants.py @@ -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, diff --git a/sysinv/sysinv/sysinv/sysinv/helm/garbd.py b/sysinv/sysinv/sysinv/sysinv/helm/garbd.py new file mode 100644 index 0000000000..e638044f5a --- /dev/null +++ b/sysinv/sysinv/sysinv/sysinv/helm/garbd.py @@ -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 + } + }