title: loop in go helm chart templating
body: <p>I am trying to loop for a count in a kubernetes helm chart like this:</p>
  
  <pre><code>reaction.mongo_url_big: mongodb://{{ for $mongocount := 0; $mongocount &lt; {{ .Values.mongodbReplicantCount }}; $mongocount++ }}{{ .Values.mongodbReleaseName }}-mongodb-replicaset-{{ $mongocount }}:{{ .Values.mongodbPort }}{{ if $mongocount &lt; {{ .Values.mongodbReplicantCount }} - 1 }},{{ end }}{{ end }}/{{ .Values.mongodbName }}?replicaSet={{ .Values.mongodbReplicaSet }}
  </code></pre>
  
  <p>However, go templates seem to be lacking a means of rendering a 'for' loop, <a href="https://groups.google.com/forum/#!topic/golang-nuts/ahKwwz4fRFM" rel="nofollow noreferrer">by design</a></p>
  
  <p>I want it to output something like:</p>
  
  <pre><code> reaction.mongo_url: mongodb://{{ .Values.mongodbReleaseName }}-mongodb-replicaset-0:{{ .Values.mongodbPort }},{{ .Values.mongodbReleaseName }}-mongodb-replicaset-1:{{ .Values.mongodbPort }},{{ .Values.mongodbReleaseName }}-mongodb-replicaset-2:{{ .Values.mongodbPort }}/{{ .Values.mongodbName }}?replicaSet={{ .Values.mongodbReplicaSet }}
  </code></pre>
  
  <p>The line in my helm chart is here:
  <a href="https://github.com/joshuacox/reactionetes/blob/gymongonasium/reactioncommerce/templates/configmap.yaml#L11" rel="nofollow noreferrer">https://github.com/joshuacox/reactionetes/blob/gymongonasium/reactioncommerce/templates/configmap.yaml#L11</a></p>