How can we configure exposecontroller's urltemplate for previews specifically? We’re using a . separator for services in staging/prod (that is OK), but we would really need to use a - separator for preview environments, but cannot figure out how.
For example, this is what we have currently:
http://hello-world.jx-myorg-hello-world-pr-3.mycluster.myorg.com
And this is what we would need:
http://hello-world-jx-myorg-hello-world-pr-3.mycluster.myorg.com
NOTE: That is a big deal for us, because the . separator means that for every new preview a new DNS record must be created and propagated, and a new TLS cert be provisioned, and all that takes so long that the pipeline eventually times out waiting for ingress to become accessible and fails.
For staging+prod, our urltemplate in the exposecontroller ConfigMap is {{.Service}}.{{.Namespace}}.{{.Domain}} and that is fine. However, in the previews’ exposecontroller ConfigMaps, we see no urltemplate property, so we have not a clue how it works for previews.
{{.Service}}.{{.Namespace}}.{{.Domain}} urltemplate.Use a - separator between service name and namespace in preview url:
http://hello-world-jx-myorg-hello-world-pr-3.mycluster.myorg.com
It defaults to a . separator, with no obvious way to override it:
http://hello-world.jx-myorg-hello-world-pr-3.mycluster.myorg.com
NAME VERSION
jx 2.0.1192+cjxd.7
Kubernetes cluster v1.14.9-eks-502bfb
kubectl v1.16.0
helm client Client: v2.14.3+g0e7f3b6
git 2.17.1
Operating System Ubuntu 18.04.4 LTS
AWS/EKS
eksctl create cluster
--name $CLUSTER
--version 1.14
--region $ZONE
--nodegroup-name standard-workers
--node-type t3.medium
--nodes 3
--nodes-min 3
--nodes-max 3
--managed
You could try adding
urltemplate: "{{.Service}}-{{.Namespace}}.{{.Domain}}"
to the exposecontroller configmap in the preview environment, example here https://github.com/jenkins-x-labs/slack/blob/00f61a117c11d06ee23478439fd7b1dff9e37a2a/charts/preview/values.yaml#L6
This in the preview values.yaml:
urltemplate: "{{.Service}}-{{.Namespace}}.{{.Domain}}"
... gets rendered to this in the exposecontroller ConfigMap:
urltemplate: {{.Service}}-{{.Namespace}}.{{.Domain}}
So the braces are interpreted as a yaml object and exposecontroller fails to load and parse its config.
Any advice @rawlingsj on how to prevent the string from getting unquoted?
This might be of help: https://github.com/jenkins-x/jx/issues/6648#issuecomment-597644456, the workaround is for a similar issue for a permanent environment.
Note how he had to use single quotes to interpolate to a valid value.
OK, really seems to me like a bug, but I found a hacky workaround, just escaping an extra pair of double-quotes:
urltemplate: "\"{{.Service}}-{{.Namespace}}.{{.Domain}}\""
But at least that works! :)
Thanks @rawlingsj !
Just for the records, that customization of urltemplate was necessary in order to speed up the availability of preview environments and prevent the pipeline from timing out, as I described here https://github.com/jenkins-x/jx/issues/6972
Keeping open as a bug
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://jenkins-x.io/community.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Provide feedback via https://jenkins-x.io/community.
/lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Provide feedback via https://jenkins-x.io/community.
/close
@jenkins-x-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue with/reopen.
Mark the issue as fresh with/remove-lifecycle rotten.
Provide feedback via https://jenkins-x.io/community.
/close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the jenkins-x/lighthouse repository.