Merge "Add OpenstackFluxCDKustomizeOperator"
This commit is contained in:
commit
a13c8155f9
@ -8,6 +8,10 @@ from sysinv.common import constants
|
||||
|
||||
|
||||
HELM_APP_OPENSTACK = constants.HELM_APP_OPENSTACK
|
||||
HELM_NS_OPENSTACK = 'openstack'
|
||||
|
||||
HELM_OVERRIDE_GROUP_SYSTEM = 'system_overrides'
|
||||
HELM_OVERRIDE_GROUP_USER = 'user_overrides'
|
||||
|
||||
# Helm: Supported charts:
|
||||
# These values match the names in the chart package's Chart.yaml
|
||||
@ -42,6 +46,38 @@ HELM_CHART_SWIFT = 'ceph-rgw'
|
||||
HELM_CHART_DCDBSYNC = 'dcdbsync'
|
||||
HELM_CHART_PSP_ROLEBINDING = 'openstack-psp-rolebinding'
|
||||
|
||||
# Helm Release constants
|
||||
FLUXCD_HELMRELEASE_AODH = 'aodh'
|
||||
FLUXCD_HELMRELEASE_BARBICAN = 'barbican'
|
||||
FLUXCD_HELMRELEASE_CEILOMETER = 'ceilometer'
|
||||
FLUXCD_HELMRELEASE_CINDER = 'cinder'
|
||||
FLUXCD_HELMRELEASE_FM_REST_API = 'fm-rest-api'
|
||||
FLUXCD_HELMRELEASE_GARBD = 'garbd'
|
||||
FLUXCD_HELMRELEASE_GLANCE = 'glance'
|
||||
FLUXCD_HELMRELEASE_GNOCCHI = 'gnocchi'
|
||||
FLUXCD_HELMRELEASE_HEAT = 'heat'
|
||||
FLUXCD_HELMRELEASE_HELM_TOOLKIT = 'openstack-helm-toolkit'
|
||||
FLUXCD_HELMRELEASE_HORIZON = 'horizon'
|
||||
FLUXCD_HELMRELEASE_INGRESS = 'ingress'
|
||||
FLUXCD_HELMRELEASE_IRONIC = 'ironic'
|
||||
FLUXCD_HELMRELEASE_KEYSTONE = 'keystone'
|
||||
FLUXCD_HELMRELEASE_KEYSTONE_API_PROXY = 'keystone-api-proxy'
|
||||
FLUXCD_HELMRELEASE_LIBVIRT = 'libvirt'
|
||||
FLUXCD_HELMRELEASE_MAGNUM = 'magnum'
|
||||
FLUXCD_HELMRELEASE_MARIADB = 'mariadb'
|
||||
FLUXCD_HELMRELEASE_MEMCACHED = 'memcached'
|
||||
FLUXCD_HELMRELEASE_NEUTRON = 'neutron'
|
||||
FLUXCD_HELMRELEASE_NGINX_PORTS_CONTROL = "nginx-ports-control"
|
||||
FLUXCD_HELMRELEASE_NOVA = 'nova'
|
||||
FLUXCD_HELMRELEASE_NOVA_API_PROXY = 'nova-api-proxy'
|
||||
FLUXCD_HELMRELEASE_PCI_IRQ_AFFINITY_AGENT = 'pci-irq-affinity-agent'
|
||||
FLUXCD_HELMRELEASE_OPENVSWITCH = 'openvswitch'
|
||||
FLUXCD_HELMRELEASE_PLACEMENT = 'placement'
|
||||
FLUXCD_HELMRELEASE_RABBITMQ = 'rabbitmq'
|
||||
FLUXCD_HELMRELEASE_SWIFT = 'ceph-rgw'
|
||||
FLUXCD_HELMRELEASE_DCDBSYNC = 'dcdbsync'
|
||||
FLUXCD_HELMRELEASE_PSP_ROLEBINDING = 'openstack-psp-rolebinding'
|
||||
|
||||
# Nova PCI Alias types and names
|
||||
# NOTE: Generic GPU and QAT definitions reside in sysinv/common/constants.py
|
||||
# and are required by sysinv-agent and puppet for PCI devices inventory.
|
||||
|
@ -15,6 +15,7 @@ class AodhHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the aodh chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_AODH
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_AODH
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_AODH
|
||||
AUTH_USERS = ['aodh']
|
||||
|
@ -15,6 +15,7 @@ class BarbicanHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the barbican chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_BARBICAN
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_BARBICAN
|
||||
AUTH_USERS = ['barbican']
|
||||
SERVICE_NAME = app_constants.HELM_CHART_BARBICAN
|
||||
|
||||
|
@ -16,6 +16,7 @@ class CeilometerHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the ceilometer chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_CEILOMETER
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_CEILOMETER
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_CEILOMETER
|
||||
AUTH_USERS = ['ceilometer']
|
||||
|
@ -22,6 +22,7 @@ class CinderHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the cinder chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_CINDER
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_CINDER
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_CINDER
|
||||
SERVICE_TYPE = 'volume'
|
||||
|
@ -16,6 +16,7 @@ class DcdbsyncHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the dcdbsync chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_DCDBSYNC
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_DCDBSYNC
|
||||
AUTH_USERS = ['dcdbsync']
|
||||
SERVICE_NAME = app_constants.HELM_CHART_DCDBSYNC
|
||||
|
||||
@ -37,6 +38,11 @@ class DcdbsyncHelm(openstack.OpenstackBaseHelm):
|
||||
operator.ARMADA_MANIFEST,
|
||||
operator.CHART_GROUPS_LUT[self.CHART])
|
||||
|
||||
def execute_kustomize_updates(self, operator):
|
||||
if not self._is_enabled(operator.APP, self.CHART,
|
||||
common.HELM_NS_OPENSTACK):
|
||||
operator.helm_release_resource_delete(self.CHART)
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
overrides = {
|
||||
common.HELM_NS_OPENSTACK: {
|
||||
|
@ -17,6 +17,7 @@ class FmRestApiHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the fm-rest-api chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_FM_REST_API
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_FM_REST_API
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_FM_REST_API
|
||||
AUTH_USERS = ['fm']
|
||||
|
@ -21,6 +21,7 @@ class GarbdHelm(openstack.BaseHelm):
|
||||
# same docker image.
|
||||
SERVICE_NAME = app_constants.HELM_CHART_MARIADB
|
||||
CHART = app_constants.HELM_CHART_GARBD
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_GARBD
|
||||
|
||||
def _is_enabled(self, app_name, chart_name, namespace):
|
||||
# First, see if this chart is enabled by the user then adjust based on
|
||||
@ -46,6 +47,12 @@ class GarbdHelm(openstack.BaseHelm):
|
||||
operator.CHART_GROUPS_LUT[self.CHART],
|
||||
operator.CHARTS_LUT[self.CHART])
|
||||
|
||||
def execute_kustomize_updates(self, operator):
|
||||
# On application load this chart is enabled
|
||||
if not self._is_enabled(operator.APP, self.CHART,
|
||||
common.HELM_NS_OPENSTACK):
|
||||
operator.helm_release_resource_delete(self.CHART)
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
overrides = {
|
||||
common.HELM_NS_OPENSTACK: {
|
||||
|
@ -23,6 +23,7 @@ class GlanceHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the glance chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_GLANCE
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_GLANCE
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_GLANCE
|
||||
SERVICE_TYPE = 'image'
|
||||
|
@ -15,6 +15,7 @@ class GnocchiHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the gnocchi chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_GNOCCHI
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_GNOCCHI
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_GNOCCHI
|
||||
AUTH_USERS = ['gnocchi']
|
||||
|
@ -15,6 +15,7 @@ class HeatHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the heat chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_HEAT
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_HEAT
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_HEAT
|
||||
AUTH_USERS = ['heat', 'heat_trustee', 'heat_stack_user']
|
||||
|
@ -15,6 +15,7 @@ class HelmToolkitHelm(base.BaseHelm):
|
||||
"""Class to encapsulate helm operations for the helm toolkit"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_HELM_TOOLKIT
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_HELM_TOOLKIT
|
||||
SUPPORTED_NAMESPACES = [
|
||||
common.HELM_NS_HELM_TOOLKIT,
|
||||
]
|
||||
|
@ -18,6 +18,7 @@ class HorizonHelm(openstack.OpenstackBaseHelm):
|
||||
CHART = app_constants.HELM_CHART_HORIZON
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_HORIZON
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_HORIZON
|
||||
|
||||
AUTH_USERS = ["admin"]
|
||||
|
||||
|
@ -15,6 +15,7 @@ class IngressHelm(openstack.BaseHelm):
|
||||
"""Class to encapsulate helm operations for the ingress chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_INGRESS
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_INGRESS
|
||||
|
||||
SUPPORTED_NAMESPACES = openstack.BaseHelm.SUPPORTED_NAMESPACES + [
|
||||
common.HELM_NS_KUBE_SYSTEM
|
||||
|
@ -16,6 +16,7 @@ class IronicHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the ironic chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_IRONIC
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_IRONIC
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_IRONIC
|
||||
SERVICE_USERS = ['glance']
|
||||
@ -39,6 +40,11 @@ class IronicHelm(openstack.OpenstackBaseHelm):
|
||||
operator.CHART_GROUPS_LUT[self.CHART],
|
||||
operator.CHARTS_LUT[self.CHART])
|
||||
|
||||
def execute_kustomize_updates(self, operator):
|
||||
if not self._is_enabled(operator.APP, self.CHART,
|
||||
common.HELM_NS_OPENSTACK):
|
||||
operator.helm_release_resource_delete(self.CHART)
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
overrides = {
|
||||
common.HELM_NS_OPENSTACK: {
|
||||
|
@ -21,6 +21,7 @@ class KeystoneHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the keystone chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_KEYSTONE
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_KEYSTONE
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_KEYSTONE
|
||||
SERVICE_PATH = '/v3'
|
||||
|
@ -17,6 +17,7 @@ class KeystoneApiProxyHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the keystone api proxy chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_KEYSTONE_API_PROXY
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_KEYSTONE
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_KEYSTONE_API_PROXY
|
||||
DCORCH_SERVICE_NAME = 'dcorch'
|
||||
@ -40,6 +41,11 @@ class KeystoneApiProxyHelm(openstack.OpenstackBaseHelm):
|
||||
operator.ARMADA_MANIFEST,
|
||||
operator.CHART_GROUPS_LUT[self.CHART])
|
||||
|
||||
def execute_kustomize_updates(self, operator):
|
||||
if not self._is_enabled(operator.APP, self.CHART,
|
||||
common.HELM_NS_OPENSTACK):
|
||||
operator.helm_release_resource_delete(self.CHART)
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
overrides = {
|
||||
common.HELM_NS_OPENSTACK: {
|
||||
|
@ -15,6 +15,7 @@ class LibvirtHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the libvirt chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_LIBVIRT
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_LIBVIRT
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_LIBVIRT
|
||||
|
||||
|
@ -15,6 +15,7 @@ class MagnumHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the magnum chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_MAGNUM
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_MAGNUM
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_MAGNUM
|
||||
|
||||
|
@ -16,6 +16,7 @@ class MariadbHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the mariadb chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_MARIADB
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_MARIADB
|
||||
|
||||
def _num_server_replicas(self):
|
||||
return self._num_controllers()
|
||||
|
@ -15,6 +15,7 @@ class MemcachedHelm(openstack.BaseHelm):
|
||||
"""Class to encapsulate helm operations for the memcached chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_MEMCACHED
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_MEMCACHED
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
overrides = {
|
||||
|
@ -23,6 +23,7 @@ class NeutronHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the neutron chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_NEUTRON
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_NEUTRON
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_NEUTRON
|
||||
AUTH_USERS = ['neutron']
|
||||
|
@ -16,6 +16,7 @@ class NginxPortsControlHelm(base.BaseHelm):
|
||||
"""Class to encapsulate helm operations for nginx-ports-control chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_NGINX_PORTS_CONTROL
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_NGINX_PORTS_CONTROL
|
||||
SUPPORTED_NAMESPACES = \
|
||||
base.BaseHelm.SUPPORTED_NAMESPACES + [common.HELM_NS_OPENSTACK]
|
||||
|
||||
|
@ -60,6 +60,7 @@ class NovaHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the nova chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_NOVA
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_NOVA
|
||||
|
||||
# (lcavalca): 'nova' is used as ingress fqdn by nova-api-proxy
|
||||
SERVICE_FQDN = 'nova-api-internal'
|
||||
|
@ -15,6 +15,7 @@ class NovaApiProxyHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the nova chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_NOVA_API_PROXY
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_NOVA_API_PROXY
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_NOVA_API_PROXY
|
||||
AUTH_USERS = ['nova']
|
||||
|
@ -47,19 +47,24 @@ class BaseHelm(base.BaseHelm):
|
||||
}
|
||||
|
||||
|
||||
class OpenstackBaseHelm(BaseHelm):
|
||||
class FluxCDBaseHelm(base.FluxCDBaseHelm):
|
||||
"""Class to encapsulate Openstack related service operations for helm"""
|
||||
|
||||
SUPPORTED_NAMESPACES = \
|
||||
base.BaseHelm.SUPPORTED_NAMESPACES + [common.HELM_NS_OPENSTACK]
|
||||
SUPPORTED_APP_NAMESPACES = {
|
||||
app_constants.HELM_APP_OPENSTACK:
|
||||
base.BaseHelm.SUPPORTED_NAMESPACES + [common.HELM_NS_OPENSTACK]
|
||||
}
|
||||
|
||||
|
||||
class OpenstackBaseHelm(FluxCDBaseHelm):
|
||||
"""Class to encapsulate Openstack service operations for helm"""
|
||||
|
||||
SYSTEM_CONTROLLER_SERVICES = [
|
||||
app_constants.HELM_CHART_KEYSTONE_API_PROXY,
|
||||
]
|
||||
|
||||
@property
|
||||
def CHART(self):
|
||||
# subclasses must define the property: CHART='name of chart'
|
||||
# if an author of a new chart forgets this, NotImplementedError is raised
|
||||
raise NotImplementedError
|
||||
|
||||
def _get_service_config(self, service):
|
||||
configs = self.context.setdefault('_service_configs', {})
|
||||
if service not in configs:
|
||||
@ -610,6 +615,23 @@ class OpenstackBaseHelm(BaseHelm):
|
||||
operator.CHART_GROUPS_LUT[self.CHART],
|
||||
operator.CHARTS_LUT[self.CHART])
|
||||
|
||||
def execute_kustomize_updates(self, operator):
|
||||
"""
|
||||
Update the elements of FluxCD kustomize manifests.
|
||||
|
||||
This allows a helm chart plugin to use the FluxCDKustomizeOperator to
|
||||
make dynamic structural changes to the application manifest based on the
|
||||
current conditions in the platform
|
||||
|
||||
Changes currenty include updates to the top level kustomize manifest to
|
||||
disable helm releases.
|
||||
|
||||
:param operator: an instance of the FluxCDKustomizeOperator
|
||||
"""
|
||||
if not self._is_enabled(operator.APP, self.CHART,
|
||||
common.HELM_NS_OPENSTACK):
|
||||
operator.helm_release_resource_delete(self.HELM_RELEASE)
|
||||
|
||||
def _is_enabled(self, app_name, chart_name, namespace):
|
||||
"""
|
||||
Check if the chart is enable at a system level
|
||||
|
@ -17,6 +17,7 @@ class OpenvswitchHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the openvswitch chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_OPENVSWITCH
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_OPENVSWITCH
|
||||
|
||||
def _is_enabled(self, app_name, chart_name, namespace):
|
||||
# First, see if this chart is enabled by the user then adjust based on
|
||||
@ -38,6 +39,11 @@ class OpenvswitchHelm(openstack.OpenstackBaseHelm):
|
||||
operator.CHARTS_LUT[self.CHART],
|
||||
before_chart=operator.CHARTS_LUT[app_constants.HELM_CHART_NOVA])
|
||||
|
||||
def execute_kustomize_updates(self, operator):
|
||||
if not self._is_enabled(operator.APP, self.CHART,
|
||||
common.HELM_NS_OPENSTACK):
|
||||
operator.helm_release_resource_delete(self.CHART)
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
overrides = {
|
||||
common.HELM_NS_OPENSTACK: {}
|
||||
|
@ -18,6 +18,7 @@ class PciIrqAffinityAgentHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the PCI IRQ affinity agent chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_PCI_IRQ_AFFINITY_AGENT
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_PCI_IRQ_AFFINITY_AGENT
|
||||
AUTH_USERS = ['pci-irq-affinity-agent']
|
||||
SERVICE_NAME = app_constants.HELM_CHART_PCI_IRQ_AFFINITY_AGENT
|
||||
|
||||
|
@ -16,6 +16,7 @@ class PlacementHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the placement chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_PLACEMENT
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_PLACEMENT
|
||||
|
||||
SERVICE_NAME = app_constants.HELM_CHART_PLACEMENT
|
||||
AUTH_USERS = ['placement']
|
||||
|
@ -15,6 +15,7 @@ class PSPRolebindingHelm(openstack.BaseHelm):
|
||||
"""Class to encapsulate helm operations for the psp rolebinding chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_PSP_ROLEBINDING
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_PSP_ROLEBINDING
|
||||
SERVICE_NAME = 'psp-rolebinding'
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
|
@ -15,6 +15,7 @@ class RabbitmqHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the rabbitmq chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_RABBITMQ
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_RABBITMQ
|
||||
|
||||
def get_overrides(self, namespace=None):
|
||||
limit_enabled, limit_cpus, limit_mem_mib = self._get_platform_res_limit()
|
||||
|
@ -15,6 +15,7 @@ class SwiftHelm(openstack.OpenstackBaseHelm):
|
||||
"""Class to encapsulate helm operations for the swift chart"""
|
||||
|
||||
CHART = app_constants.HELM_CHART_SWIFT
|
||||
HELM_RELEASE = app_constants.FLUXCD_HELMRELEASE_SWIFT
|
||||
|
||||
SERVICE_NAME = 'swift'
|
||||
SERVICE_TYPE = 'object-store'
|
||||
|
@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
class quoted_str(str):
|
||||
pass
|
||||
|
||||
|
||||
# force strings to be single-quoted to avoid interpretation as numeric values
|
||||
def quoted_presenter(dumper, data):
|
||||
return dumper.represent_scalar(u'tag:yaml.org,2002:str', data, style="'")
|
||||
|
||||
|
||||
yaml.add_representer(quoted_str, quoted_presenter)
|
@ -0,0 +1,122 @@
|
||||
#
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
||||
""" System inventory Kustomization resource operator."""
|
||||
|
||||
from oslo_log import log as logging
|
||||
from sysinv.common import constants
|
||||
from sysinv.common import exception
|
||||
from sysinv.helm import kustomize_base as base
|
||||
|
||||
from k8sapp_openstack.common import constants as app_constants
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpenstackFluxCDKustomizeOperator(base.FluxCDKustomizeOperator):
|
||||
|
||||
APP = constants.HELM_APP_OPENSTACK
|
||||
|
||||
APP_GROUP_SWIFT = [
|
||||
app_constants.FLUXCD_HELMRELEASE_SWIFT
|
||||
]
|
||||
APP_GROUP_COMPUTE_KIT = [
|
||||
app_constants.FLUXCD_HELMRELEASE_LIBVIRT,
|
||||
app_constants.FLUXCD_HELMRELEASE_PLACEMENT,
|
||||
app_constants.FLUXCD_HELMRELEASE_NOVA,
|
||||
app_constants.FLUXCD_HELMRELEASE_NOVA_API_PROXY,
|
||||
app_constants.FLUXCD_HELMRELEASE_PCI_IRQ_AFFINITY_AGENT,
|
||||
app_constants.FLUXCD_HELMRELEASE_NEUTRON
|
||||
]
|
||||
APP_GROUP_HEAT = [
|
||||
app_constants.FLUXCD_HELMRELEASE_HEAT
|
||||
]
|
||||
APP_GROUP_TELEMETRY = [
|
||||
app_constants.FLUXCD_HELMRELEASE_AODH,
|
||||
app_constants.FLUXCD_HELMRELEASE_GNOCCHI,
|
||||
app_constants.FLUXCD_HELMRELEASE_CEILOMETER
|
||||
]
|
||||
|
||||
def manifest_chart_groups_disable(self, dbapi, namespace, chart):
|
||||
""" Disable charts in chart group
|
||||
|
||||
:param dbapi: DB api object
|
||||
:param namespace: cgroup namespace
|
||||
:param chart: the chart
|
||||
"""
|
||||
|
||||
app_id = dbapi.kube_app_get(self.APP).id
|
||||
|
||||
db_helm_override = dbapi.helm_override_get(
|
||||
app_id, chart, namespace)
|
||||
|
||||
db_helm_override.system_overrides.update({'enabled': False})
|
||||
dbapi.helm_override_update(
|
||||
app_id, chart, namespace,
|
||||
{app_constants.HELM_OVERRIDE_GROUP_SYSTEM: db_helm_override.system_overrides})
|
||||
|
||||
def chart_remove(self, dbapi, namespace, chart):
|
||||
self.helm_release_resource_delete(chart)
|
||||
self.manifest_chart_groups_disable(dbapi, namespace, chart)
|
||||
|
||||
def platform_mode_kustomize_updates(self, dbapi, mode):
|
||||
""" Update the top-level kustomization resource list
|
||||
|
||||
Make changes to the top-level kustomization resource list based on the
|
||||
openstack mode
|
||||
|
||||
:param dbapi: DB api object
|
||||
:param mode: mode to control when to update the resource list
|
||||
"""
|
||||
|
||||
if mode == constants.OPENSTACK_RESTORE_DB:
|
||||
# During application restore, first bring up
|
||||
# MariaDB service.
|
||||
# TODO
|
||||
pass
|
||||
|
||||
elif mode == constants.OPENSTACK_RESTORE_STORAGE:
|
||||
# After MariaDB data is restored, restore Keystone,
|
||||
# Glance and Cinder.
|
||||
# TODO
|
||||
pass
|
||||
|
||||
else:
|
||||
# When mode is OPENSTACK_RESTORE_NORMAL or None,
|
||||
# bring up all the openstack services.
|
||||
try:
|
||||
system = dbapi.isystem_get_one()
|
||||
except exception.NotFound:
|
||||
LOG.exception("System %s not found.")
|
||||
raise
|
||||
|
||||
if (
|
||||
system.distributed_cloud_role
|
||||
== constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER
|
||||
):
|
||||
# remove the chart_groups not needed in this configuration
|
||||
for release in self.APP_GROUP_SWIFT:
|
||||
self.chart_remove(dbapi,
|
||||
app_constants.HELM_NS_OPENSTACK,
|
||||
release)
|
||||
for release in self.APP_GROUP_COMPUTE_KIT:
|
||||
self.chart_remove(dbapi,
|
||||
app_constants.HELM_NS_OPENSTACK,
|
||||
release)
|
||||
for release in self.APP_GROUP_HEAT:
|
||||
self.chart_remove(dbapi,
|
||||
app_constants.HELM_NS_OPENSTACK,
|
||||
release)
|
||||
for release in self.APP_GROUP_TELEMETRY:
|
||||
self.chart_remove(dbapi,
|
||||
app_constants.HELM_NS_OPENSTACK,
|
||||
release)
|
||||
|
||||
def save_kustomize_for_deletion(self):
|
||||
# TODO: transcribe the manifest_openstack save_delete_manifest logic
|
||||
pass
|
@ -63,6 +63,9 @@ systemconfig.helm_plugins.openstack =
|
||||
028_openstack-psp-rolebinding = k8sapp_openstack.helm.psp_rolebinding:PSPRolebindingHelm
|
||||
029_pci-irq-affinity-agent = k8sapp_openstack.helm.pci_irq_affinity_agent:PciIrqAffinityAgentHelm
|
||||
|
||||
systemconfig.fluxcd.kustomize_ops =
|
||||
openstack = k8sapp_openstack.kustomize.kustomize_openstack:OpenstackFluxCDKustomizeOperator
|
||||
|
||||
systemconfig.armada.manifest_ops =
|
||||
openstack = k8sapp_openstack.armada.manifest_openstack:OpenstackArmadaManifestOperator
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user