<p>While using gitlab auto devops I notice each project being created in its own namespace, defining the service name as <code>production-auto-deploy</code>.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>$kubectl get services --all-namespaces

NAMESPACE                NAME                                     TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                      AGE
app-13094854             production-auto-deploy                   ClusterIP      10.245.23.224    &lt;none&gt;           5000/TCP                     11h
app-13094854             production-postgres                      ClusterIP      10.245.202.205   &lt;none&gt;           5432/TCP                     11h
config-server-13051179   production-auto-deploy                   ClusterIP      10.245.138.49    &lt;none&gt;           5000/TCP                     40m
default                  kubernetes                               ClusterIP      10.245.0.1       &lt;none&gt;           443/TCP                      11h
gitlab-managed-apps      ingress-nginx-ingress-controller         LoadBalancer   10.245.200.23    206.189.243.26   80:30888/TCP,443:30962/TCP   11h
gitlab-managed-apps      ingress-nginx-ingress-controller-stats   ClusterIP      10.245.104.211   &lt;none&gt;           18080/TCP                    11h
gitlab-managed-apps      ingress-nginx-ingress-default-backend    ClusterIP      10.245.202.171   &lt;none&gt;           80/TCP                       11h
gitlab-managed-apps      tiller-deploy                            ClusterIP      10.245.31.107    &lt;none&gt;           44134/TCP                    11h
kube-system              kube-dns                                 ClusterIP      10.245.0.10      &lt;none&gt;           53/UDP,53/TCP,9153/TCP       11h
some-microservice-13093883          production-auto-deploy                   ClusterIP      10.245.97.62     &lt;none&gt;           5000/TCP                     11h
some-microservice-13093883          production-postgres                      ClusterIP      10.245.245.253   &lt;none&gt;           5432/TCP                     11h</code></pre>
</div>
</div>
</p>

<p>Can this service name be customized? For example I want it to include the project name thus mapping <code>production-auto-deploy</code> -> <code>app-production-auto-deploy</code> and <code>some-microservice-production-auto-deploy</code>.</p>

<p>The reason I want these service names to be unique is because I am evaluating spring-cloud-kubernetes and I need unique service names for ribbon discovery using feign clients.</p>

<p>Additionally I am wondering why each project is given its own namespace, is this some kind of best-practice? Can auto devops be configured to deploy all projects in the same namespace?</p>

<blockquote>
  <p>Can this service name be customized?</p>
</blockquote>

<p>Yes, it can be, by using <a href="https://docs.gitlab.com/ee/topics/autodevops/#custom-helm-chart" rel="nofollow noreferrer">custom helm</a> chart.</p>

<p>In simplification, service name is generated from two variables (Release name + Chart name)</p>

<pre><code>printf "%s-%s" .Release.Name $name | trimSuffix "-app" ...
</code></pre>

<p>By default Auto DevOps uses its own helm chart, source code available <a href="https://gitlab.com/gitlab-org/charts/auto-deploy-app" rel="nofollow noreferrer">here</a>.</p>

<p>And by changing the 'name' inside <a href="https://gitlab.com/gitlab-org/charts/auto-deploy-app/blob/master/Chart.yaml#L3" rel="nofollow noreferrer">Chart.yaml</a> file (which contains chart's metadata), you can influence the final service name.  </p>

<p>There is also another way to customize service name: by using overrides values to 'helm upgrade' command inside 'Deploy.gitlab-ci.yml' template with <code>'--set nameOverride=&lt;CUSTOM_SVC_NAME&gt;'</code></p>

<blockquote>
  <p>Additionally I am wondering why each project is given its own
  namespace, is this some kind of best-practice? Can auto devops be
  configured to deploy all projects in the same namespace?</p>
</blockquote>

<p>By default Auto Deploy uses this technique and naming convention for K8S namespaces during apps deployment (as described <a href="https://docs.gitlab.com/ee/topics/autodevops/#auto-deploy" rel="nofollow noreferrer">here</a>), and there is no way to change it according official documentation.</p>

<p>You can try at your own risk to override it with use of <a href="https://docs.gitlab.com/ee/ci/variables/README.html#custom-environment-variables" rel="nofollow noreferrer">custom project</a> variable: <code>KUBE_NAMESPACE</code></p>
