Open DanielLiu1123 opened 1 year ago
It looks good! But we need to discuss which main branch of 2.2.x/2021.x/2022.x that will support the ability.
I think it is possible to support both 2021.x and 2022.x branches.
This module has the same purpose as Spring Cloud Kubernetes Config
, to provide Kubernetes ConfigMap/Secret as a remote configuration with the ability to be dynamically refreshed.
But one major difference is that Spring Cloud Kubernetes Config
relies on the spring-cloud-starter-bootstrap
implementation for its configurations. So the configurations need to be placed in bootstrap.yml
or by using import: spring.config.import=kubernetes:config
.
Both of these approaches have some limitations.
For way one:
spring-cloud-starter-bootstrap
, the performance of refresh is not good. It will introduce parent-child context, increasing the use and understanding cost.For way two:
What problems are solved by Spring Cloud Alibaba Kubernetes Config module?
spring-cloud-starter-bootstrap
, all configurations are placed in application.yml
, there is no parent-child context, which is more convenient for debugging and understanding.PropertySource
and added to the environment, so this approach should have theoretical best performance for the refresh phase.Configurations when using Spring Cloud Kubernetes Config
and Spring Cloud Alibaba Kubernetes Config
:
Spring Cloud Kubernetes Config
spring:
cloud:
kubernetes:
reload:
enabled: true
monitoring-config-maps: true
monitoring-secrets: true
config:
sources:
- name: configmap-01
namespace: default
secrets:
sources:
- name: secret-01
namespace: default
Spring Cloud Alibaba Kubernetes Config
spring:
cloud:
k8s:
config:
config-maps:
- name: configmap-01
namespace: default
refreshable: true
secrets:
- name: secret-01
namespace: default
refreshable: true
@DanielLiu1123
Why Spring Cloud Alibaba Kubernetes Config
using spring.cloud.k8s.config
instead of using spring.cloud.kubernetes.config
, it may be a better choice to keep the configuration properties of similar functional modules consistent.
Why
Spring Cloud Alibaba Kubernetes Config
usingspring.cloud.k8s.config
instead of usingspring.cloud.kubernetes.config
.
This is tricky one, it conflicts with Spring Cloud Kubernetes
if we use spring.cloud.kubernetes.config
.
spring.cloud.alibaba-kubernetes.config
might also be an option?
I think spring.cloud.alibaba.kubernetes.config is a good choice
All of the modules don't have alibaba
in the prefix, such as spring.cloud.nacos
, spring.cloud.sentinel
, if the prefix contains alibaba
from the beginning, it's a good choice.
I think both spring.cloud.alibaba-kubernetes
and spring.cloud.alibaba.kubernetes
are acceptable.
I think spring.cloud.alibaba.kubernetes.config is a good choice
All of the modules don't have
alibaba
in the prefix, such asspring.cloud.nacos
,spring.cloud.sentinel
, if the prefix containsalibaba
from the beginning, it's a good choice.I think both
spring.cloud.alibaba-kubernetes
andspring.cloud.alibaba.kubernetes
are acceptable.
I suggest using spring.cloud.alibaba-kubernetes
, alibaba-kubernetes
is component name. It will be same as before.
Background
Kubernetes has become synonymous with cloud-native, and building applications based on Kubernetes can help us reduce maintenance costs and software complexity, so imagine if Kubernetes could be integrated into the Spring ecosystem, which I'm sure could solve any problem you're facing.
Kubernetes provides Configmap and Secret to manage configuration, Spring Cloud provides the ability to dynamically refresh at runtime, and the combination of the two makes for a "cloud-native configuration center" with native-supported RBAC, so you don't need Nacos (config) / Apollo anymore.
Goals