Remove armada
Depends-On: https://review.opendev.org/c/starlingx/config/+/869094 Story: 2010560 Task: 47618 Signed-off-by: Fabricio Henrique Ramos <fabriciohenrique.ramos@windriver.com> Change-Id: I10d138bcd5316bee87755fcf9be5121c606fad0b
This commit is contained in:
parent
7f5244e6a1
commit
ceda08964e
|
@ -1,19 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2019-2020 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)
|
|
@ -1,300 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2019-2021 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
||||
""" System inventory Armada manifest operator."""
|
||||
|
||||
from copy import deepcopy
|
||||
import os
|
||||
|
||||
from oslo_log import log as logging
|
||||
import ruamel.yaml as yaml
|
||||
from sysinv.common import constants
|
||||
from sysinv.common import exception
|
||||
from sysinv.helm import manifest_base as base
|
||||
|
||||
from k8sapp_openstack.common import constants as app_constants
|
||||
from k8sapp_openstack.helm.aodh import AodhHelm
|
||||
from k8sapp_openstack.helm.barbican import BarbicanHelm
|
||||
from k8sapp_openstack.helm.ceilometer import CeilometerHelm
|
||||
from k8sapp_openstack.helm.cinder import CinderHelm
|
||||
from k8sapp_openstack.helm.dcdbsync import DcdbsyncHelm
|
||||
from k8sapp_openstack.helm.fm_rest_api import FmRestApiHelm
|
||||
from k8sapp_openstack.helm.garbd import GarbdHelm
|
||||
from k8sapp_openstack.helm.glance import GlanceHelm
|
||||
from k8sapp_openstack.helm.gnocchi import GnocchiHelm
|
||||
from k8sapp_openstack.helm.heat import HeatHelm
|
||||
from k8sapp_openstack.helm.horizon import HorizonHelm
|
||||
from k8sapp_openstack.helm.ingress import IngressHelm
|
||||
from k8sapp_openstack.helm.ironic import IronicHelm
|
||||
from k8sapp_openstack.helm.keystone import KeystoneHelm
|
||||
from k8sapp_openstack.helm.keystone_api_proxy import KeystoneApiProxyHelm
|
||||
from k8sapp_openstack.helm.libvirt import LibvirtHelm
|
||||
from k8sapp_openstack.helm.magnum import MagnumHelm
|
||||
from k8sapp_openstack.helm.mariadb import MariadbHelm
|
||||
from k8sapp_openstack.helm.memcached import MemcachedHelm
|
||||
from k8sapp_openstack.helm.neutron import NeutronHelm
|
||||
from k8sapp_openstack.helm.nginx_ports_control import NginxPortsControlHelm
|
||||
from k8sapp_openstack.helm.nova import NovaHelm
|
||||
from k8sapp_openstack.helm.nova_api_proxy import NovaApiProxyHelm
|
||||
from k8sapp_openstack.helm.openvswitch import OpenvswitchHelm
|
||||
from k8sapp_openstack.helm.pci_irq_affinity_agent import PciIrqAffinityAgentHelm
|
||||
from k8sapp_openstack.helm.placement import PlacementHelm
|
||||
from k8sapp_openstack.helm.psp_rolebinding import PSPRolebindingHelm
|
||||
from k8sapp_openstack.helm.rabbitmq import RabbitmqHelm
|
||||
from k8sapp_openstack.helm.swift import SwiftHelm
|
||||
|
||||
|
||||
KEY_SCHEMA = "schema"
|
||||
VAL_SCHEMA_CHART_GROUP = "armada/ChartGroup/v"
|
||||
VAL_SCHEMA_MANIFEST = "armada/Manifest/v"
|
||||
KEY_METADATA = "metadata"
|
||||
KEY_METADATA_NAME = "name"
|
||||
KEY_DATA = "data"
|
||||
KEY_DATA_CHART_GROUP = "chart_group" # for chart group doc updates
|
||||
KEY_DATA_CHART_GROUPS = "chart_groups" # for manifest doc updates
|
||||
KEY_DATA_SEQUENCED = "sequenced"
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpenstackArmadaManifestOperator(base.ArmadaManifestOperator):
|
||||
APP = app_constants.HELM_APP_OPENSTACK
|
||||
ARMADA_MANIFEST = "openstack-manifest"
|
||||
|
||||
CHART_GROUP_PSP_ROLEBINDING = "openstack-psp-rolebinding"
|
||||
CHART_GROUP_INGRESS_OS = "openstack-ingress"
|
||||
CHART_GROUP_MAGNUM = "openstack-magnum"
|
||||
CHART_GROUP_MARIADB = "openstack-mariadb"
|
||||
CHART_GROUP_MEMCACHED = "openstack-memcached"
|
||||
CHART_GROUP_RABBITMQ = "openstack-rabbitmq"
|
||||
CHART_GROUP_KEYSTONE = "openstack-keystone"
|
||||
CHART_GROUP_KS_API_PROXY = "openstack-keystone-api-proxy"
|
||||
CHART_GROUP_BARBICAN = "openstack-barbican"
|
||||
CHART_GROUP_GLANCE = "openstack-glance"
|
||||
CHART_GROUP_SWIFT = "openstack-ceph-rgw"
|
||||
CHART_GROUP_CINDER = "openstack-cinder"
|
||||
CHART_GROUP_FM_REST_API = "openstack-fm-rest-api"
|
||||
CHART_GROUP_COMPUTE_KIT = "openstack-compute-kit"
|
||||
CHART_GROUP_HEAT = "openstack-heat"
|
||||
CHART_GROUP_HORIZON = "openstack-horizon"
|
||||
CHART_GROUP_TELEMETRY = "openstack-telemetry"
|
||||
CHART_GROUP_DCDBSYNC = "openstack-dcdbsync"
|
||||
|
||||
CHART_GROUPS_LUT = {
|
||||
AodhHelm.CHART: CHART_GROUP_TELEMETRY,
|
||||
BarbicanHelm.CHART: CHART_GROUP_BARBICAN,
|
||||
CeilometerHelm.CHART: CHART_GROUP_TELEMETRY,
|
||||
CinderHelm.CHART: CHART_GROUP_CINDER,
|
||||
FmRestApiHelm.CHART: CHART_GROUP_FM_REST_API,
|
||||
GarbdHelm.CHART: CHART_GROUP_MARIADB,
|
||||
GlanceHelm.CHART: CHART_GROUP_GLANCE,
|
||||
GnocchiHelm.CHART: CHART_GROUP_TELEMETRY,
|
||||
HeatHelm.CHART: CHART_GROUP_HEAT,
|
||||
HorizonHelm.CHART: CHART_GROUP_HORIZON,
|
||||
IngressHelm.CHART: CHART_GROUP_INGRESS_OS,
|
||||
IronicHelm.CHART: CHART_GROUP_COMPUTE_KIT,
|
||||
KeystoneHelm.CHART: CHART_GROUP_KEYSTONE,
|
||||
KeystoneApiProxyHelm.CHART: CHART_GROUP_KS_API_PROXY,
|
||||
LibvirtHelm.CHART: CHART_GROUP_COMPUTE_KIT,
|
||||
MagnumHelm.CHART: CHART_GROUP_MAGNUM,
|
||||
MariadbHelm.CHART: CHART_GROUP_MARIADB,
|
||||
MemcachedHelm.CHART: CHART_GROUP_MEMCACHED,
|
||||
NeutronHelm.CHART: CHART_GROUP_COMPUTE_KIT,
|
||||
NginxPortsControlHelm.CHART: CHART_GROUP_INGRESS_OS,
|
||||
NovaHelm.CHART: CHART_GROUP_COMPUTE_KIT,
|
||||
NovaApiProxyHelm.CHART: CHART_GROUP_COMPUTE_KIT,
|
||||
PciIrqAffinityAgentHelm.CHART: CHART_GROUP_COMPUTE_KIT,
|
||||
OpenvswitchHelm.CHART: CHART_GROUP_COMPUTE_KIT,
|
||||
PlacementHelm.CHART: CHART_GROUP_COMPUTE_KIT,
|
||||
PSPRolebindingHelm.CHART: CHART_GROUP_PSP_ROLEBINDING,
|
||||
RabbitmqHelm.CHART: CHART_GROUP_RABBITMQ,
|
||||
SwiftHelm.CHART: CHART_GROUP_SWIFT,
|
||||
DcdbsyncHelm.CHART: CHART_GROUP_DCDBSYNC,
|
||||
}
|
||||
|
||||
CHARTS_LUT = {
|
||||
AodhHelm.CHART: "openstack-aodh",
|
||||
BarbicanHelm.CHART: "openstack-barbican",
|
||||
CeilometerHelm.CHART: "openstack-ceilometer",
|
||||
CinderHelm.CHART: "openstack-cinder",
|
||||
GarbdHelm.CHART: "openstack-garbd",
|
||||
FmRestApiHelm.CHART: "openstack-fm-rest-api",
|
||||
GlanceHelm.CHART: "openstack-glance",
|
||||
GnocchiHelm.CHART: "openstack-gnocchi",
|
||||
HeatHelm.CHART: "openstack-heat",
|
||||
HorizonHelm.CHART: "openstack-horizon",
|
||||
IngressHelm.CHART: "openstack-ingress",
|
||||
IronicHelm.CHART: "openstack-ironic",
|
||||
KeystoneHelm.CHART: "openstack-keystone",
|
||||
KeystoneApiProxyHelm.CHART: "openstack-keystone-api-proxy",
|
||||
LibvirtHelm.CHART: "openstack-libvirt",
|
||||
MagnumHelm.CHART: "openstack-magnum",
|
||||
MariadbHelm.CHART: "openstack-mariadb",
|
||||
MemcachedHelm.CHART: "openstack-memcached",
|
||||
NeutronHelm.CHART: "openstack-neutron",
|
||||
NginxPortsControlHelm.CHART: "openstack-nginx-ports-control",
|
||||
NovaHelm.CHART: "openstack-nova",
|
||||
NovaApiProxyHelm.CHART: "openstack-nova-api-proxy",
|
||||
PciIrqAffinityAgentHelm.CHART: "openstack-pci-irq-affinity-agent",
|
||||
OpenvswitchHelm.CHART: "openstack-openvswitch",
|
||||
PSPRolebindingHelm.CHART: "openstack-psp-rolebinding",
|
||||
PlacementHelm.CHART: "openstack-placement",
|
||||
RabbitmqHelm.CHART: "openstack-rabbitmq",
|
||||
SwiftHelm.CHART: "openstack-ceph-rgw",
|
||||
DcdbsyncHelm.CHART: "openstack-dcdbsync",
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(OpenstackArmadaManifestOperator, self).__init__(*args, **kwargs)
|
||||
|
||||
self.delete_manifest_contents = [] # OS Armada app delete manifest
|
||||
|
||||
def platform_mode_manifest_updates(self, dbapi, mode):
|
||||
"""Update the application manifest based on the platform
|
||||
|
||||
This is used for
|
||||
|
||||
:param dbapi: DB api object
|
||||
:param mode: mode to control how to apply the application manifest
|
||||
"""
|
||||
|
||||
if mode == constants.OPENSTACK_RESTORE_DB:
|
||||
# During application restore, first bring up
|
||||
# MariaDB service.
|
||||
self.manifest_chart_groups_set(
|
||||
self.ARMADA_MANIFEST,
|
||||
[self.CHART_GROUP_INGRESS_OS, self.CHART_GROUP_MARIADB],
|
||||
)
|
||||
|
||||
elif mode == constants.OPENSTACK_RESTORE_STORAGE:
|
||||
# After MariaDB data is restored, restore Keystone,
|
||||
# Glance and Cinder.
|
||||
self.manifest_chart_groups_set(
|
||||
self.ARMADA_MANIFEST,
|
||||
[
|
||||
self.CHART_GROUP_INGRESS_OS,
|
||||
self.CHART_GROUP_MARIADB,
|
||||
self.CHART_GROUP_MEMCACHED,
|
||||
self.CHART_GROUP_RABBITMQ,
|
||||
self.CHART_GROUP_KEYSTONE,
|
||||
self.CHART_GROUP_GLANCE,
|
||||
self.CHART_GROUP_CINDER,
|
||||
],
|
||||
)
|
||||
|
||||
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
|
||||
self.manifest_chart_groups_delete(
|
||||
self.ARMADA_MANIFEST, self.CHART_GROUP_SWIFT
|
||||
)
|
||||
self.manifest_chart_groups_delete(
|
||||
self.ARMADA_MANIFEST, self.CHART_GROUP_COMPUTE_KIT
|
||||
)
|
||||
self.manifest_chart_groups_delete(
|
||||
self.ARMADA_MANIFEST, self.CHART_GROUP_HEAT
|
||||
)
|
||||
self.manifest_chart_groups_delete(
|
||||
self.ARMADA_MANIFEST, self.CHART_GROUP_TELEMETRY
|
||||
)
|
||||
|
||||
def save_delete_manifest(self):
|
||||
"""Save an updated manifest for deletion
|
||||
|
||||
This is an override method to reverse the OpenStack remove sequence,
|
||||
compared to the deployment sequence in OpenStack manifest
|
||||
|
||||
armada delete doesn't support --values files as does the apply. To
|
||||
handle proper deletion of the conditional charts/chart groups that end
|
||||
up in the overrides files, create a unified file for use when deleting.
|
||||
|
||||
NOTE #1: If we want to abandon using manifest overrides files,
|
||||
this generated file could probably be used on apply and delete.
|
||||
|
||||
NOTE #2: Diffing the original manifest and this manifest provides a
|
||||
clear view of the conditional changes that were enforced by the system
|
||||
in the plugins
|
||||
"""
|
||||
|
||||
if os.path.exists(self.manifest_path):
|
||||
|
||||
self.delete_manifest_contents = deepcopy(self.content)
|
||||
|
||||
# Reverse the OpenStack remove sequence
|
||||
for i in self.delete_manifest_contents:
|
||||
|
||||
if VAL_SCHEMA_MANIFEST in i[KEY_SCHEMA]:
|
||||
i[KEY_DATA][KEY_DATA_CHART_GROUPS].reverse()
|
||||
|
||||
if VAL_SCHEMA_CHART_GROUP in i[KEY_SCHEMA]:
|
||||
|
||||
# Neutron shall be first one to be deleted on (reversed)
|
||||
# compute kit group
|
||||
if (
|
||||
i[KEY_METADATA][KEY_METADATA_NAME]
|
||||
== self.CHART_GROUP_COMPUTE_KIT
|
||||
):
|
||||
|
||||
try:
|
||||
lst = i[KEY_DATA][KEY_DATA_CHART_GROUP]
|
||||
lst.append(
|
||||
lst.pop(
|
||||
lst.index(
|
||||
self.CHARTS_LUT[NeutronHelm.CHART]))
|
||||
)
|
||||
|
||||
# Compute-kit group shall be deleted sequentially
|
||||
i[KEY_DATA][KEY_DATA_SEQUENCED] = "true"
|
||||
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
"Failed compute-kit delete manifest. %s" % e)
|
||||
|
||||
# Removal sequence is the reverse of deployment sequence
|
||||
# (for all groups)
|
||||
i[KEY_DATA][KEY_DATA_CHART_GROUP].reverse()
|
||||
|
||||
# cleanup existing delete manifest
|
||||
self._cleanup_deletion_manifest()
|
||||
|
||||
# Save overrides
|
||||
if self.delete_manifest:
|
||||
with open(self.delete_manifest, "w") as f:
|
||||
try:
|
||||
yaml.dump_all(
|
||||
self.delete_manifest_contents,
|
||||
f,
|
||||
Dumper=yaml.RoundTripDumper,
|
||||
explicit_start=True,
|
||||
default_flow_style=False,
|
||||
)
|
||||
LOG.info(
|
||||
"Delete manifest file %s is generated"
|
||||
% self.delete_manifest
|
||||
)
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
"Failed to generate delete manifest file %s. %s"
|
||||
% (self.delete_manifest, e)
|
||||
)
|
||||
else:
|
||||
LOG.error("Delete manifest file does not exist.")
|
||||
else:
|
||||
LOG.error(
|
||||
"Manifest directory %s does not exist." % self.manifest_path)
|
|
@ -602,25 +602,6 @@ class OpenstackBaseHelm(FluxCDBaseHelm):
|
|||
break
|
||||
return addresses
|
||||
|
||||
def execute_manifest_updates(self, operator):
|
||||
"""
|
||||
Update the elements of the armada manifest.
|
||||
|
||||
This allows a helm chart plugin to use the ArmadaManifestOperator to
|
||||
make dynamic structural changes to the application manifest based on the
|
||||
current conditions in the platform
|
||||
|
||||
Changes include updates to manifest documents for the following schemas:
|
||||
armada/Manifest/v1, armada/ChartGroup/v1, armada/Chart/v1.
|
||||
|
||||
:param operator: an instance of the ArmadaManifestOperator
|
||||
"""
|
||||
if not self._is_enabled(operator.APP, self.CHART,
|
||||
common.HELM_NS_OPENSTACK):
|
||||
operator.chart_group_chart_delete(
|
||||
operator.CHART_GROUPS_LUT[self.CHART],
|
||||
operator.CHARTS_LUT[self.CHART])
|
||||
|
||||
def execute_kustomize_updates(self, operator):
|
||||
"""
|
||||
Update the elements of FluxCD kustomize manifests.
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
""" System inventory App lifecycle operator."""
|
||||
|
||||
from eventlet import greenthread
|
||||
from oslo_log import log as logging
|
||||
from sysinv.api.controllers.v1 import utils
|
||||
from sysinv.common import constants
|
||||
|
@ -16,7 +15,6 @@ from sysinv.common import exception
|
|||
from sysinv.helm import common
|
||||
from sysinv.helm import lifecycle_base as base
|
||||
from sysinv.helm import lifecycle_utils as lifecycle_utils
|
||||
from sysinv.helm import utils as helm_utils
|
||||
from sysinv.helm.lifecycle_constants import LifecycleConstants
|
||||
|
||||
from k8sapp_openstack import utils as app_utils
|
||||
|
@ -53,12 +51,6 @@ class OpenstackAppLifecycleOperator(base.AppLifecycleOperator):
|
|||
elif hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST:
|
||||
return self.post_remove(context, conductor_obj, hook_info)
|
||||
|
||||
# Manifest
|
||||
elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_MANIFEST and \
|
||||
hook_info.operation == constants.APP_APPLY_OP and \
|
||||
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE:
|
||||
return self.pre_manifest_apply(app, app_op, hook_info)
|
||||
|
||||
# Resource
|
||||
elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RESOURCE:
|
||||
if hook_info.operation == constants.APP_APPLY_OP and \
|
||||
|
@ -132,40 +124,6 @@ class OpenstackAppLifecycleOperator(base.AppLifecycleOperator):
|
|||
# the prior apply state, update the ceph config
|
||||
conductor_obj._update_radosgw_config(context)
|
||||
|
||||
def pre_manifest_apply(self, app, app_op, hook_info):
|
||||
"""Pre manifest apply actions
|
||||
|
||||
:param app_op: AppOperator object
|
||||
:param app: AppOperator.Application object
|
||||
:param hook_info: LifecycleHookInfo object
|
||||
|
||||
"""
|
||||
# For stx-openstack app, if the apply operation was terminated
|
||||
# (e.g. user aborted, controller swacted, sysinv conductor
|
||||
# restarted) while compute-kit charts group was being deployed,
|
||||
# Tiller may still be processing these charts. Issuing another
|
||||
# manifest apply request while there are pending install of libvirt,
|
||||
# neutron and/or nova charts will result in reapply failure.
|
||||
#
|
||||
# Wait up to 10 minutes for Tiller to finish its transaction
|
||||
# from previous apply before making a new manifest apply request.
|
||||
LOG.info("Wait if there are openstack charts in pending install...")
|
||||
for i in range(self.CHARTS_PENDING_INSTALL_ITERATIONS):
|
||||
result = helm_utils.get_openstack_pending_install_charts()
|
||||
if not result:
|
||||
break
|
||||
|
||||
if app_op.is_app_aborted(app.name):
|
||||
raise exception.KubeAppAbort()
|
||||
greenthread.sleep(10)
|
||||
if result:
|
||||
app_op._abort_operation(app, constants.APP_APPLY_OP)
|
||||
raise exception.KubeAppApplyFailure(
|
||||
name=app.name, version=app.version,
|
||||
reason="Timed out while waiting for some charts that "
|
||||
"are still in pending install in previous application "
|
||||
"apply to clear. Please try again later.")
|
||||
|
||||
def pre_remove(self, context, conductor_obj, hook_info):
|
||||
"""Pre remove actions
|
||||
|
||||
|
|
|
@ -2,15 +2,12 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import mock
|
||||
from sysinv.common import constants
|
||||
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.test_helm import HelmOperatorTestSuiteMixin
|
||||
|
||||
from k8sapp_openstack.armada.manifest_openstack import OpenstackArmadaManifestOperator
|
||||
from k8sapp_openstack.common import constants as app_constants
|
||||
|
||||
|
||||
|
@ -45,12 +42,6 @@ class K8SAppOpenstackAppMixin(K8SAppOpenstackAppBaseMixin):
|
|||
def setUp(self):
|
||||
super(K8SAppOpenstackAppMixin, self).setUp()
|
||||
|
||||
save_delete_manifest = mock.patch.object(
|
||||
OpenstackArmadaManifestOperator, "save_delete_manifest"
|
||||
)
|
||||
save_delete_manifest.start()
|
||||
self.addCleanup(save_delete_manifest.stop)
|
||||
|
||||
|
||||
# Test Configuration:
|
||||
# - Controller
|
||||
|
@ -59,7 +50,6 @@ class K8SAppOpenstackAppMixin(K8SAppOpenstackAppBaseMixin):
|
|||
# - stx-openstack app
|
||||
class K8SAppOpenstackControllerTestCase(
|
||||
K8SAppOpenstackAppMixin,
|
||||
HelmOperatorTestSuiteMixin,
|
||||
dbbase.BaseIPv6Mixin,
|
||||
dbbase.BaseCephStorageBackendMixin,
|
||||
dbbase.ControllerHostTestCase,
|
||||
|
@ -74,7 +64,6 @@ class K8SAppOpenstackControllerTestCase(
|
|||
# - stx-openstack app
|
||||
class K8SAppOpenstackAIOTestCase(
|
||||
K8SAppOpenstackAppMixin,
|
||||
HelmOperatorTestSuiteMixin,
|
||||
dbbase.BaseCephStorageBackendMixin,
|
||||
dbbase.AIOSimplexHostTestCase,
|
||||
):
|
||||
|
@ -89,125 +78,4 @@ class SaveDeleteManifestTestCase(
|
|||
base.HelmTestCaseMixin,
|
||||
dbbase.ControllerHostTestCase
|
||||
):
|
||||
@mock.patch("os.path.exists", return_value=True)
|
||||
@mock.patch(
|
||||
"k8sapp_openstack.armada.manifest_openstack.deepcopy",
|
||||
return_value=[
|
||||
{
|
||||
"schema": "armada/ChartGroup/v1",
|
||||
"metadata": {
|
||||
"name": "openstack-compute-kit",
|
||||
},
|
||||
"data": {
|
||||
"sequenced": "false",
|
||||
"chart_group": [
|
||||
"openstack-libvirt",
|
||||
"openstack-placement",
|
||||
"openstack-nova",
|
||||
"openstack-nova-api-proxy",
|
||||
"openstack-pci-irq-affinity-agent",
|
||||
"openstack-neutron",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"schema": "armada/Manifest/v1",
|
||||
"metadata": {
|
||||
"name": "openstack-manifest",
|
||||
},
|
||||
"data": {
|
||||
"release_prefix": "osh",
|
||||
"chart_groups": [
|
||||
"openstack-psp-rolebinding",
|
||||
"openstack-ingress",
|
||||
"openstack-mariadb",
|
||||
"openstack-memcached",
|
||||
"openstack-rabbitmq",
|
||||
"openstack-keystone",
|
||||
"openstack-barbican",
|
||||
"openstack-glance",
|
||||
"openstack-cinder",
|
||||
"openstack-ceph-rgw",
|
||||
"openstack-compute-kit",
|
||||
"openstack-heat",
|
||||
"openstack-fm-rest-api",
|
||||
"openstack-horizon",
|
||||
"openstack-telemetry",
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
@mock.patch("six.moves.builtins.open", mock.mock_open(read_data="fake"))
|
||||
@mock.patch(
|
||||
"k8sapp_openstack.armada.manifest_openstack"
|
||||
".OpenstackArmadaManifestOperator._cleanup_deletion_manifest"
|
||||
)
|
||||
def test_save_delete_manifest(self, *_):
|
||||
def assert_manifest_overrides(manifest, parameters):
|
||||
"""Validate the manifest contains the supplied parameters"""
|
||||
if not isinstance(manifest, list) \
|
||||
or not isinstance(parameters, list):
|
||||
self.assertOverridesParameters(manifest, parameters)
|
||||
else:
|
||||
for i in parameters:
|
||||
for j in manifest:
|
||||
if (
|
||||
i[KEY_SCHEMA] == j[KEY_SCHEMA]
|
||||
and i[KEY_METADATA][KEY_METADATA_NAME]
|
||||
== j[KEY_METADATA][KEY_METADATA_NAME]
|
||||
):
|
||||
self.assertOverridesParameters(j, i)
|
||||
break
|
||||
|
||||
armada_op = OpenstackArmadaManifestOperator()
|
||||
armada_op.save_delete_manifest()
|
||||
|
||||
assert_manifest_overrides(
|
||||
armada_op.delete_manifest_contents,
|
||||
[
|
||||
{
|
||||
"schema": "armada/ChartGroup/v1",
|
||||
"metadata": {
|
||||
"name": "openstack-compute-kit",
|
||||
},
|
||||
"data": {
|
||||
"sequenced": "true",
|
||||
"chart_group": [
|
||||
"openstack-neutron",
|
||||
"openstack-pci-irq-affinity-agent",
|
||||
"openstack-nova-api-proxy",
|
||||
"openstack-nova",
|
||||
"openstack-placement",
|
||||
"openstack-libvirt",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"schema": "armada/Manifest/v1",
|
||||
"metadata": {
|
||||
"name": "openstack-manifest",
|
||||
},
|
||||
"data": {
|
||||
"release_prefix": "osh",
|
||||
"chart_groups": [
|
||||
"openstack-telemetry",
|
||||
"openstack-horizon",
|
||||
"openstack-fm-rest-api",
|
||||
"openstack-heat",
|
||||
"openstack-compute-kit",
|
||||
"openstack-ceph-rgw",
|
||||
"openstack-cinder",
|
||||
"openstack-glance",
|
||||
"openstack-barbican",
|
||||
"openstack-keystone",
|
||||
"openstack-rabbitmq",
|
||||
"openstack-memcached",
|
||||
"openstack-mariadb",
|
||||
"openstack-ingress",
|
||||
"openstack-psp-rolebinding",
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
pass
|
||||
|
|
|
@ -66,9 +66,6 @@ systemconfig.helm_plugins.openstack =
|
|||
systemconfig.fluxcd.kustomize_ops =
|
||||
openstack = k8sapp_openstack.kustomize.kustomize_openstack:OpenstackFluxCDKustomizeOperator
|
||||
|
||||
systemconfig.armada.manifest_ops =
|
||||
openstack = k8sapp_openstack.armada.manifest_openstack:OpenstackArmadaManifestOperator
|
||||
|
||||
systemconfig.app_lifecycle =
|
||||
openstack = k8sapp_openstack.lifecycle.lifecycle_openstack:OpenstackAppLifecycleOperator
|
||||
|
||||
|
|
Loading…
Reference in New Issue