Spring cloud config

2019-10-16  本文已影响0人  jaymz明

ref: https://spring.io/projects/spring-cloud-config


<dependency>    
<groupId>org.springframework.cloud</groupId>    
<artifactId>spring-cloud-config-server</artifactId></dependency><dependency>    
<groupId>org.springframework.cloud</groupId>    
<artifactId>spring-cloud-starter-config</artifactId></dependency>

在resources目录下面配置需要的信息。(application-jenkins-dev.yml)

# jenkins configjenkins:  
config:    
  proxy: xxx.xxx.xxx
  url: jaymz.jenkins.com
# tool
custom:
  tool:
    name:
      maven:
         version: maven-3.3.9
         url: xxx.xxx.xxx
      IA:
        version: InstallAnywhere_2018
        url: xxx.xxx.xxx
     JDK:
        version: openjdk-8u171
        url: xxx.xxx.xxx

然后我们启动springboot,访问:
http://localhost:8888/spring-config-demo/jenkins-dev,如下图所示:

image.png

为了让结果readable,我们用shell:
curl -k url |jq .
如下

image.png

配置中心的雏形出来了。下面就是整合散落在各个地方的config(application,infra等)。
未来还需要take actions:

  1. 整合需要移到配置中心的config(并翻译成yml)
  2. config server长活(加入到k8s中)
  3. 修改需要获取配置的代码
  4. 针对特殊场景(一旦code freeze,需要将配置中心的关于pipeline的代码作相应的更改,否则定时的job不受code freeze的规则约束)
上一篇 下一篇

猜你喜欢

热点阅读