spring-cloud / spring-cloud-vault

Configuration Integration with HashiCorp Vault
http://cloud.spring.io/spring-cloud-vault/
Apache License 2.0
273 stars 152 forks source link

Add support for DiscoveryClient when using ConfigData and AutoConfiguration-based activation #487

Open mp911de opened 3 years ago

mp911de commented 3 years ago

We should detect whether a DiscoveryClient is available so we can configure an appropriate VaultEndpointProvider. We have already support in the boostrap context, but with moving the activation into ConfigData-based activation, we should consider a DiscoveryClient in the ConfigDataLoader and in our auto-configuration.

spencergibb commented 3 years ago

This is also something I need to look into for eureka, consul and zookeeper

mp911de commented 3 years ago

Right now, all infrastructure beans are registered in config location resolvers/loaders. Would it make sense to have another type of hook that moves infrastructure bean registration into a dedicated place? Something, that is guaranteed to be activated only once if a configdata resolver instance returns at least one location? Or before the config loader gets activated?

spencergibb commented 3 years ago

There is another hook. I can write a DiscoveryClientBootstrapper in spring-cloud-commons (via spring.factories) that puts a DiscoveryClient in the bootstrap context.

spencergibb commented 3 years ago

Sorry, not in commons, but in each individual discovery client project. See https://github.com/spring-cloud/spring-cloud-consul/blob/master/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/configclient/ConsulDiscoveryClientConfigServiceBootstrapConfiguration.java for an example