Skip to content
This repository has been archived by the owner on Dec 4, 2017. It is now read-only.

Add a way for S2I templates to obtain Route host names #269

Open
quintesse opened this issue Oct 20, 2017 · 4 comments
Open

Add a way for S2I templates to obtain Route host names #269

quintesse opened this issue Oct 20, 2017 · 4 comments

Comments

@quintesse
Copy link
Contributor

quintesse commented Oct 20, 2017

In templates Route elements can have their host names generated which makes it difficult to refer to those URLs from other templates. It would be nice to have a way to refer to the generated host names of previously applied Route objects. (It will be impossible to do from within the same template)

First we need to make sure that templates are applied in some known order, preferably resource.yaml, service.yaml and finally application.yaml. That way an application template can refer to a Route in a service template for example. (Done fc5bd3d)

And then we either:

  • Create "magic" template parameters that have special names like ROUTE_HOST_XXX_YYY which would then get their value set to the host name of the Route named xxx-yyy. Or we
  • Create a special element named fabric8-value which can be added to template parameters and which would hold a default value to be used in case that no value was explicitly set for the parameter. The value would be a string that can contain special variables like {{route/xxx-yyy[.spec.host]}} that would look up the Route named xxx-yyy and return its host.

The first option is the easiest but has the disadvantage of not giving us full flexibility. Often we want the template parameter to be an entire URL, not just a host name.

@quintesse
Copy link
Contributor Author

The first option is implemented here: 11e68d8
And the second here: f1d9007

I rather like the second one to be honest even though the code is somewhat more complex.

@Ladicek
Copy link

Ladicek commented Oct 23, 2017

I like the 2nd option too. Do you have an example of how the application.yml file would use this mechanism?

@quintesse
Copy link
Contributor Author

I've got this working already (#270) so yes you can see it here: https://github.com/quintesse/wfswarm-rest-http-secured/blob/testing-s2i/app/.openshiftio/application.yaml#L33

@Ladicek
Copy link

Ladicek commented Oct 23, 2017

Wow, that's so cool! Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants