<p>For faster builds I want to reuse my gradle-user-home in gitlab-runner. To achieve this I created a pvc and want to mount it on my build-containers. Can I do this with the default helm-chart?</p>

<p>So if you see <a href="https://gitlab.com/charts/gitlab-runner/blob/master/templates/deployment.yaml" rel="nofollow noreferrer">here</a>. There are no PVCs (Physical Volume Claims) or PVs (Physical Volumes) defined on the default Helm Chart.</p>

<p>You'd have to have something like this:</p>

<pre><code>        volumeMounts:
        - name: gradle-user-home &lt;== add this
          mountPath: /path/to/home
          subPath: home  
        - name: runner-secrets
          mountPath: /secrets
        - name: etc-gitlab-runner
          mountPath: /home/gitlab-runner/.gitlab-runner
        - name: scripts
          mountPath: /scripts
        {{- if .Values.certsSecretName }}
        - name: custom-certs
          readOnly: true
          mountPath: /home/gitlab-runner/.gitlab-runner/certs/
        {{- end }}
        resources:
{{ toYaml .Values.resources | indent 10 }}
      volumes:
      - name: runner-secrets
        emptyDir:
          medium: "Memory"
      - name: etc-gitlab-runner
        emptyDir:
          medium: "Memory"
      - name: init-runner-secrets
        projected:
          sources:
            {{- if .Values.runners.cache }}
            - secret:
                name: {{ template "gitlab-runner.cache.secret" . }}
                items:
                  - key: accesskey
                    path: s3-access-key
                  - key: secretkey
                    path: s3-secret-key
            {{- end }}
            - secret:
                name: {{ template "gitlab-runner.secret" . }}
                items:
                  - key: runner-registration-token
                    path: runner-registration-token
                  - key: runner-token
                    path: runner-token
      {{- if .Values.certsSecretName }}
      - name: custom-certs
        secret:
          secretName: {{ .Values.certsSecretName }}
      {{- end }}
      - name: scripts
        configMap:
         name: {{ template "gitlab-runner.fullname" . }}


  volumeClaimTemplates:  &lt;== Add this
  - metadata:
      name: gradle-user-home
    spec:
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 10Gi
</code></pre>

<p>Note the this is only a rough draft template. You'll have to convert to the appropriate Helm template if you want to make it a Helm chart. (This happens to be a Golang template)</p>

<p>You don't have to modify the template if you don't want to. You can directly modify your deployment if you'd like with: <code>kubectl -n &lt;namespace&gt; edit deployment &lt;gitlab-runner-deployment&gt;</code></p>

<p>Also if you are using PVCs (Physical Volume Claims), you'll have to define a default <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/" rel="nofollow noreferrer">Kubernetes Storage Class</a></p>

<p>Hope it helps!</p>
