nais / naisd

nais deployment daemon
https://nais.io
MIT License
27 stars 10 forks source link

Create additional ingresses #46

Closed jhrv closed 6 years ago

jhrv commented 6 years ago

If application has a LoadbalancerConfig resource in Fasit, we create automatically create an additional ingress matching either host or path.

audunstrand commented 6 years ago

I think this should be a separate config in nais.yaml. Thus if you want another ingress, it shoul be possible to add the ingress to nais.yaml. I want to avoid keeping fasit as the central configuration repository.

jhrv commented 6 years ago

The values for the different ingresses are different in each environment. Also, all current applications has this configuration so in theory this should work automatically when migrating applications.

gtcno commented 6 years ago

Proposal:
Extend nais.yaml with ingress: (Optional)

naisd will then create additional ingresses based upon the given ingress and environment in the POST call.

If environment=p then the ingress will be app.adeo.no/presys, if environment=q0 then the ingress will be app-q0.adeo.no/presys and so on.

We avoid calling FASIT this way.

davidsteinsland commented 6 years ago

Can we choose between context path or hostname routing? Either app.adeo.no/<app> or <app>.adeo.no? In either case, I don't think we should have host in nais.yaml, @gtcno. The app should not need to know this. Secondly, why should the environment name be added to the URL? Wouldn't it make more sense to use the cluster name + namespace for this?

gtcno commented 6 years ago

You can have as many ingresses as you want as long as the combination of hostname and path uniquely identifies a service(set of pods). Traefik watches the ingress resources and uses the rules to route/lb incoming traffic to the correct pods. For now we create a default ingress: app.domain (presys.nais.adeo.no in p for instance) and have DNS wildcards that will route traffic to the proper Traefik instances. So the app does not need to know.

However to help apps migrating from legacy to nais we need ingresses matching the LoadBalancerConfig in FASIT. I think I will stick to original plan then where an app can define a fasit resource of type loadbalancerconfig and we will create ingresses based upon the fasit resource in addition to the default ingress.