spring-cloud-alibaba icon indicating copy to clipboard operation
spring-cloud-alibaba copied to clipboard

spring-cloud-xds-adapter module function decoupling

Open ruansheng8 opened this issue 1 year ago • 4 comments

相关组件

spring-cloud-starter-xds-adapter (2.2.x)

功能描述

从模块的命名来看, 希望这个模块具备通用的xDS协议适配能力。

需求场景

例如用户扩展了spring-cloud-starter-alibaba-governance-routing模块中的路由配置或者有自己的相关实现,希望通过spring-cloud-starter-xds-adapter这个通用的协议适配器来转换自己的个性化配置。

调整方案

方案一:

See XdsAutoConfiguration.java,增加相关Bean覆盖或生效策略来满足用户自定义配置转换的需求。

	@Bean
	public XdsResolveFilter<List<Listener>> authXdsResolveFilter() {
		return new AuthXdsResolveFilter();
	}

	@Bean
	public XdsResolveFilter<List<RouteConfiguration>> routingXdsResolveFilter() {
		return new RoutingXdsResolveFilter();
	}

方案二:

将各个功能模块的配置转换逻辑移到具体的实现模块中。 例如将RoutingXdsResolveFilter 移到 spring-cloud-starter-alibaba-governance-routing 模块中, 然后在该模块以optional方式依赖spring-cloud-starter-xds-adapter

        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-xds-adapter</artifactId>
            <optional>true</optional>
        </dependency>

ruansheng8 avatar Mar 31 '23 08:03 ruansheng8

感觉可以考虑把这些个filter加个@ConditionOnMissingBean注解,这样用户定义了他自己的filter以后执行的filter链就直接按照用户自定义的来。 image

123liuziming avatar Mar 31 '23 09:03 123liuziming

@123liuziming 方案二有个好处是可以按需加载Bean, 未来服务治理模块将会持续增加其他相关功能, 转换器数量会越来越多, 根据用户自身依赖的模块按需加载具体功能的转换器可能是一个比较好的选择

ruansheng8 avatar Mar 31 '23 09:03 ruansheng8

放到各治理模块里面有一个问题,这样每个治理模块都要去依赖Envoy-xds的那些三方包了,我感觉Envoy-xds的那些依赖可能还是收敛在xds-adapter里面比较好,具体的实现模块因为可能要和多种控制平面打交道,所以最好是不要感知到Envoy-xds这些三方包

123liuziming avatar Mar 31 '23 11:03 123liuziming

放到各治理模块里面有一个问题,这样每个治理模块都要去依赖Envoy-xds的那些三方包了,我感觉Envoy-xds的那些依赖可能还是收敛在xds-adapter里面比较好,具体的实现模块因为可能要和多种控制平面打交道,所以最好是不要感知到Envoy-xds这些三方包

赞同

ruansheng8 avatar Mar 31 '23 11:03 ruansheng8

This issue has been open 30 days with no activity. This will be closed in 7 days.

github-actions[bot] avatar Mar 08 '24 18:03 github-actions[bot]

This issue has been automatically marked as stale because it hasn't had any recent activity.If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Sping Cloud Alibaba Community.

github-actions[bot] avatar Mar 16 '24 18:03 github-actions[bot]