Add lifecycle for rook-ceph application
Fix monitor audit for duplex for coding miss Story: 2005527 Task: 41637 Depends-On: If8c1204dd3c7cc25487b2f645ace9aa680d32d59 Change-Id: I48aa3ea83be7bd24e4e9170eae006ba3f547715d Signed-off-by: Chen, Haochuan Z <haochuan.z.chen@intel.com>
This commit is contained in:
parent
5bbddf837a
commit
e631ceff0e
@ -0,0 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
@ -0,0 +1,80 @@
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
||||
""" System inventory App lifecycle operator."""
|
||||
# Temporary disable pylint for lifecycle hooks
|
||||
# This will be reverted in a future commit
|
||||
# pylint: disable=no-member
|
||||
# pylint: disable=no-name-in-module
|
||||
from oslo_log import log as logging
|
||||
from sysinv.common import constants
|
||||
from sysinv.common import exception
|
||||
from sysinv.helm import lifecycle_base as base
|
||||
from sysinv.helm.lifecycle_constants import LifecycleConstants
|
||||
from sysinv.helm import lifecycle_utils as lifecycle_utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RookCephAppLifecycleOperator(base.AppLifecycleOperator):
|
||||
def app_lifecycle_actions(self, context, conductor_obj, app_op, app, hook_info):
|
||||
""" Perform lifecycle actions for an operation
|
||||
|
||||
:param context: request context
|
||||
:param conductor_obj: conductor object
|
||||
:param app_op: AppOperator object
|
||||
:param app: AppOperator.Application object
|
||||
:param hook_info: LifecycleHookInfo object
|
||||
|
||||
"""
|
||||
# Rbd
|
||||
if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RBD:
|
||||
if hook_info.operation == constants.APP_APPLY_OP and \
|
||||
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE:
|
||||
return lifecycle_utils.create_rbd_provisioner_secrets(app_op, app, hook_info)
|
||||
elif hook_info.operation == constants.APP_REMOVE_OP and \
|
||||
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST:
|
||||
return lifecycle_utils.delete_rbd_provisioner_secrets(app_op, app, hook_info)
|
||||
|
||||
# Resources
|
||||
elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RESOURCE:
|
||||
if hook_info.operation == constants.APP_APPLY_OP and \
|
||||
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE:
|
||||
return lifecycle_utils.create_local_registry_secrets(app_op, app, hook_info)
|
||||
elif hook_info.operation == constants.APP_REMOVE_OP and \
|
||||
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST:
|
||||
return lifecycle_utils.delete_local_registry_secrets(app_op, app, hook_info)
|
||||
|
||||
# Operation
|
||||
elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_OPERATION:
|
||||
if hook_info.operation == constants.APP_APPLY_OP and \
|
||||
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST:
|
||||
return self.post_apply(context, conductor_obj, app, hook_info)
|
||||
|
||||
# Use the default behaviour for other hooks
|
||||
super(RookCephAppLifecycleOperator, self).app_lifecycle_actions(context, conductor_obj, app_op, app, hook_info)
|
||||
|
||||
def post_apply(self, context, conductor_obj, app, hook_info):
|
||||
""" Post apply actions
|
||||
|
||||
:param context: request context
|
||||
:param conductor_obj: conductor object
|
||||
:param app: AppOperator.Application object
|
||||
:param hook_info: LifecycleHookInfo object
|
||||
|
||||
"""
|
||||
if LifecycleConstants.EXTRA not in hook_info:
|
||||
raise exception.LifecycleMissingInfo("Missing {}".format(LifecycleConstants.EXTRA))
|
||||
if LifecycleConstants.APP_APPLIED not in hook_info[LifecycleConstants.EXTRA]:
|
||||
raise exception.LifecycleMissingInfo(
|
||||
"Missing {} {}".format(LifecycleConstants.EXTRA, LifecycleConstants.APP_APPLIED))
|
||||
|
||||
if hook_info[LifecycleConstants.EXTRA][LifecycleConstants.APP_APPLIED]:
|
||||
# apply any runtime configurations that are needed for
|
||||
# rook_ceph application
|
||||
conductor_obj._update_config_for_rook_ceph(context)
|
@ -46,7 +46,9 @@ extension-pkg-whitelist=lxml.etree,greenlet
|
||||
# We are disabling (R)efactor
|
||||
# We are selectively disabling (W)arning
|
||||
# We are not disabling (F)atal, (E)rror
|
||||
disable=C, R
|
||||
# W0212: protected-access
|
||||
# W0613: unused-argument
|
||||
disable=C, R, W0613, W0212
|
||||
|
||||
[REPORTS]
|
||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||
|
@ -42,5 +42,8 @@ systemconfig.helm_plugins.rook_ceph_apps =
|
||||
systemconfig.armada.manifest_ops =
|
||||
rook-ceph-apps = k8sapp_rook.armada.manifest_rook_ceph:RookCephArmadaManifestOperator
|
||||
|
||||
systemconfig.app_lifecycle =
|
||||
rook-ceph-apps = k8sapp_rook.lifecycle.lifecycle_rook_ceph:RookCephAppLifecycleOperator
|
||||
|
||||
[wheel]
|
||||
universal = 1
|
||||
|
@ -56,6 +56,11 @@ commands =
|
||||
exclude = build,dist,tools,.eggs
|
||||
max-line-length=120
|
||||
|
||||
# H series are hacking
|
||||
# H104 file contains only comments (ie: license)
|
||||
# H401 docstring should not start with a space
|
||||
ignore = H104,H401
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
|
@ -93,6 +93,9 @@ spec:
|
||||
- name: platform
|
||||
hostPath:
|
||||
path: /opt/platform
|
||||
- name: buildinfo
|
||||
hostPath:
|
||||
path: /etc/build.info
|
||||
containers:
|
||||
- name: ceph-mon-audit
|
||||
image: {{ .Values.images.tags.ceph_config_helper | quote }}
|
||||
@ -108,4 +111,7 @@ spec:
|
||||
readOnly: true
|
||||
- name: ceph-mon-audit-bin
|
||||
mountPath: /tmp/mount
|
||||
- name: buildinfo
|
||||
mountPath: /etc/build.info
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
|
Loading…
Reference in New Issue
Block a user