foundation-service升级到0.17不能获取到配置文件

2019-06-10 12:40:11.973 INFO 8 — [ XNIO-3 task-27] i.c.c.s.impl.DbEnvironmentRepository : foundation-service 获取配置
2019-06-10 12:40:11.995 INFO 8 — [ XNIO-3 task-27] i.c.config.service.PullConfigService : error.pullConfig serviceName foundation-service configVersion null
2019-06-10 12:40:11.999 ERROR 8 — [ XNIO-3 task-27] io.undertow.request : UT005023: Exception handling request to /foundation-service/default

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is io.choerodon.core.exception.CommonException: error.pullConfig serviceName foundation-service configVersion null
at

  • 原因分析:

    配置文件找不到

  • 疑问:

    这个配置文件如何添加

您好,执行helm get values foundation-service看下配置,是不是preConfig没执行。

[root@node1 ~]# helm get values foundation-service
env:
open:
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://register-server:8000/eureka/
SPRING_CLOUD_CONFIG_ENABLED: true
SPRING_CLOUD_CONFIG_URI: http://config-server:8010/
SPRING_DATASOURCE_PASSWORD: password
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/foundation_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true
SPRING_DATASOURCE_USERNAME: choerodon
preJob:
preConfig:
datasource:
password: password
url: jdbc:mysql://mysql:3306/manager_service?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: choerodon
preInitDB:
datasource:
password: password
url: jdbc:mysql://mysql:3306/foundation_service?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: choerodon
image

不明白这些都初始化了,但是就是不能通过config服务获取

那执行下kubectl get cm看configMap有没有生成。

[root@node1 ~]# kubectl get cm foundation-service -n c7n-system -o yaml
apiVersion: v1
data:
application.yml: |
# application.yml
spring:
datasource:
url: jdbc:mysql://localhost:3306/foundation_service?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: choerodon
password: 123456
cloud:
bus:
enabled: true
choerodon:
devops:
message: true
saga:
consumer:
enabled: true # 是否启用消费端
thread-num: 5 # 消费线程数
max-poll-size: 200 # 每次拉取的最大消息数量
poll-interval-ms: 1000 # 拉取消息的间隔(毫秒),默认1000毫秒
eureka:
instance:
preferIpAddress: true
leaseRenewalIntervalInSeconds: 10
leaseExpirationDurationInSeconds: 30
metadata-map:
VERSION: v1
client:
serviceUrl:
defaultZone: http://localhost:8000/eureka/
registryFetchIntervalSeconds: 10
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 15000
mybatis:
mapperLocations: classpath*:/mapper/*.xml
configuration: # 数据库下划线转驼峰配置
mapUnderscoreToCamelCase: true
ribbon:
ReadTimeout: 30000
ConnectTimeout: 30000
kind: ConfigMap
metadata:
annotations:
choerodon.io/feature: spring-cloud-config
choerodon.io/service: foundation-service
choerodon.io/version: 0.16.0
creationTimestamp: 2019-06-06T06:55:32Z
name: foundation-service
namespace: c7n-system
resourceVersion: “7469630”
selfLink: /api/v1/namespaces/c7n-system/configmaps/foundation-service
uid: 13d0f7f9-8828-11e9-8975-005056b007b5


这个是执行命令出来的结果

0.15.0之后添加的服务workflow-service、foundation-service和knowledgebase-service在mgmt_service_config表中都有数据

您这边SPRING_CLOUD_CONFIG_URI 配置的应该是register-server。