<p>i'm playing around with knative currently and bootstrapped a simple installation using gloo and glooctl. Everything worked fine out of the box. However, i just asked myself if there is a possibility to change the generated url, where the service is made available at.</p>

<p>I already changed the domain, but i want to know if i could select a domain name without containing the namespace, so <code>helloworld-go.namespace.mydomain.com</code> would become <code>helloworld-go.mydomain.com</code>.</p>

<p>The current YAML-definition looks like this:</p>

<pre><code>apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  labels:
  name: helloworld-go
  namespace: default
spec:
  template:
    spec:
      containers:
      - image: gcr.io/knative-samples/helloworld-go
        env:
        - name: TARGET
          value: Go Sample v1
</code></pre>

<p>Thank you for your help!</p>

alexzimmer96
<p>This is configurable via the <code>ConfigMap</code> named <code>config-network</code> in the namespace <code>knative-serving</code>. See the ConfigMap in the <a href="https://github.com/knative/serving/releases/download/v0.8.0/serving.yaml" rel="nofollow noreferrer">deployment resources</a>:</p>

<pre><code>apiVersion: v1
data:
  _example: |
    ...
    # domainTemplate specifies the golang text template string to use
    # when constructing the Knative service's DNS name. The default
    # value is "{{.Name}}.{{.Namespace}}.{{.Domain}}". And those three
    # values (Name, Namespace, Domain) are the only variables defined.
    #
    # Changing this value might be necessary when the extra levels in
    # the domain name generated is problematic for wildcard certificates
    # that only support a single level of domain name added to the
    # certificate's domain. In those cases you might consider using a value
    # of "{{.Name}}-{{.Namespace}}.{{.Domain}}", or removing the Namespace
    # entirely from the template. When choosing a new value be thoughtful
    # of the potential for conflicts - for example, when users choose to use
    # characters such as `-` in their service, or namespace, names.
    # {{.Annotations}} can be used for any customization in the go template if needed.
    # We strongly recommend keeping namespace part of the template to avoid domain name clashes
    # Example '{{.Name}}-{{.Namespace}}.{{ index .Annotations "sub"}}.{{.Domain}}'
    # and you have an annotation {"sub":"foo"}, then the generated template would be {Name}-{Namespace}.foo.{Domain}
    domainTemplate: "{{.Name}}.{{.Namespace}}.{{.Domain}}"
    ...
kind: ConfigMap
metadata:
  labels:
    serving.knative.dev/release: "v0.8.0"
  name: config-network
  namespace: knative-serving

</code></pre>

<p>Therefore, your <code>config-network</code> should look like this:</p>

<pre><code>apiVersion: v1
data:
  domainTemplate: {{ '"{{.Name}}.{{.Domain}}"' }}
kind: ConfigMap
metadata:
  name: config-network
  namespace: knative-serving
</code></pre>

<p>You can also have a look and customize the <code>config-domain</code> to configure the domain name that is appended to your services.</p>
