It would be nice if it was possible in template to expand to the default routingConfig.Subdomain to make it easier to share complete templates for template authors.
if we have a template like this :
apiVersion: v1
kind: Route
metadata:
labels:
name: hello-openshift
name: hello-openshift-route
spec:
host: hello.${defaultSubdomain}
tls:
termination: edge
to:
name: hello-openshift-service
the defaultSubdomain will be expanded to what is configured in routingConfig.subdomain (or the default which is currently router.default.local)
I am not sure if we can have a 'reserved' keyword to not have conflict if there is a variable actually named like that, or have something like openshift.RoutingConfig.subDomain for openshift reserved variables.
You shouldn't need to specify host - just give the route the name "hello" and you'll get placed in the default subdomain.
In the future, there will be multiple routers, and it won't be 1-1 - users in a template should in general be using routes by their primary name, not specifying hosts (since only one can be unique).
okay thanks so I haven't looked at the code but does that mean if there is . (dot) in the host then it would append the default domain ?
If you set the host to empty, when you create the route it becomes
`
get that behavior.
On Wed, Jul 29, 2015 at 6:19 AM, Chmouel Boudjnah [email protected]
wrote:
okay thanks so I haven't looked at the code but does that mean if there is
. (dot) in the host then it would append the default domain ?—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/issues/3910#issuecomment-125912379.
Clayton Coleman | Lead Engineer, OpenShift
you should only be using the default domain with generated host names... to do that, leave the host field empty and a host will be generated for you using the route's name and namespace, and the default cluster DNS suffix.
But that's the default local not the external one like ${defaultSubdomain} isn't it ?
It is whatever the admin configures
On Aug 4, 2015, at 9:43 AM, Chmouel Boudjnah [email protected]
wrote:
But that's the default local not the external one like ${defaultSubdomain}
isn't it ?
—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/issues/3910#issuecomment-127617496.
That's whatever is configured in the master config (defaults to "router.default.svc.cluster.local"):
routingConfig:
subdomain: "..."
perfect, thanks
This seems to work OK but the link in the projects does not include the subdomain. [Adding the subdomain takes me to the host.]
How can I make it display properly (with the subdomain)?
I am doing this in the template:
spec:
host: "abcdef-${SOME_NAME}-${SOME_INSTANCE}"
to:
kind: "Service"
name: "${APPLICATION_NAME}-${SOME_NAME}-${SOME_INSTANCE}"
If you set the host, you don't get any defaulting or suffixing. If you want a generated host, leave it empty.
Yes, that's correct. I want a very specific host and it is working as desired but not displayed as desired.
Can you clarify what you mean by "the link in the projects does not include the subdomain"?
Can you include the output of oc get route <name> -o json and describe what you are expecting?
Service is currently available as desired here: http://ipoc-rs-vaeb-test.origin.cad.ao.dcn/
In the project, the route (link) is displayed as ipoc-rs-vaeb-test (and it does not work)
I am expecting it to be displayed as ipoc-rs-vaeb-test.origin.cad.ao.dcn
Therefore, I say the "subdomain" is not included (based on the discussion language above).
This is the requested output:
{
"kind": "Route",
"apiVersion": "v1",
"metadata": {
"name": "ipoc-rs-vaeb-test",
"namespace": "ipoc-rs-vaeb-test",
"selfLink": "/oapi/v1/namespaces/ipoc-rs-vaeb-test/routes/ipoc-rs-vaeb-test",
"uid": "12174747-9fb5-11e5-a56c-0800279e02d7",
"resourceVersion": "1512641",
"creationTimestamp": "2015-12-11T03:12:54Z",
"labels": {
"application": "ipoc-rs",
"createdBy": "template-ipoc"
}
},
"spec": {
"host": "ipoc-rs-vaeb-test",
"to": {
"kind": "Service",
"name": "ipoc-rs-vaeb-test"
}
},
"status": {}
}
If you leave spec.host empty, what happens? When you specify a host, you are responsible for the entire fully qualified hostname.
If I leave it empty, it works but that's not the desired use case. This application (and others like it) will have multiple instances which need to have a specific name derived from two other variables. I can provide the rest of the hostname but I want to do so via another variable (because we have multiple OpenShift instances).
any updates on this?
Also, for the use case where the FQDN needs to be supplied to the application (for virtual host config purposes), there needs to be a way to supply the generated FQDN as a parameter to the DeploymentConfig for the application.
Still amazes me that this was closed.
Most helpful comment
Also, for the use case where the FQDN needs to be supplied to the application (for virtual host config purposes), there needs to be a way to supply the generated FQDN as a parameter to the DeploymentConfig for the application.