Load the helm plugins dynamically through stevedore

Update in sysinv to use stevedore dynamically load the helm
plugins instead of listing them statically in helm code.

Tested on AIO-SX:
 - fresh install + config_controller with kubernetes
 - stx-openstack application installed successfully through
   "system application-apply" command.
 - all pods are running after the subsequent lock/unlock

Change-Id: I4efba886b796bda87984d3fd8838478ce7a8f1bf
Story: 2003909
Task: 28187
Signed-off-by: Angie Wang <angie.wang@windriver.com>
This commit is contained in:
Angie Wang 2018-11-29 16:01:32 -05:00
parent 7459ce68aa
commit 962af3cf01
2 changed files with 35 additions and 59 deletions

View File

@ -72,6 +72,31 @@ systemconfig.puppet_plugins =
032_swift = sysinv.puppet.swift:SwiftPuppet 032_swift = sysinv.puppet.swift:SwiftPuppet
033_service_parameter = sysinv.puppet.service_parameter:ServiceParamPuppet 033_service_parameter = sysinv.puppet.service_parameter:ServiceParamPuppet
systemconfig.helm_plugins =
aodh = sysinv.helm.aodh:AodhHelm
barbican = sysinv.helm.barbican:BarbicanHelm
ceilometer = sysinv.helm.ceilometer:CeilometerHelm
cinder = sysinv.helm.cinder:CinderHelm
glance = sysinv.helm.glance:GlanceHelm
gnocchi = sysinv.helm.gnocchi:GnocchiHelm
heat = sysinv.helm.heat:HeatHelm
horizon = sysinv.helm.horizon:HorizonHelm
ingress = sysinv.helm.ingress:IngressHelm
ironic = sysinv.helm.ironic:IronicHelm
keystone = sysinv.helm.keystone:KeystoneHelm
libvirt = sysinv.helm.libvirt:LibvirtHelm
magnum = sysinv.helm.magnum:MagnumHelm
mariadb = sysinv.helm.mariadb:MariadbHelm
memcached = sysinv.helm.memcached:MemcachedHelm
neutron = sysinv.helm.neutron:NeutronHelm
nfs-provisioner = sysinv.helm.nfs_provisioner:NfsProvisionerHelm
nova = sysinv.helm.nova:NovaHelm
nova-api-proxy = sysinv.helm.nova_api_proxy:NovaApiProxyHelm
openvswitch = sysinv.helm.openvswitch:OpenvswitchHelm
panko = sysinv.helm.panko:PankoHelm
rabbitmq = sysinv.helm.rabbitmq:RabbitmqHelm
rbd-provisioner = sysinv.helm.rbd_provisioner:RbdProvisionerHelm
sysinv.agent.lldp.drivers = sysinv.agent.lldp.drivers =
lldpd = sysinv.agent.lldp.drivers.lldpd.driver:SysinvLldpdAgentDriver lldpd = sysinv.agent.lldp.drivers.lldpd.driver:SysinvLldpdAgentDriver
ovs = sysinv.agent.lldp.drivers.ovs.driver:SysinvOVSAgentDriver ovs = sysinv.agent.lldp.drivers.ovs.driver:SysinvOVSAgentDriver

View File

@ -16,41 +16,12 @@ import tempfile
import yaml import yaml
from six import iteritems from six import iteritems
from stevedore import extension
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.openstack.common import log as logging from sysinv.openstack.common import log as logging
from . import common from . import common
# Import Chart Override Helpers:
# Chart source: https://github.com/openstack/openstack-helm.git
from . import aodh
from . import barbican
from . import ceilometer
from . import cinder
from . import glance
from . import gnocchi
from . import heat
from . import horizon
from . import ironic
from . import keystone
from . import magnum
from . import neutron
from . import nova
# Chart source: https://github.com/openstack/openstack-helm-infra.git
from . import ingress
from . import libvirt
from . import nfs_provisioner
from . import mariadb
from . import memcached
from . import openvswitch
from . import panko
from . import rabbitmq
# Chart source: Custom
from . import rbd_provisioner
from . import nova_api_proxy
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -90,35 +61,15 @@ class HelmOperator(object):
self.docker_repo_source = docker_repository self.docker_repo_source = docker_repository
# register chart operators for lookup # register chart operators for lookup
self.chart_operators = { self.chart_operators = {}
constants.HELM_CHART_AODH: aodh.AodhHelm(self),
constants.HELM_CHART_BARBICAN: barbican.BarbicanHelm(self), helm_plugins = extension.ExtensionManager(
constants.HELM_CHART_CEILOMETER: ceilometer.CeilometerHelm(self), namespace='systemconfig.helm_plugins',
constants.HELM_CHART_CINDER: cinder.CinderHelm(self), invoke_on_load=True, invoke_args=(self,))
constants.HELM_CHART_GLANCE: glance.GlanceHelm(self),
constants.HELM_CHART_GNOCCHI: gnocchi.GnocchiHelm(self), for plugin in helm_plugins.extensions:
constants.HELM_CHART_HEAT: heat.HeatHelm(self), self.chart_operators.update({plugin.name: plugin.obj})
constants.HELM_CHART_HORIZON: horizon.HorizonHelm(self), LOG.debug("Loaded helm plugin %s" % plugin.name)
constants.HELM_CHART_INGRESS: ingress.IngressHelm(self),
constants.HELM_CHART_IRONIC: ironic.IronicHelm(self),
constants.HELM_CHART_KEYSTONE: keystone.KeystoneHelm(self),
constants.HELM_CHART_LIBVIRT: libvirt.LibvirtHelm(self),
constants.HELM_CHART_MAGNUM: magnum.MagnumHelm(self),
constants.HELM_CHART_MARIADB: mariadb.MariadbHelm(self),
constants.HELM_CHART_MEMCACHED: memcached.MemcachedHelm(self),
constants.HELM_CHART_NEUTRON: neutron.NeutronHelm(self),
constants.HELM_CHART_NFS_PROVISIONER:
nfs_provisioner.NfsProvisionerHelm(self),
constants.HELM_CHART_NOVA: nova.NovaHelm(self),
constants.HELM_CHART_NOVA_API_PROXY:
nova_api_proxy.NovaApiProxyHelm(self),
constants.HELM_CHART_OPENVSWITCH:
openvswitch.OpenvswitchHelm(self),
constants.HELM_CHART_PANKO: panko.PankoHelm(self),
constants.HELM_CHART_RABBITMQ: rabbitmq.RabbitmqHelm(self),
constants.HELM_CHART_RBD_PROVISIONER:
rbd_provisioner.RbdProvisionerHelm(self)
}
# build the list of registered supported charts # build the list of registered supported charts
self.implemented_charts = [] self.implemented_charts = []