<p>From preview environment I want to access a database located in staging environment (in namespace <code>jx-staging</code>).</p>

<p>I am trying to follow <a href="https://jenkins-x.io/developing/preview/#adding-more-resources" rel="nofollow noreferrer">Service Linking</a> from Jenkins-X documentation with no success. Documentation is not really clear where to put the service link definition.</p>

<p>I created a service file <code>charts/preview/resources/mysql.yaml</code> with following content, but the service link is not created. </p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: mysql
spec:
  type: ExternalName
  externalName: mysql.jx-staging.svc.cluster.local
  ports:
  - port: 3306
</code></pre>

<p>JX Environment:</p>

<pre><code>jx version:
NAME               VERSION
jx                 1.3.688
jenkins x platform 0.0.3125
Kubernetes cluster v1.10.9-gke.5
kubectl            v1.10.7
helm client        v2.12.1+g02a47c7
helm server        v2.12.0+gd325d2a
git                git version 2.11.0
Operating System   Debian GNU/Linux 9.6 (stretch)
</code></pre>

<p>Where and how to define a service link?</p>

<p>GitHub issue: <a href="https://github.com/jenkins-x/jx/issues/2604" rel="nofollow noreferrer">How to link external service in preview environment</a> </p>

Michal Foksa
<p>Solution is to move <code>mysql.yaml</code> from <code>resources</code> to <code>templates</code> sub-folder:</p>

<pre><code>charts/preview/templates/mysql.yaml
</code></pre>

<p>Issue was cause by a typo in <a href="https://jenkins-x.io/developing/preview/#adding-more-resources" rel="nofollow noreferrer">Service Linking</a> documentation which is now corrected.</p>
