From 4678b76d44f36d897572e13b9661eadbc5d46cad Mon Sep 17 00:00:00 2001 From: xiepaup Date: Mon, 30 Oct 2023 14:58:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(redis):=20=E6=95=B4=E6=9C=BA=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E5=85=BC=E5=AE=B9=E5=85=B6=E4=BB=96=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=B1=82#1565?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scene/redis/redis_cluster_scene_cmr.py | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/redis/redis_cluster_scene_cmr.py b/dbm-ui/backend/flow/engine/bamboo/scene/redis/redis_cluster_scene_cmr.py index 695e7f505c..b6e5e39d51 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/redis/redis_cluster_scene_cmr.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/redis/redis_cluster_scene_cmr.py @@ -28,11 +28,13 @@ from backend.flow.engine.bamboo.scene.common.builder import Builder, SubBuilder from backend.flow.engine.bamboo.scene.common.get_file_list import GetFileList from backend.flow.engine.bamboo.scene.redis.atom_jobs import ( + AccessManagerAtomJob, ProxyBatchInstallAtomJob, ProxyUnInstallAtomJob, RedisClusterMasterReplaceJob, RedisClusterSlaveReplaceJob, ) +from backend.flow.plugins.components.collections.common.pause import PauseComponent from backend.flow.plugins.components.collections.redis.dns_manage import RedisDnsManageComponent from backend.flow.plugins.components.collections.redis.get_redis_payload import GetRedisActPayloadComponent from backend.flow.plugins.components.collections.redis.redis_db_meta import RedisDBMetaComponent @@ -320,29 +322,37 @@ def proxy_replacement(self, sub_pipeline, act_kwargs, proxy_replace_info): ) # 第二步:接入层管理:填加新接入层 - dns_kwargs = DnsKwargs( - dns_op_type=DnsOpType.CREATE.value, - add_domain_name=act_kwargs.cluster["immute_domain"], - dns_op_exec_port=int(config_info["port"]), - ) - act_kwargs.exec_ip = new_proxies - sub_pipeline.add_act( - act_name=_("Proxy-注册域名-{}".format(act_kwargs.cluster["immute_domain"])), - act_component_code=RedisDnsManageComponent.code, - kwargs={**asdict(act_kwargs), **asdict(dns_kwargs)}, + sub_pipeline.add_sub_pipeline( + sub_flow=AccessManagerAtomJob( + self.root_id, + self.data, + act_kwargs, + { + "cluster_id": act_kwargs.cluster["cluster_id"], + "port": act_kwargs.cluster["proxy_port"], + "add_ips": new_proxies, + "op_type": DnsOpType.CREATE.value, + }, + ) ) # 第三步:接入层管理:清理旧接入层(这里可能需要留点时间然后在执行下一步) - dns_kwargs = DnsKwargs( - dns_op_type=DnsOpType.RECYCLE_RECORD, - add_domain_name=act_kwargs.cluster["immute_domain"], - dns_op_exec_port=int(config_info["port"]), - ) - act_kwargs.exec_ip = old_proxies - sub_pipeline.add_act( - act_name=_("Proxy-回收域名-{}".format(act_kwargs.cluster["immute_domain"])), - act_component_code=RedisDnsManageComponent.code, - kwargs={**asdict(act_kwargs), **asdict(dns_kwargs)}, + sub_pipeline.add_sub_pipeline( + sub_flow=AccessManagerAtomJob( + self.root_id, + self.data, + act_kwargs, + { + "cluster_id": act_kwargs.cluster["cluster_id"], + "port": act_kwargs.cluster["proxy_port"], + "del_ips": old_proxies, + "op_type": DnsOpType.RECYCLE_RECORD.value, + }, + ) ) + + # 第四步:人工确认 + sub_pipeline.add_act(act_name=_("旧Proxy下架-等待确认"), act_component_code=PauseComponent.code, kwargs={}) + # 第四步:卸载Proxy proxy_down_pipelines = [] for proxy_ip in old_proxies: