-
Notifications
You must be signed in to change notification settings - Fork 51
Osiris tries to activate already active service #63
Comments
Oh I think I got it - it is single service to single hostname mapping. |
And if I try to use internal host names like |
So I guess the question is - is it possible to get Osiris to work with ClusterIP services using internal DNS names? |
While internal hostnames are indexed osiris/pkg/deployments/activator/index.go Line 103 in 2bf13af
|
As you've discovered by now, the activator has a map where the keys are all the different hostnames (DNS) and IPs by which a service might be addressed to values that are corresponding deployments. Have a look at all the config options that are covered in the README. There are a few different annotations that let you explicitly add hostnames to the map that the activator cannot infer on its own. |
Thanks for getting back to me. I went through all the options 10 times and read half of the source code :). It seems that my problem is that Osiris is not using external hostname when looking up for services in the index: Say the website is In the logs I see only
It does not try to look up a service for |
Can you please point out a place where a hostname of a service for a processed request is set? |
I think there's a layer of indirection in your example that needs to be explained to me in order for me to help you effectively. You seem to be using some router component to direct traffic. What is Osiris-enabled here? The router or the target? And what is the original request you are making? |
So the request flows is:
Osiris logs requests associated with This is the annotation I use on
This is the annotation on
|
That's a complex bit of indirection... out of curiosity why have a "router" behind an ingress controller? Ostensibly, an ingress controller is a router of sorts. Anyway... let's take the router out of the equation for a moment-- just for the sake of simplifying what I'm about to say-- fewer hops is easier to understand, right? So pretend you have just your ingress controller and then your permissions service. Any request to app.example.com still looks like a request for app.example.com when it hits the activator. i.e. The host header still says app.example.com. That isn't changed in the request's traversal of the ingress controller. So... the request hits the activator looking like a request for app.example.com, but per the configuration you posted, that is not a hostname that the activator would know anything about. How would it? It seems here that you have perhaps misused the ingressHostname annotation, as you have given it a value that you should not need to give it-- a value that the activator can infer all on its own should be mapped to the permissions deployment. If, however, you use that annotation to tell the activator about app.example.com, you'd be adding new information to the activator that would help it match the request with the app.example.com host header. Now... as for why this flow isn't totally erroring and seems, from what I see in the logs you posted, to be making an earnest attempt to activate, that seems as if it could possibly be a bug. Definitely, the activator shouldn't attempt to do an activation for some deployment it cannot identify and if that is happening, it's a mistake. I'd have to dig into the code more to see if that's actually going on. There's one other thing lurking in here... I suspect that you are doing (or intend to do) some path-pased routing. e.g. routing not only on hostname, but also on paths. Is that so? This is not supported (yet?) so that might also be some kind of factor here. |
We use router behind ingress as there is a dozen of microservices with complex routing rules: path based, HTTP methods, feature flags, etc. Router handles it. Also these microservices make calls to each other as part of processing the original request passed by ingress. These calls also go via the router. So yes, we do have path based routing, however as it is used by a router to resolve path to an internal hostname like I'm still not sure how the activator works:
Does activator only listen to the requests coming from outside of the cluster? This would explain why it does not mention any requests to the services which are only available internally. |
If things are configured properly, any Osiris-enabled service that has no endpoints in service (i.e. is scaled to zero) gets activator endpoints automatically added. So any traffic that follows through such a service, regardless of where it came from or how it got there, will like it to the activator. The main question really is one of whether the activator will know what you do with the request and that's going to end up being a matter if 1. configuration and 2. what the host header (or SNI) says. |
Bug:
Activator works and scales up the deployment however it looks like Osiris does not register the fact that the deployment is now running and keeps attempting to scale up.
This is what is logged by activator for each request:
The text was updated successfully, but these errors were encountered: