Merge "Decouple helm cert-manager plugins from sysinv"

This commit is contained in:
Zuul 2020-06-12 17:48:45 +00:00 committed by Gerrit Code Review
commit ce7e35a465
5 changed files with 0 additions and 136 deletions

View File

@ -66,12 +66,6 @@ systemconfig.puppet_plugins =
037_monitor = sysinv.puppet.monitor:MonitorPuppet
099_service_parameter = sysinv.puppet.service_parameter:ServiceParamPuppet
systemconfig.helm_applications =
cert-manager = systemconfig.helm_plugins.cert_manager
systemconfig.helm_plugins.cert_manager =
001_cert-manager = sysinv.helm.cert_manager:CertMgrHelm
systemconfig.armada.manifest_ops =
generic = sysinv.helm.manifest_generic:GenericArmadaManifestOperator

View File

@ -1,51 +0,0 @@
#
# Copyright (c) 2020 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.common import constants
from sysinv.common import exception
from sysinv.helm import base
from sysinv.helm import common
class CertMgrHelm(base.BaseHelm):
"""Class to encapsulate helm operations for the cert-manager chart"""
SUPPORTED_NAMESPACES = base.BaseHelm.SUPPORTED_NAMESPACES + \
[common.HELM_NS_CERT_MANAGER]
SUPPORTED_APP_NAMESPACES = {
constants.HELM_APP_CERT_MANAGER:
base.BaseHelm.SUPPORTED_NAMESPACES + [common.HELM_NS_CERT_MANAGER],
}
CHART = common.HELM_CHART_CERT_MANAGER
SERVICE_NAME = 'cert-manager'
def get_namespaces(self):
return self.SUPPORTED_NAMESPACES
def get_overrides(self, namespace=None):
overrides = {
common.HELM_NS_CERT_MANAGER: {
'replicaCount': max(1, self._num_provisioned_controllers()),
'webhook': {
'replicaCount': max(1, self._num_provisioned_controllers()),
},
'cainjector': {
'replicaCount': max(1, self._num_provisioned_controllers()),
},
}
}
if namespace in self.SUPPORTED_NAMESPACES:
return overrides[namespace]
elif namespace:
raise exception.InvalidHelmNamespace(chart=self.CHART,
namespace=namespace)
else:
return overrides

View File

@ -25,10 +25,6 @@ HELM_REPO_FOR_PLATFORM = 'stx-platform'
HELM_CHART_ATTR_ENABLED = 'enabled'
HELM_CHART_ATTRS = [HELM_CHART_ATTR_ENABLED]
# Chart defs needed for platform integration
# These values match the names in the chart package's Chart.yaml
HELM_CHART_CERT_MANAGER = 'cert-manager'
# TODO(rchurch): These are still needed for _check_monitor_labels(). This method
# should migrated to the monitor application with the application framework
# providing a hook to call for app specific label checking.

View File

@ -1,49 +0,0 @@
# Copyright (c) 2020 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.db import api as dbapi
from sysinv.helm import common
from sysinv.tests.db import base as dbbase
from sysinv.tests.db import utils as dbutils
from sysinv.tests.helm import base
from sysinv.tests.helm import test_helm
class CertManagerTestCase(test_helm.StxCertMgrAppMixin,
base.HelmTestCaseMixin):
def setUp(self):
super(CertManagerTestCase, self).setUp()
self.app = dbutils.create_test_app(name='cert-manager')
self.dbapi = dbapi.get_instance()
class CertManagerIPv4ControllerHostTestCase(CertManagerTestCase,
dbbase.ProvisionedControllerHostTestCase):
def test_replicas(self):
overrides = self.operator.get_helm_chart_overrides(
common.HELM_CHART_CERT_MANAGER,
cnamespace=common.HELM_NS_CERT_MANAGER)
self.assertOverridesParameters(overrides, {
# 1 replica for 1 controller
'replicaCount': 1
})
class CertManagerIPv6AIODuplexSystemTestCase(CertManagerTestCase,
dbbase.BaseIPv6Mixin,
dbbase.ProvisionedAIODuplexSystemTestCase):
def test_replicas(self):
overrides = self.operator.get_helm_chart_overrides(
common.HELM_CHART_CERT_MANAGER,
cnamespace=common.HELM_NS_CERT_MANAGER)
self.assertOverridesParameters(overrides, {
# 2 replicas for 2 controllers
'replicaCount': 2
})

View File

@ -6,24 +6,13 @@
import keyring
import mock
from sysinv.common import constants
from sysinv.helm.helm import HelmOperator
from sysinv.helm.manifest_base import ArmadaManifestOperator
from sysinv.tests.db import base as dbbase
from sysinv.tests.db import utils as dbutils
from sysinv.tests.helm import base as helm_base
class StxCertMgrAppMixin(object):
app_name = constants.HELM_APP_CERT_MANAGER
path_name = app_name + '.tgz'
def setUp(self):
super(StxCertMgrAppMixin, self).setUp()
class HelmOperatorTestSuiteMixin(helm_base.HelmTestCaseMixin):
"""When HelmOperatorTestSuiteMixin is added as a Mixin
alongside a subclass of BaseHostTestCase
@ -67,18 +56,3 @@ class HelmOperatorTestSuiteMixin(helm_base.HelmTestCaseMixin):
self.operator.generate_helm_application_overrides(self.path_name,
self.app_name)
assert self.mock_save_overrides.called
# ============ Tests ======
# Test Configuration:
# - Controller
# - IPv6
# - Ceph Storage
# - cert-manager app
class HelmSTXCertMgrControllerTestCase(StxCertMgrAppMixin,
dbbase.BaseIPv6Mixin,
dbbase.BaseCephStorageBackendMixin,
HelmOperatorTestSuiteMixin,
dbbase.ControllerHostTestCase):
pass