SCS Configuration Help Needed

未关闭
#108 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
15/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
java, kubernetes, spring-boot
领域
backend

调研方向

Start with the environment post-processor ordering the reporter compared: BindingSpecificEnvironmentPostProcessor.ORDER versus ConfigDataEnvironmentPostProcessor.ORDER, and the log line 'Creating binding-specific PropertySource from Kubernetes Service Bindings'. Reproduce the startup sequence where the config server fetch at localhost:8888 runs before bindings load. Done means bindings are applied before the config server lookup, confirmed by the startup log order and a test.

由索引模型根据 Issue 内容生成。

描述

Hi,

We are experiencing problem integrating scs by using spring-cloud-bindings. Whatever we have tried, we could not bind scs to our app.

We have the below argument set to true on bootstrap.yml

org:
  springframework:
    cloud:
      bindings:
        boot:
          enable: true

We have added the below dependency to pom.xml

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

We provided the necessary scs configuration parameters to the pod via a servicebinding secret, and we can see they are mounted to spring bindings root inside the container.

When we start the application, scs is being processed before cloud bindings processor. It is trying to connect config server over localhost:8888 and fails, then bindings are being processed and application is starting. We can inspect the properties after application has started successfully by checking actuator/configprops, all binding properties are being displayed correctly, however the app is not integrated with config server.

Our spring boot version is 2.7, spring cloud version is 2021.0.6 and cloud-bindings version is 1.14.0.

Startup logs are as follows.

:: Spring Boot ::               (v2.7.11)

2024-01-26 09:50:41.343
             INFO  [main:getRemoteEnvironment] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator : **Fetching config from server at : http://localhost:8888/**
2024-01-26 09:50:41.545
             INFO  [main:getRemoteEnvironment] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://localhost:8888/. Will be trying the next url if available
2024-01-26 09:50:41.545
             WARN  [main:locate] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/DEVOPS.APPS.devops-pas-sandbox1/default": Connection refused; nested exception is java.net.ConnectException: Connection refused
2024-01-26 09:50:41.547
             INFO  [main:logStartupProfileInfo] org.springframework.boot.SpringApplication : No active profile set, falling back to 1 default profile: "default"
2024-01-26 09:50:41.558
             INFO  [main:logTo] org.springframework.boot.logging.DeferredLog : **Creating binding-specific PropertySource from Kubernetes Service Bindings**
2024-01-26 09:50:43.467
             INFO  [main:setSerializationId] org.springframework.cloud.context.scope.GenericScope : BeanFactory id=404a518b-3bec-3cba-b9b1-c91c9daa50e9
2024-01-26 09:50:44.456
             INFO  [main:initialize] org.springframework.boot.web.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)

As per the logs, bindings are being processed after config server property fetching has finished, so we thought there is a problem with beanprocessing orderings, we checked the code, and compared the ordering values between ConfigDataEnvironmentPostProcessor.ORDER and BindingSpecificEnvironmentPostProcessor.ORDER and found that the latter is "ConfigDataEnvironmentPostProcessor.ORDER - 1;" so it should be processed with a higher precedence. However the logs shown above behaves like vice versa.

主要语言
Java
星标
50
派生
33
平均合并
6 天 2 小时
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

spring-cloud/spring-cloud-bindings 的其他 Issue

查看 spring-cloud/spring-cloud-bindings 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。