hawtio / hawtio-kubernetes

hawtio plugin for working with kubernetes
Apache License 2.0
24 stars 14 forks source link

running a Template should also, if on OpenShift, allow Routes to be created too #32

Closed jstrachan closed 9 years ago

jstrachan commented 9 years ago

So when creating a template, any services created should typically have OpenShift Route's created; using by default a $DOMAIN parameter.

e.g. for service foo we should create a route for foo.$NAMESPACE.$DOMAIN (maybe ommitting $NAMESPACE. if the namespace is default?) so folks can access the service directly.

We could detect an annotation, say, fabric8.service/createRoute = false to disable this on a per service basis in case folks wanted to disable this in their kubernetes.json for a specific service.

So it'd be awesome if creating an OS template, after the usual parameters are shown; we had a checkbox to create Routes and a text field for the default DOMAIN to use. The checkbox should be checked by default and domain could be guessed/remembered (e.g. if there's an existing route maybe)?

To implement it we could just amend the Template to add 2 new parameters with default values?

Then after the template is created; we just check if its checked and create the routes for all services like this Java code: https://github.com/jstrachan/fabric8/blob/cdelivery/fabric8-maven-plugin/src/main/java/io/fabric8/maven/ApplyMojo.java#L222-222

its basically just a blob of json with the host name and service:

{
    "kind": "Route",
    "apiVersion": "v1beta3",
    "metadata": {
        "name": "fabric8"
    },
    "spec": {
        "host": "foo.vagrant.local",
        "to": {
            "kind": "Service",
            "name": "fabric8"
        }
    }
}