Skip to content

Add Maven Profile To Config Server To Include spring-vault-core #1848

@arjavdongaonkar

Description

@arjavdongaonkar

Description:

I am currently using Spring Cloud Kubernetes Config Server (v3.2.0), but I am facing an issue with HashiCorp Vault token renewal. When running the Spring Cloud Config Server normally (v4.2.0), the Vault token renewal activity is automatically triggered. However, with the Spring Cloud Kubernetes Config Server (v3.2.0), the token renewal is not triggered, resulting in the missing X-Config-Token header in requests.

Expected Behavior:

The Vault token renewal should be automatically triggered when using Spring Cloud Kubernetes Config Server, and the X-Config-Token header should be included in the requests.

Environment:

  • Spring Cloud Kubernetes Config Server version: 3.2.0
  • Spring Cloud Config Server version (when working normally): 4.2.0

Investigation:

After further investigation, I discovered that the spring-vault-core dependency must be included in the application's classpath to trigger LifecycleAwareSessionManager (which is responsible for the token renewal process).

On Spring Cloud Config Server (v4.2.0), I see the following log line:
o.s.v.a.LifecycleAwareSessionManager - Scheduling Token renewal

However, this log line is not seen when using Spring Cloud Kubernetes Config Server (v3.2.0), indicating that the token renewal is not being triggered.

logs:

` \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.4.0)

07:16:29.522 [main] INFO  o.s.c.k.c.KubernetesConfigServerApplication - Starting KubernetesConfigServerApplication v3.2.0 using Java 21.0.5 with PID 1 (/usr/src/app/spring-cloud-kubernetes-configserver-3.2.0.jar started by root in /usr/src/app) 
07:16:29.526 [main] INFO  o.s.c.k.c.KubernetesConfigServerApplication - The following 2 profiles are active: "kubernetes", "composite" 
07:16:37.401 [main] INFO  o.s.c.context.scope.GenericScope - BeanFactory id=18b381b0-f077-3064-b6f3-ccc47cc63c6b 
07:16:40.020 [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port 8888 (http) 
07:16:40.112 [main] INFO  o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8888"] 
07:16:40.118 [main] INFO  o.a.catalina.core.StandardService - Starting service [Tomcat] 
07:16:40.119 [main] INFO  o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/10.1.33] 
07:16:40.424 [main] INFO  o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext 
07:16:40.425 [main] INFO  o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 10693 ms 
07:16:43.305 [main] INFO  o.h.validator.internal.util.Version - HV000001: Hibernate Validator 8.0.1.Final 
07:16:51.826 [main] INFO  o.s.b.a.e.web.EndpointLinksResolver - Exposing 16 endpoints beneath base path '/actuator' 
07:16:52.821 [main] INFO  o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8888"] 
07:16:52.911 [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port 8888 (http) with context path '/' 
07:16:53.041 [main] INFO  o.s.c.k.c.KubernetesConfigServerApplication - Started KubernetesConfigServerApplication in 35.837 seconds (process running for 39.806) 
07:16:55.831 [http-nio-8888-exec-1] INFO  o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet' 
07:16:55.833 [http-nio-8888-exec-1] INFO  o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet' 
07:16:55.835 [http-nio-8888-exec-1] INFO  o.s.web.servlet.DispatcherServlet - Completed initialization in 2 ms
07:17:35.174 [http-nio-8888-exec-9] WARN  o.s.c.c.s.e.EnvironmentController - Error getting the Environment with name=communication-service profiles=postgres,rabbitmq,redis,domains,access-keys,s3,kafka,communication-service,secrets label=null includeOrigin=false 
java.lang.IllegalArgumentException: Missing required header in HttpServletRequest: X-Config-Token
`

Can someone help with this issue and provide guidance on how to enable Vault token renewal for Spring Cloud Kubernetes Config Server (v3.2.0)?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions