These are chat archives for spring-cloud/spring-cloud

4th
Apr 2018
Tommy Ludwig
@shakuzen
Apr 04 2018 03:28
I tried the fix for spring-cloud/spring-cloud-config#942 by trying M9. The issue reported there is fixed, but it looks like some more guards are needed. This time for vault. I'm getting the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'vaultEnvironmentRepositoryFactory' defined in org.springframework.cloud.config.server.config.CompositeRepositoryConfiguration: Unsatisfied dependency expressed through method 'vaultEnvironmentRepositoryFactory' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.servlet.http.HttpServletRequest' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Harun Kotan
@arony
Apr 04 2018 08:06
When I add this class https://gist.github.com/arony/8235b591e53eb55d5d2c5694edb9ecef in a maven spring boot sub-module it works. But when create a starter and add as a dependency in all sub-module it does not work. It alyways throws exception UnknownHostException: "service name". It cannot reolve service name.
I am trying to add OAuth2RestTample for all microservices and I get this exception : Could not fetch user details: class org.springframework.web.client.ResourceAccessException, I/O error on GET request for "http://auth-service/uaa/user": auth-service; nested exception is java.net.UnknownHostException: auth-service
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 08:17
salaboy
@salaboy
Apr 04 2018 08:42
@doernbrackandre hi there
sorry that I missed your message here
so looking at annotations.. makes me think that we will need to have a way to make a difference between labels and annotations
I’ve thought about labels because some of the properties that I was setting were supposed to be used for selecting and filtering
and some of them are not
@doernbrackandre can I ask a little bit more about your use case? are you using only discovery?
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:15
@Salaboy sure. Currently we're about to migrate our API Gateway (zuul, ATM) to openshift
salaboy
@salaboy
Apr 04 2018 09:16
@doernbrackandre does openshift has a gateway in it? (not sure if that was there when I was using openshift before)
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:16
only the HA proxies
salaboy
@salaboy
Apr 04 2018 09:16
or what do they use these days?
oh ok
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:16
our plan for the future is to have something they call "custom proxies"
we will start with zull but this will not be the end of out jurney
we will have a look into spring-cloud-gateway, for sure
and maybe some others as well
salaboy
@salaboy
Apr 04 2018 09:18
@doernbrackandre it seems that we are going down the same route
so I will be more than happy to collaborate
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:18
ya, think so :)
salaboy
@salaboy
Apr 04 2018 09:18
we are also moving away from zuul
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:18
that whould be great
salaboy
@salaboy
Apr 04 2018 09:18
and eureka and config server
for the k8s options
that’s why I’m pushing the 2.x support for spring-cloud-k8s
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:19
ya. for us, we have no need for eureka in openshift/kube anymore
but as I said, we need a APIGW
salaboy
@salaboy
Apr 04 2018 09:19
ok so how do we do it? should we focus on labels/annotations then?
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:20
@Salaboy you said you use metadata/labels for service discovery. Can you give me an example?
salaboy
@salaboy
Apr 04 2018 09:20
@doernbrackandre in k8s I have a set of services using @DiscoveryClient right?
but then I want to add/mutate metadata about these services, so I can then group these services under different categories
and for example.. kill them all together as a logical unit
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:21
I see
salaboy
@salaboy
Apr 04 2018 09:22
and in order to do this.. I need discovery, configMaps and the gateway all working together
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:22
but is this really something you want to do via the spring service discovery/spring stack at all?
I mean killing pods..
salaboy
@salaboy
Apr 04 2018 09:23
@doernbrackandre not really, but if I’m using the k8s apis I want to make sure that my services contains the appropriate labels/metadata to being able to find them and group them
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:23
thats for sure
for us, there is a clear border between labels and annotations
salaboy
@salaboy
Apr 04 2018 09:24
@doernbrackandre I have a service that will use the discoveryClient to compose larger logical units
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:24
okay..
salaboy
@salaboy
Apr 04 2018 09:24
@doernbrackandre yeah for us the line is clear as well, but the problem is that from the spring point of view we only have metadata
and it is true that it sounds more like annotations
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:25
anything you need to identify services using the kube API shpould be a label
salaboy
@salaboy
Apr 04 2018 09:25
yeah
so do you only have annotations in your use case when you think about Service Instance metadata?
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:25
metadata is something to use if you need to transport additional information
in case of metadata, ya.
annotations fully fits the image here for us
salaboy
@salaboy
Apr 04 2018 09:27
ok.. that make sense to me
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:27
great :)
salaboy
@salaboy
Apr 04 2018 09:27
@doernbrackandre so if we can add annotations in there I’m totally ok with that, I just need to think about how to set up labels if we need them
and where is the abstraction from the spring cloud perspective
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:28
ya, just switch from service.get().getMetadata().getLabels() to service.get().getMetadata().getAnnotations()
what do you by this?
salaboy
@salaboy
Apr 04 2018 09:31
@doernbrackandre yeah.. but that’s to consume stuff only.. the problem is for setting that up from the spring cloud abstraction
but it is fine, if that solves some of your current problems that change is ok from my perspective
do you want to send a PR for that change?.. I will add comments to support the change
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:32
sure, gimme a sec
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:37
@Salaboy here you go: spring-cloud-incubator/spring-cloud-kubernetes#166
salaboy
@salaboy
Apr 04 2018 09:40
@doernbrackandre comments added
salaboy
@salaboy
Apr 04 2018 09:47
@doernbrackandre :+1: I’m looking forward to understand a little bit more about your new gateway approach
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 09:56
@Salaboy actually, it is quite simple. just replace eureka with the kube API :D
there are some issues within the zuul-eureka-approch in generell and we are looking forward to get rid of them once we migrated to openshift
our first tests with the new setup are promising
Abhishek Dujari
@abshkd
Apr 04 2018 10:44
i remember that @joshlong talk haad refreshscope that could refresh every 60 seconds automatically. I might be remembering this wrong. Is it possible to set an autorefresh so to speak? calling the /refresh endpoint is not useful when you have multiple instances
Abhishek Dujari
@abshkd
Apr 04 2018 10:52
what if we can use refreshscope and then invalidate the cache using @Scheduled for that bean with refresh(freshCoffeeBean)
will it work?
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 11:04
@Salaboy ready to discuss the next issue? :)
Andre Dörnbrack
@doernbrackandre
Apr 04 2018 13:25
@Salaboy one last question - at least for today :D if you think about service discovery, based on labels.. let's say, something like a stage label. how/where would you implement this?
is it something you would implement in the discovery client or is it more service layer based? (if this makes sense)
ulmermark
@ulmermark
Apr 04 2018 14:07

I may be in a chicken and egg situation but was wondering if someone may know the answer... I have a class that uses

@Configuration @ConfigurationProperties(prefix = "dil-common-auth.jwtParams") @Validated public class JwtConfig {

which is used in a class

@EnableWebSecurity public class SpringSecurityConfigurer extends WebSecurityConfigurerAdapter {

the properties in dil-common-auth.jwtParams are defined in the Zuul application that connects to a Spring Cloud Config Service where I am using "Discovery" by the serviceId of the Config Service

It appears the Zuul app and WebSecurityConfigurerAdapter class doesn't wait for the config server to be discovered and configuration extracted from the config server and therefore the app fails to start because a property marked @NotBlank is never retreived from the config server.

Is there a way via @Ordered or some other mechanism to delay the WebSecurityConfigurerAdapter from executing until the Config Server is discovered?? Thanks

Knut Schleßelmann
@kschlesselmann
Apr 04 2018 14:08
Currently I'm trying to return values from a local cache if a remote service call fails. I thought about using hystrix + spring cache for that … would this be a good approach? If so, how can I froward parameters to the @HystrixCommand(fallbackMethod = "defaultFallback")?
ulmermark
@ulmermark
Apr 04 2018 15:57
Answered my own question..closer review of the spring.cloud.config properties showed I did not have it enabled and therefore wasn't waiting for the connection to the Config Server....I must of lost some properties in a Git merge
Thiago Locatelli
@thiagolocatelli
Apr 04 2018 16:16
Hello everyone, does anyone know if my answer provided in https://stackoverflow.com/questions/48520197/spring-cloud-gateway-how-to-create-a-filter is a valid answer for PRE/POST filters in Spring Cloud Gateway?
Thiago Locatelli
@thiagolocatelli
Apr 04 2018 17:44
@spencergibb Thank you a lot, Spencer!
jprateekvmware
@jprateekvmware
Apr 04 2018 20:33
@all i have strange issue where the service is registering with the both container ip and host ip
can someone help me what i could be doing wrong
Marcos Barbero
@marcosbarbero
Apr 04 2018 20:34
can you share your config?
Spencer Gibb
@spencergibb
Apr 04 2018 20:51
@jprateekvmware sounds odd. Eureka can register a host and ip address, by default it picks the host