feat: support for service being defined in routerPattern #2953
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
See #2666 for background on this issue.
Documentation notes
We don't have any documentation describing what
routerPatterns
are, or how they are used/defined.routerPatterns
are quite an important feature on kubernetes based deployments as they are required to be defined. Where in old openshift deployments they were optional.Router patterns are used when creating the autogenerated routes that some services (nginx, node, varnish, python) have, if they have been enabled (which is the default)
The idea with the router patterns is that it defines how autogenerated routes domains are created. Typically router patterns are defined on the deployment target (kubernetes or openshift) object in the API, but a previous version of Lagoon introduced router pattern overrides at the project level.
For example, in previous version of lagoon, router patterns will typically be defined like this
The values within the router pattern that are
${environment}
and${project}
are substituted for their respective Lagoon values. So you could end up with an autogenerated route for an nginx service that looks like thisnginx.main.example-project.lagoon.example.com
This could be limiting for some users, even with being able to adjust the router pattern down to something like this, with dashes as the separator.
The resulting domain would be
nginx.main-example-project.lagoon.example.com
, which also may be limiting for users.What this pull request does is allow a new substitution to be added to the router patterns for services,
${service}
. This now means you can define the router pattern like thisWhich will leave you with the domain
nginx-main-example-project.lagoon.example.com
Closing issues
closes #2666