1
0

Now I understand what . is, I can ditch all the variable references.

This commit is contained in:
Fleur Kelpin 2018-06-29 14:10:14 +02:00
parent f1616c7ed8
commit 02e397b253

View File

@ -34,53 +34,53 @@ data:
<name>{{ $podName }}</name> <name>{{ $podName }}</name>
<instanceCap>2147483647</instanceCap> <instanceCap>2147483647</instanceCap>
<idleMinutes>0</idleMinutes> <idleMinutes>0</idleMinutes>
<label>{{ $.Release.Name }}-{{ $pod.Label }}</label> <label>{{ $.Release.Name }}-{{ .Label }}</label>
<nodeSelector> <nodeSelector>
{{- $local := dict "first" true }} {{- $local := dict "first" true }}
{{- range $key, $value := $pod.NodeSelector }} {{- range $key, $value := .NodeSelector }}
{{- if not $local.first }},{{- end }} {{- if not $local.first }},{{- end }}
{{- $key }}={{ $value }} {{- $key }}={{ $value }}
{{- $_ := set $local "first" false }} {{- $_ := set $local "first" false }}
{{- end }}</nodeSelector> {{- end }}</nodeSelector>
<nodeUsageMode>$pod.NodeUsageMode</nodeUsageMode> <nodeUsageMode>.NodeUsageMode</nodeUsageMode>
<volumes> <volumes>
{{- range $index, $volume := $pod.volumes }} {{- range $index, $volume := .volumes }}
<org.csanchez.jenkins.plugins.kubernetes.volumes.{{ $volume.type }}Volume> <org.csanchez.jenkins.plugins.kubernetes.volumes.{{ .type }}Volume>
{{- range $key, $value := $volume }}{{- if not (eq $key "type") }} {{- range $key, $value := $volume }}{{- if not (eq $key "type") }}
<{{ $key }}>{{ $value }}</{{ $key }}> <{{ $key }}>{{ $value }}</{{ $key }}>
{{- end }}{{- end }} {{- end }}{{- end }}
</org.csanchez.jenkins.plugins.kubernetes.volumes.{{ $volume.type }}Volume> </org.csanchez.jenkins.plugins.kubernetes.volumes.{{ .type }}Volume>
{{- end }} {{- end }}
</volumes> </volumes>
<containers> <containers>
{{- range $containerName, $container := $pod.Containers }} {{- range $containerName, $container := .Containers }}
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate> <org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
<name>{{ $containerName }}</name> <name>{{ $containerName }}</name>
<image>{{ $container.Image }}:{{ $container.ImageTag | default "latest" }}</image> <image>{{ .Image }}:{{ .ImageTag | default "latest" }}</image>
{{- if $container.Privileged }} {{- if .Privileged }}
<privileged>true</privileged> <privileged>true</privileged>
{{- else }} {{- else }}
<privileged>false</privileged> <privileged>false</privileged>
{{- end }} {{- end }}
{{- if $container.AlwaysPullImage }} {{- if .AlwaysPullImage }}
<alwaysPullImage>true</alwaysPullImage> <alwaysPullImage>true</alwaysPullImage>
{{- else }} {{- else }}
<alwaysPullImage>false</alwaysPullImage> <alwaysPullImage>false</alwaysPullImage>
{{- end }} {{- end }}
<workingDir>/home/jenkins</workingDir> <workingDir>/home/jenkins</workingDir>
<command>{{ $container.Command | default "cat" }}</command> <command>{{ .Command | default "cat" }}</command>
<args>{{ $container.Args | default "" }}</args> <args>{{ .Args | default "" }}</args>
{{- if $container.TTY }} {{- if .TTY }}
<ttyEnabled>true</ttyEnabled> <ttyEnabled>true</ttyEnabled>
{{- else }} {{- else }}
<ttyEnabled>false</ttyEnabled> <ttyEnabled>false</ttyEnabled>
{{- end }} {{- end }}
{{- if $container.resources }} {{- if .resources }}
{{- if $container.resources.requests }} {{- if .resources.requests }}
<resourceRequestCpu>{{ $container.resources.requests.cpu | default "" }}</resourceRequestCpu> <resourceRequestCpu>{{ $container.resources.requests.cpu | default "" }}</resourceRequestCpu>
<resourceRequestMemory>{{ $container.resources.requests.memory | default "" }}</resourceRequestMemory> <resourceRequestMemory>{{ $container.resources.requests.memory | default "" }}</resourceRequestMemory>
{{- end }} {{- end }}
{{- if $container.resources.limits }} {{- if .resources.limits }}
<resourceLimitCpu>{{ $container.resources.limits.cpu | default "" }}</resourceLimitCpu> <resourceLimitCpu>{{ $container.resources.limits.cpu | default "" }}</resourceLimitCpu>
<resourceLimitMemory>{{ $container.resources.limits.memory | default "" }}</resourceLimitMemory> <resourceLimitMemory>{{ $container.resources.limits.memory | default "" }}</resourceLimitMemory>
{{- end }} {{- end }}
@ -93,19 +93,19 @@ data:
<key>JENKINS_URL</key> <key>JENKINS_URL</key>
<value>http://{{ template "jenkins.fullname" $ }}:{{$.Values.Master.ServicePort}}{{ default "" $.Values.Master.JenkinsUriPrefix }}</value> <value>http://{{ template "jenkins.fullname" $ }}:{{$.Values.Master.ServicePort}}{{ default "" $.Values.Master.JenkinsUriPrefix }}</value>
</org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar> </org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar>
{{- range $index, $envVar := $pod.EnvVars }} {{- range $index, $envVar := .EnvVars }}
<org.csanchez.jenkins.plugins.kubernetes.model.{{ $envVar.type }}EnvVar> <org.csanchez.jenkins.plugins.kubernetes.model.{{ .type }}EnvVar>
{{- range $key, $value := $envVar }}{{- if not (eq $key "type") }} {{- range $key, $value := $envVar }}{{- if not (eq $key "type") }}
<{{ $key }}>{{ $value }}</{{ $key }}> <{{ $key }}>{{ $value }}</{{ $key }}>
{{- end }}{{- end }} {{- end }}{{- end }}
</org.csanchez.jenkins.plugins.kubernetes.model.{{ $envVar.type }}EnvVar> </org.csanchez.jenkins.plugins.kubernetes.model.{{ .type }}EnvVar>
{{- end }} {{- end }}
</envVars> </envVars>
<annotations/> <annotations/>
{{- if $pod.ImagePullSecret }} {{- if .ImagePullSecret }}
<imagePullSecrets> <imagePullSecrets>
<org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret> <org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
<name>{{ $pod.ImagePullSecret }}</name> <name>{{ .ImagePullSecret }}</name>
</org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret> </org.csanchez.jenkins.plugins.kubernetes.PodImagePullSecret>
</imagePullSecrets> </imagePullSecrets>
{{- else }} {{- else }}