| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 1 | {{/* vim: set filetype=mustache: */}} |
| 2 | {{/* |
| 3 | Expand the name of the chart. |
| 4 | */}} |
| 5 | {{- define "jenkins.name" -}} |
| 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 7 | {{- end -}} |
| 8 | |
| 9 | {{/* |
| 10 | Expand the label of the chart. |
| 11 | */}} |
| 12 | {{- define "jenkins.label" -}} |
| 13 | {{- printf "%s-%s" (include "jenkins.name" .) .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} |
| 14 | {{- end -}} |
| 15 | |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 16 | {{/* |
| 17 | Common labels for all Jenkins resources |
| 18 | */}} |
| 19 | {{- define "jenkins.labels" -}} |
| 20 | "app.kubernetes.io/name": '{{ template "jenkins.name" .}}' |
| 21 | "app.kubernetes.io/managed-by": "{{ .Release.Service }}" |
| 22 | "app.kubernetes.io/instance": "{{ .Release.Name }}" |
| 23 | "app.kubernetes.io/component": "{{ .Values.controller.componentName }}" |
| 24 | {{- if .Values.renderHelmLabels }} |
| 25 | "helm.sh/chart": "{{ template "jenkins.label" .}}" |
| 26 | {{- end }} |
| 27 | {{- with .Values.extraLabels }} |
| 28 | {{- toYaml . | nindent 0 }} |
| 29 | {{- end }} |
| 30 | {{- end -}} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 31 | |
| 32 | {{/* |
| 33 | Allow the release namespace to be overridden for multi-namespace deployments in combined charts. |
| 34 | */}} |
| 35 | {{- define "jenkins.namespace" -}} |
| 36 | {{- if .Values.namespaceOverride -}} |
| 37 | {{- .Values.namespaceOverride -}} |
| 38 | {{- else -}} |
| 39 | {{- .Release.Namespace -}} |
| 40 | {{- end -}} |
| 41 | {{- end -}} |
| 42 | |
| 43 | {{- define "jenkins.agent.namespace" -}} |
| 44 | {{- if .Values.agent.namespace -}} |
| 45 | {{- tpl .Values.agent.namespace . -}} |
| 46 | {{- else -}} |
| 47 | {{- if .Values.namespaceOverride -}} |
| 48 | {{- .Values.namespaceOverride -}} |
| 49 | {{- else -}} |
| 50 | {{- .Release.Namespace -}} |
| 51 | {{- end -}} |
| 52 | {{- end -}} |
| 53 | {{- end -}} |
| 54 | |
| 55 | |
| 56 | {{/* |
| 57 | Create a default fully qualified app name. |
| 58 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 59 | If release name contains chart name it will be used as a full name. |
| 60 | */}} |
| 61 | {{- define "jenkins.fullname" -}} |
| 62 | {{- if .Values.fullnameOverride -}} |
| 63 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} |
| 64 | {{- else -}} |
| 65 | {{- $name := default .Chart.Name .Values.nameOverride -}} |
| 66 | {{- if contains $name .Release.Name -}} |
| 67 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} |
| 68 | {{- else -}} |
| 69 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
| 70 | {{- end -}} |
| 71 | {{- end -}} |
| 72 | {{- end -}} |
| 73 | |
| 74 | {{/* |
| 75 | Returns the admin password |
| 76 | https://github.com/helm/charts/issues/5167#issuecomment-619137759 |
| 77 | */}} |
| 78 | {{- define "jenkins.password" -}} |
| 79 | {{- if .Values.controller.admin.password -}} |
| 80 | {{- .Values.controller.admin.password | b64enc | quote }} |
| 81 | {{- else -}} |
| 82 | {{- $secret := (lookup "v1" "Secret" .Release.Namespace (include "jenkins.fullname" .)).data -}} |
| 83 | {{- if $secret -}} |
| 84 | {{/* |
| 85 | Reusing current password since secret exists |
| 86 | */}} |
| 87 | {{- index $secret ( .Values.controller.admin.passwordKey | default "jenkins-admin-password" ) -}} |
| 88 | {{- else -}} |
| 89 | {{/* |
| 90 | Generate new password |
| 91 | */}} |
| 92 | {{- randAlphaNum 22 | b64enc | quote }} |
| 93 | {{- end -}} |
| 94 | {{- end -}} |
| 95 | {{- end -}} |
| 96 | |
| 97 | {{/* |
| 98 | Returns the Jenkins URL |
| 99 | */}} |
| 100 | {{- define "jenkins.url" -}} |
| 101 | {{- if .Values.controller.jenkinsUrl }} |
| 102 | {{- .Values.controller.jenkinsUrl }} |
| 103 | {{- else }} |
| 104 | {{- if .Values.controller.ingress.hostName }} |
| 105 | {{- if .Values.controller.ingress.tls }} |
| 106 | {{- default "https" .Values.controller.jenkinsUrlProtocol }}://{{ tpl .Values.controller.ingress.hostName $ }}{{ default "" .Values.controller.jenkinsUriPrefix }} |
| 107 | {{- else }} |
| 108 | {{- default "http" .Values.controller.jenkinsUrlProtocol }}://{{ tpl .Values.controller.ingress.hostName $ }}{{ default "" .Values.controller.jenkinsUriPrefix }} |
| 109 | {{- end }} |
| 110 | {{- else }} |
| 111 | {{- default "http" .Values.controller.jenkinsUrlProtocol }}://{{ template "jenkins.fullname" . }}:{{.Values.controller.servicePort}}{{ default "" .Values.controller.jenkinsUriPrefix }} |
| 112 | {{- end}} |
| 113 | {{- end}} |
| 114 | {{- end -}} |
| 115 | |
| 116 | {{/* |
| 117 | Returns configuration as code default config |
| 118 | */}} |
| 119 | {{- define "jenkins.casc.defaults" -}} |
| 120 | jenkins: |
| 121 | {{- $configScripts := toYaml .Values.controller.JCasC.configScripts }} |
| 122 | {{- if and (.Values.controller.JCasC.authorizationStrategy) (not (contains "authorizationStrategy:" $configScripts)) }} |
| 123 | authorizationStrategy: |
| 124 | {{- tpl .Values.controller.JCasC.authorizationStrategy . | nindent 4 }} |
| 125 | {{- end }} |
| 126 | {{- if and (.Values.controller.JCasC.securityRealm) (not (contains "securityRealm:" $configScripts)) }} |
| 127 | securityRealm: |
| 128 | {{- tpl .Values.controller.JCasC.securityRealm . | nindent 4 }} |
| 129 | {{- end }} |
| 130 | disableRememberMe: {{ .Values.controller.disableRememberMe }} |
| 131 | {{- if .Values.controller.legacyRemotingSecurityEnabled }} |
| 132 | remotingSecurity: |
| 133 | enabled: true |
| 134 | {{- end }} |
| 135 | mode: {{ .Values.controller.executorMode }} |
| 136 | numExecutors: {{ .Values.controller.numExecutors }} |
| 137 | {{- if not (kindIs "invalid" .Values.controller.customJenkinsLabels) }} |
| 138 | labelString: "{{ join " " .Values.controller.customJenkinsLabels }}" |
| 139 | {{- end }} |
| 140 | {{- if .Values.controller.projectNamingStrategy }} |
| 141 | {{- if kindIs "string" .Values.controller.projectNamingStrategy }} |
| 142 | projectNamingStrategy: "{{ .Values.controller.projectNamingStrategy }}" |
| 143 | {{- else }} |
| 144 | projectNamingStrategy: |
| 145 | {{- toYaml .Values.controller.projectNamingStrategy | nindent 4 }} |
| 146 | {{- end }} |
| 147 | {{- end }} |
| 148 | markupFormatter: |
| 149 | {{- if .Values.controller.enableRawHtmlMarkupFormatter }} |
| 150 | rawHtml: |
| 151 | disableSyntaxHighlighting: true |
| 152 | {{- else }} |
| 153 | {{- toYaml .Values.controller.markupFormatter | nindent 4 }} |
| 154 | {{- end }} |
| 155 | clouds: |
| 156 | - kubernetes: |
| 157 | containerCapStr: "{{ .Values.agent.containerCap }}" |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 158 | {{- if .Values.agent.garbageCollection.enabled }} |
| 159 | garbageCollection: |
| 160 | {{- if .Values.agent.garbageCollection.namespaces }} |
| 161 | namespaces: |- |
| 162 | {{- .Values.agent.garbageCollection.namespaces | nindent 10 }} |
| 163 | {{- end }} |
| 164 | timeout: "{{ .Values.agent.garbageCollection.timeout }}" |
| 165 | {{- end }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 166 | {{- if .Values.agent.jnlpregistry }} |
| 167 | jnlpregistry: "{{ .Values.agent.jnlpregistry }}" |
| 168 | {{- end }} |
| 169 | defaultsProviderTemplate: "{{ .Values.agent.defaultsProviderTemplate }}" |
| 170 | connectTimeout: "{{ .Values.agent.kubernetesConnectTimeout }}" |
| 171 | readTimeout: "{{ .Values.agent.kubernetesReadTimeout }}" |
| 172 | {{- if .Values.agent.directConnection }} |
| 173 | directConnection: true |
| 174 | {{- else }} |
| 175 | {{- if .Values.agent.jenkinsUrl }} |
| 176 | jenkinsUrl: "{{ tpl .Values.agent.jenkinsUrl . }}" |
| 177 | {{- else }} |
| 178 | jenkinsUrl: "http://{{ template "jenkins.fullname" . }}.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{.Values.controller.servicePort}}{{ default "" .Values.controller.jenkinsUriPrefix }}" |
| 179 | {{- end }} |
| 180 | {{- if not .Values.agent.websocket }} |
| 181 | {{- if .Values.agent.jenkinsTunnel }} |
| 182 | jenkinsTunnel: "{{ tpl .Values.agent.jenkinsTunnel . }}" |
| 183 | {{- else }} |
| 184 | jenkinsTunnel: "{{ template "jenkins.fullname" . }}-agent.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{ .Values.controller.agentListenerPort }}" |
| 185 | {{- end }} |
| 186 | {{- else }} |
| 187 | webSocket: true |
| 188 | {{- end }} |
| 189 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 190 | skipTlsVerify: {{ .Values.agent.skipTlsVerify | default false}} |
| 191 | usageRestricted: {{ .Values.agent.usageRestricted | default false}} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 192 | maxRequestsPerHostStr: {{ .Values.agent.maxRequestsPerHostStr | quote }} |
| 193 | retentionTimeout: {{ .Values.agent.retentionTimeout | quote }} |
| 194 | waitForPodSec: {{ .Values.agent.waitForPodSec | quote }} |
| 195 | name: "{{ .Values.controller.cloudName }}" |
| 196 | namespace: "{{ template "jenkins.agent.namespace" . }}" |
| 197 | restrictedPssSecurityContext: {{ .Values.agent.restrictedPssSecurityContext }} |
| 198 | serverUrl: "{{ .Values.kubernetesURL }}" |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 199 | addMasterProxyEnvVars: {{ .Values.agent.addMasterProxyEnvVars | default false }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 200 | credentialsId: "{{ .Values.credentialsId }}" |
| 201 | {{- if .Values.agent.enabled }} |
| 202 | podLabels: |
| 203 | - key: "jenkins/{{ .Release.Name }}-{{ .Values.agent.componentName }}" |
| 204 | value: "true" |
| 205 | {{- range $key, $val := .Values.agent.podLabels }} |
| 206 | - key: {{ $key | quote }} |
| 207 | value: {{ $val | quote }} |
| 208 | {{- end }} |
| 209 | templates: |
| 210 | {{- if not .Values.agent.disableDefaultAgent }} |
| 211 | {{- include "jenkins.casc.podTemplate" . | nindent 8 }} |
| 212 | {{- end }} |
| 213 | {{- if .Values.additionalAgents }} |
| 214 | {{- /* save .Values.agent */}} |
| 215 | {{- $agent := .Values.agent }} |
| 216 | {{- range $name, $additionalAgent := .Values.additionalAgents }} |
| 217 | {{- $additionalContainersEmpty := and (hasKey $additionalAgent "additionalContainers") (empty $additionalAgent.additionalContainers) }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 218 | {{- $runAsUser := $additionalAgent.runAsUser }} |
| 219 | {{- $runAsUserSet := not (kindIs "invalid" $runAsUser) }} |
| 220 | {{- $runAsGroup := $additionalAgent.runAsGroup }} |
| 221 | {{- $runAsGroupSet := not (kindIs "invalid" $runAsGroup) }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 222 | {{- /* merge original .Values.agent into additional agent to ensure it at least has the default values */}} |
| 223 | {{- $additionalAgent := merge $additionalAgent $agent }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 224 | {{- if $runAsUserSet }} |
| 225 | {{- $_ := set $additionalAgent "runAsUser" $runAsUser }} |
| 226 | {{- end }} |
| 227 | {{- if $runAsGroupSet }} |
| 228 | {{- $_ := set $additionalAgent "runAsGroup" $runAsGroup }} |
| 229 | {{- end }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 230 | {{- /* clear list of additional containers in case it is configured empty for this agent (merge might have overwritten that) */}} |
| 231 | {{- if $additionalContainersEmpty }} |
| 232 | {{- $_ := set $additionalAgent "additionalContainers" list }} |
| 233 | {{- end }} |
| 234 | {{- /* set .Values.agent to $additionalAgent */}} |
| 235 | {{- $_ := set $.Values "agent" $additionalAgent }} |
| 236 | {{- include "jenkins.casc.podTemplate" $ | nindent 8 }} |
| 237 | {{- end }} |
| 238 | {{- /* restore .Values.agent */}} |
| 239 | {{- $_ := set .Values "agent" $agent }} |
| 240 | {{- end }} |
| 241 | {{- if .Values.agent.podTemplates }} |
| 242 | {{- range $key, $val := .Values.agent.podTemplates }} |
| 243 | {{- tpl $val $ | nindent 8 }} |
| 244 | {{- end }} |
| 245 | {{- end }} |
| 246 | {{- end }} |
| 247 | {{- if .Values.additionalClouds }} |
| 248 | {{- /* save root */}} |
| 249 | {{- $oldRoot := deepCopy $ }} |
| 250 | {{- range $name, $additionalCloud := .Values.additionalClouds }} |
| 251 | {{- $newRoot := deepCopy $ }} |
| 252 | {{- /* clear additionalAgents from the copy if override set to `true` */}} |
| 253 | {{- if .additionalAgentsOverride }} |
| 254 | {{- $_ := set $newRoot.Values "additionalAgents" list}} |
| 255 | {{- end}} |
| 256 | {{- $newValues := merge $additionalCloud $newRoot.Values }} |
| 257 | {{- $_ := set $newRoot "Values" $newValues }} |
| 258 | {{- /* clear additionalClouds from the copy */}} |
| 259 | {{- $_ := set $newRoot.Values "additionalClouds" list }} |
| 260 | {{- with $newRoot}} |
| 261 | - kubernetes: |
| 262 | containerCapStr: "{{ .Values.agent.containerCap }}" |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 263 | {{- if .Values.agent.garbageCollection.enabled }} |
| 264 | garbageCollection: |
| 265 | {{- if .Values.agent.garbageCollection.namespaces }} |
| 266 | namespaces: |- |
| 267 | {{- .Values.agent.garbageCollection.namespaces | nindent 10 }} |
| 268 | {{- end }} |
| 269 | timeout: "{{ .Values.agent.garbageCollection.timeout }}" |
| 270 | {{- end }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 271 | {{- if .Values.agent.jnlpregistry }} |
| 272 | jnlpregistry: "{{ .Values.agent.jnlpregistry }}" |
| 273 | {{- end }} |
| 274 | defaultsProviderTemplate: "{{ .Values.agent.defaultsProviderTemplate }}" |
| 275 | connectTimeout: "{{ .Values.agent.kubernetesConnectTimeout }}" |
| 276 | readTimeout: "{{ .Values.agent.kubernetesReadTimeout }}" |
| 277 | {{- if .Values.agent.directConnection }} |
| 278 | directConnection: true |
| 279 | {{- else }} |
| 280 | {{- if .Values.agent.jenkinsUrl }} |
| 281 | jenkinsUrl: "{{ tpl .Values.agent.jenkinsUrl . }}" |
| 282 | {{- else }} |
| 283 | jenkinsUrl: "http://{{ template "jenkins.fullname" . }}.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{.Values.controller.servicePort}}{{ default "" .Values.controller.jenkinsUriPrefix }}" |
| 284 | {{- end }} |
| 285 | {{- if not .Values.agent.websocket }} |
| 286 | {{- if .Values.agent.jenkinsTunnel }} |
| 287 | jenkinsTunnel: "{{ tpl .Values.agent.jenkinsTunnel . }}" |
| 288 | {{- else }} |
| 289 | jenkinsTunnel: "{{ template "jenkins.fullname" . }}-agent.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{ .Values.controller.agentListenerPort }}" |
| 290 | {{- end }} |
| 291 | {{- else }} |
| 292 | webSocket: true |
| 293 | {{- end }} |
| 294 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 295 | skipTlsVerify: {{ .Values.agent.skipTlsVerify | default false}} |
| 296 | usageRestricted: {{ .Values.agent.usageRestricted | default false}} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 297 | maxRequestsPerHostStr: {{ .Values.agent.maxRequestsPerHostStr | quote }} |
| 298 | retentionTimeout: {{ .Values.agent.retentionTimeout | quote }} |
| 299 | waitForPodSec: {{ .Values.agent.waitForPodSec | quote }} |
| 300 | name: {{ $name | quote }} |
| 301 | namespace: "{{ template "jenkins.agent.namespace" . }}" |
| 302 | restrictedPssSecurityContext: {{ .Values.agent.restrictedPssSecurityContext }} |
| 303 | serverUrl: "{{ .Values.kubernetesURL }}" |
| 304 | credentialsId: "{{ .Values.credentialsId }}" |
| 305 | {{- if .Values.agent.enabled }} |
| 306 | podLabels: |
| 307 | - key: "jenkins/{{ .Release.Name }}-{{ .Values.agent.componentName }}" |
| 308 | value: "true" |
| 309 | {{- range $key, $val := .Values.agent.podLabels }} |
| 310 | - key: {{ $key | quote }} |
| 311 | value: {{ $val | quote }} |
| 312 | {{- end }} |
| 313 | templates: |
| 314 | {{- if not .Values.agent.disableDefaultAgent }} |
| 315 | {{- include "jenkins.casc.podTemplate" . | nindent 8 }} |
| 316 | {{- end }} |
| 317 | {{- if .Values.additionalAgents }} |
| 318 | {{- /* save .Values.agent */}} |
| 319 | {{- $agent := .Values.agent }} |
| 320 | {{- range $name, $additionalAgent := .Values.additionalAgents }} |
| 321 | {{- $additionalContainersEmpty := and (hasKey $additionalAgent "additionalContainers") (empty $additionalAgent.additionalContainers) }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 322 | {{- $runAsUser := $additionalAgent.runAsUser }} |
| 323 | {{- $runAsUserSet := not (kindIs "invalid" $runAsUser) }} |
| 324 | {{- $runAsGroup := $additionalAgent.runAsGroup }} |
| 325 | {{- $runAsGroupSet := not (kindIs "invalid" $runAsGroup) }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 326 | {{- /* merge original .Values.agent into additional agent to ensure it at least has the default values */}} |
| 327 | {{- $additionalAgent := merge $additionalAgent $agent }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 328 | {{- if $runAsUserSet }} |
| 329 | {{- $_ := set $additionalAgent "runAsUser" $runAsUser }} |
| 330 | {{- end }} |
| 331 | {{- if $runAsGroupSet }} |
| 332 | {{- $_ := set $additionalAgent "runAsGroup" $runAsGroup }} |
| 333 | {{- end }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 334 | {{- /* clear list of additional containers in case it is configured empty for this agent (merge might have overwritten that) */}} |
| 335 | {{- if $additionalContainersEmpty }} |
| 336 | {{- $_ := set $additionalAgent "additionalContainers" list }} |
| 337 | {{- end }} |
| 338 | {{- /* set .Values.agent to $additionalAgent */}} |
| 339 | {{- $_ := set $.Values "agent" $additionalAgent }} |
| 340 | {{- include "jenkins.casc.podTemplate" $ | nindent 8 }} |
| 341 | {{- end }} |
| 342 | {{- /* restore .Values.agent */}} |
| 343 | {{- $_ := set .Values "agent" $agent }} |
| 344 | {{- end }} |
| 345 | {{- with .Values.agent.podTemplates }} |
| 346 | {{- range $key, $val := . }} |
| 347 | {{- tpl $val $ | nindent 8 }} |
| 348 | {{- end }} |
| 349 | {{- end }} |
| 350 | {{- end }} |
| 351 | {{- end }} |
| 352 | {{- end }} |
| 353 | {{- /* restore root */}} |
| 354 | {{- $_ := set $ "Values" $oldRoot.Values }} |
| 355 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 356 | slaveAgentPort: {{ .Values.controller.agentListenerPort }} |
| 357 | {{- if and .Values.controller.csrf.defaultCrumbIssuer.enabled (eq .Chart.AppVersion (index (splitList "-" (include "controller.image.tag" .)) 0)) (lt (atoi (index (splitList "." .Chart.AppVersion) 1)) 543) }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 358 | crumbIssuer: |
| 359 | standard: |
| 360 | excludeClientIPFromCrumb: {{ if .Values.controller.csrf.defaultCrumbIssuer.proxyCompatability }}true{{ else }}false{{- end }} |
| 361 | {{- end }} |
| 362 | {{- include "jenkins.casc.security" . }} |
| 363 | {{- with .Values.controller.scriptApproval }} |
| 364 | scriptApproval: |
| 365 | approvedSignatures: |
| 366 | {{- range $key, $val := . }} |
| 367 | - "{{ $val }}" |
| 368 | {{- end }} |
| 369 | {{- end }} |
| 370 | unclassified: |
| 371 | location: |
| 372 | {{- with .Values.controller.jenkinsAdminEmail }} |
| 373 | adminAddress: {{ . }} |
| 374 | {{- end }} |
| 375 | url: {{ template "jenkins.url" . }} |
| 376 | {{- end -}} |
| 377 | |
| 378 | {{/* |
| 379 | Returns a name template to be used for jcasc configmaps, using |
| 380 | suffix passed in at call as index 0 |
| 381 | */}} |
| 382 | {{- define "jenkins.casc.configName" -}} |
| 383 | {{- $name := index . 0 -}} |
| 384 | {{- $root := index . 1 -}} |
| 385 | "{{- include "jenkins.fullname" $root -}}-jenkins-{{ $name }}" |
| 386 | {{- end -}} |
| 387 | |
| 388 | {{/* |
| 389 | Returns kubernetes pod template configuration as code |
| 390 | */}} |
| 391 | {{- define "jenkins.casc.podTemplate" -}} |
| 392 | - name: "{{ .Values.agent.podName }}" |
| 393 | namespace: "{{ template "jenkins.agent.namespace" . }}" |
| 394 | {{- if .Values.agent.annotations }} |
| 395 | annotations: |
| 396 | {{- range $key, $value := .Values.agent.annotations }} |
| 397 | - key: {{ $key }} |
| 398 | value: {{ $value | quote }} |
| 399 | {{- end }} |
| 400 | {{- end }} |
| 401 | id: {{ sha256sum (toYaml .Values.agent) }} |
| 402 | containers: |
| 403 | - name: "{{ .Values.agent.sideContainerName }}" |
| 404 | alwaysPullImage: {{ .Values.agent.alwaysPullImage }} |
| 405 | args: "{{ .Values.agent.args | replace "$" "^$" }}" |
| 406 | {{- with .Values.agent.command }} |
| 407 | command: {{ . }} |
| 408 | {{- end }} |
| 409 | envVars: |
| 410 | - envVar: |
| 411 | {{- if .Values.agent.directConnection }} |
| 412 | key: "JENKINS_DIRECT_CONNECTION" |
| 413 | {{- if .Values.agent.jenkinsTunnel }} |
| 414 | value: "{{ tpl .Values.agent.jenkinsTunnel . }}" |
| 415 | {{- else }} |
| 416 | value: "{{ template "jenkins.fullname" . }}-agent.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{ .Values.controller.agentListenerPort }}" |
| 417 | {{- end }} |
| 418 | {{- else }} |
| 419 | key: "JENKINS_URL" |
| 420 | {{- if .Values.agent.jenkinsUrl }} |
| 421 | value: {{ tpl .Values.agent.jenkinsUrl . }} |
| 422 | {{- else }} |
| 423 | value: "http://{{ template "jenkins.fullname" . }}.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{.Values.controller.servicePort}}{{ default "/" .Values.controller.jenkinsUriPrefix }}" |
| 424 | {{- end }} |
| 425 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 426 | {{- if ne .Values.agent.image.registry "" }} |
| 427 | image: "{{ tpl .Values.agent.image.registry . }}/{{ tpl .Values.agent.image.repository . }}:{{ tpl .Values.agent.image.tag . }}" |
| 428 | {{- else }} |
| 429 | image: "{{ tpl .Values.agent.image.repository . }}:{{ tpl .Values.agent.image.tag . }}" |
| 430 | {{- end }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 431 | {{- if .Values.agent.livenessProbe }} |
| 432 | livenessProbe: |
| 433 | execArgs: {{.Values.agent.livenessProbe.execArgs | quote}} |
| 434 | failureThreshold: {{.Values.agent.livenessProbe.failureThreshold}} |
| 435 | initialDelaySeconds: {{.Values.agent.livenessProbe.initialDelaySeconds}} |
| 436 | periodSeconds: {{.Values.agent.livenessProbe.periodSeconds}} |
| 437 | successThreshold: {{.Values.agent.livenessProbe.successThreshold}} |
| 438 | timeoutSeconds: {{.Values.agent.livenessProbe.timeoutSeconds}} |
| 439 | {{- end }} |
| 440 | privileged: "{{- if .Values.agent.privileged }}true{{- else }}false{{- end }}" |
| 441 | resourceLimitCpu: {{.Values.agent.resources.limits.cpu}} |
| 442 | resourceLimitMemory: {{.Values.agent.resources.limits.memory}} |
| 443 | {{- with .Values.agent.resources.limits.ephemeralStorage }} |
| 444 | resourceLimitEphemeralStorage: {{.}} |
| 445 | {{- end }} |
| 446 | resourceRequestCpu: {{.Values.agent.resources.requests.cpu}} |
| 447 | resourceRequestMemory: {{.Values.agent.resources.requests.memory}} |
| 448 | {{- with .Values.agent.resources.requests.ephemeralStorage }} |
| 449 | resourceRequestEphemeralStorage: {{.}} |
| 450 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 451 | {{- if not (kindIs "invalid" .Values.agent.runAsUser) }} |
| 452 | runAsUser: {{ .Values.agent.runAsUser }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 453 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 454 | {{- if not (kindIs "invalid" .Values.agent.runAsGroup) }} |
| 455 | runAsGroup: {{ .Values.agent.runAsGroup }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 456 | {{- end }} |
| 457 | ttyEnabled: {{ .Values.agent.TTYEnabled }} |
| 458 | workingDir: {{ .Values.agent.workingDir }} |
| 459 | {{- range $additionalContainers := .Values.agent.additionalContainers }} |
| 460 | - name: "{{ $additionalContainers.sideContainerName }}" |
| 461 | alwaysPullImage: {{ $additionalContainers.alwaysPullImage | default $.Values.agent.alwaysPullImage }} |
| 462 | args: "{{ $additionalContainers.args | replace "$" "^$" }}" |
| 463 | {{- with $additionalContainers.command }} |
| 464 | command: {{ . }} |
| 465 | {{- end }} |
| 466 | envVars: |
| 467 | - envVar: |
| 468 | key: "JENKINS_URL" |
| 469 | {{- if $additionalContainers.jenkinsUrl }} |
| 470 | value: {{ tpl ($additionalContainers.jenkinsUrl) . }} |
| 471 | {{- else }} |
| 472 | value: "http://{{ template "jenkins.fullname" $ }}.{{ template "jenkins.namespace" $ }}.svc.{{ $.Values.clusterZone }}:{{ $.Values.controller.servicePort }}{{ default "/" $.Values.controller.jenkinsUriPrefix }}" |
| 473 | {{- end }} |
| 474 | image: "{{ $additionalContainers.image.repository }}:{{ $additionalContainers.image.tag }}" |
| 475 | {{- if $additionalContainers.livenessProbe }} |
| 476 | livenessProbe: |
| 477 | execArgs: {{$additionalContainers.livenessProbe.execArgs | quote}} |
| 478 | failureThreshold: {{$additionalContainers.livenessProbe.failureThreshold}} |
| 479 | initialDelaySeconds: {{$additionalContainers.livenessProbe.initialDelaySeconds}} |
| 480 | periodSeconds: {{$additionalContainers.livenessProbe.periodSeconds}} |
| 481 | successThreshold: {{$additionalContainers.livenessProbe.successThreshold}} |
| 482 | timeoutSeconds: {{$additionalContainers.livenessProbe.timeoutSeconds}} |
| 483 | {{- end }} |
| 484 | privileged: "{{- if $additionalContainers.privileged }}true{{- else }}false{{- end }}" |
| 485 | resourceLimitCpu: {{ if $additionalContainers.resources }}{{ $additionalContainers.resources.limits.cpu }}{{ else }}{{ $.Values.agent.resources.limits.cpu }}{{ end }} |
| 486 | resourceLimitMemory: {{ if $additionalContainers.resources }}{{ $additionalContainers.resources.limits.memory }}{{ else }}{{ $.Values.agent.resources.limits.memory }}{{ end }} |
| 487 | resourceRequestCpu: {{ if $additionalContainers.resources }}{{ $additionalContainers.resources.requests.cpu }}{{ else }}{{ $.Values.agent.resources.requests.cpu }}{{ end }} |
| 488 | resourceRequestMemory: {{ if $additionalContainers.resources }}{{ $additionalContainers.resources.requests.memory }}{{ else }}{{ $.Values.agent.resources.requests.memory }}{{ end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 489 | {{- if not (kindIs "invalid" $additionalContainers.runAsUser) }} |
| 490 | runAsUser: {{ $additionalContainers.runAsUser }} |
| 491 | {{- else if not (kindIs "invalid" $.Values.agent.runAsUser) }} |
| 492 | runAsUser: {{ $.Values.agent.runAsUser }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 493 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 494 | {{- if not (kindIs "invalid" $additionalContainers.runAsGroup) }} |
| 495 | runAsGroup: {{ $additionalContainers.runAsGroup }} |
| 496 | {{- else if not (kindIs "invalid" $.Values.agent.runAsGroup) }} |
| 497 | runAsGroup: {{ $.Values.agent.runAsGroup }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 498 | {{- end }} |
| 499 | ttyEnabled: {{ $additionalContainers.TTYEnabled | default $.Values.agent.TTYEnabled }} |
| 500 | workingDir: {{ $additionalContainers.workingDir | default $.Values.agent.workingDir }} |
| 501 | {{- end }} |
| 502 | {{- if or .Values.agent.envVars .Values.agent.secretEnvVars }} |
| 503 | envVars: |
| 504 | {{- range $index, $var := .Values.agent.envVars }} |
| 505 | - envVar: |
| 506 | key: {{ $var.name }} |
| 507 | value: {{ tpl $var.value $ }} |
| 508 | {{- end }} |
| 509 | {{- range $index, $var := .Values.agent.secretEnvVars }} |
| 510 | - secretEnvVar: |
| 511 | key: {{ $var.key }} |
| 512 | secretName: {{ $var.secretName }} |
| 513 | secretKey: {{ $var.secretKey }} |
| 514 | optional: {{ $var.optional | default false }} |
| 515 | {{- end }} |
| 516 | {{- end }} |
| 517 | idleMinutes: {{ .Values.agent.idleMinutes }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 518 | instanceCap: {{ int .Values.agent.instanceCap }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 519 | {{- if .Values.agent.hostNetworking }} |
| 520 | hostNetwork: {{ .Values.agent.hostNetworking }} |
| 521 | {{- end }} |
| 522 | {{- if .Values.agent.imagePullSecretName }} |
| 523 | imagePullSecrets: |
| 524 | - name: {{ .Values.agent.imagePullSecretName }} |
| 525 | {{- end }} |
| 526 | label: "{{ .Release.Name }}-{{ .Values.agent.componentName }} {{ .Values.agent.customJenkinsLabels | join " " }}" |
| 527 | {{- if .Values.agent.nodeSelector }} |
| 528 | nodeSelector: |
| 529 | {{- $local := dict "first" true }} |
| 530 | {{- range $key, $value := .Values.agent.nodeSelector }} |
| 531 | {{- if $local.first }} {{ else }},{{ end }} |
| 532 | {{- $key }}={{ tpl $value $ }} |
| 533 | {{- $_ := set $local "first" false }} |
| 534 | {{- end }} |
| 535 | {{- end }} |
| 536 | nodeUsageMode: {{ quote .Values.agent.nodeUsageMode }} |
| 537 | podRetention: {{ .Values.agent.podRetention }} |
| 538 | showRawYaml: {{ .Values.agent.showRawYaml }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 539 | {{- $asaname := default (include "jenkins.serviceAccountAgentName" .) .Values.agent.serviceAccount -}} |
| 540 | {{- if or (.Values.agent.useDefaultServiceAccount) (.Values.agent.serviceAccount) }} |
| 541 | serviceAccount: "{{ $asaname }}" |
| 542 | {{- end }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 543 | slaveConnectTimeoutStr: "{{ .Values.agent.connectTimeout }}" |
| 544 | {{- if .Values.agent.volumes }} |
| 545 | volumes: |
| 546 | {{- range $index, $volume := .Values.agent.volumes }} |
| 547 | -{{- if (eq $volume.type "ConfigMap") }} configMapVolume: |
| 548 | {{- else if (eq $volume.type "EmptyDir") }} emptyDirVolume: |
| 549 | {{- else if (eq $volume.type "EphemeralVolume") }} genericEphemeralVolume: |
| 550 | {{- else if (eq $volume.type "HostPath") }} hostPathVolume: |
| 551 | {{- else if (eq $volume.type "Nfs") }} nfsVolume: |
| 552 | {{- else if (eq $volume.type "PVC") }} persistentVolumeClaim: |
| 553 | {{- else if (eq $volume.type "Secret") }} secretVolume: |
| 554 | {{- else }} {{ $volume.type }}: |
| 555 | {{- end }} |
| 556 | {{- range $key, $value := $volume }} |
| 557 | {{- if not (eq $key "type") }} |
| 558 | {{ $key }}: {{ if kindIs "string" $value }}{{ tpl $value $ | quote }}{{ else }}{{ $value }}{{ end }} |
| 559 | {{- end }} |
| 560 | {{- end }} |
| 561 | {{- end }} |
| 562 | {{- end }} |
| 563 | {{- if .Values.agent.workspaceVolume }} |
| 564 | workspaceVolume: |
| 565 | {{- if (eq .Values.agent.workspaceVolume.type "DynamicPVC") }} |
| 566 | dynamicPVC: |
| 567 | {{- else if (eq .Values.agent.workspaceVolume.type "EmptyDir") }} |
| 568 | emptyDirWorkspaceVolume: |
| 569 | {{- else if (eq .Values.agent.workspaceVolume.type "EphemeralVolume") }} |
| 570 | genericEphemeralVolume: |
| 571 | {{- else if (eq .Values.agent.workspaceVolume.type "HostPath") }} |
| 572 | hostPathWorkspaceVolume: |
| 573 | {{- else if (eq .Values.agent.workspaceVolume.type "Nfs") }} |
| 574 | nfsWorkspaceVolume: |
| 575 | {{- else if (eq .Values.agent.workspaceVolume.type "PVC") }} |
| 576 | persistentVolumeClaimWorkspaceVolume: |
| 577 | {{- else }} |
| 578 | {{ .Values.agent.workspaceVolume.type }}: |
| 579 | {{- end }} |
| 580 | {{- range $key, $value := .Values.agent.workspaceVolume }} |
| 581 | {{- if not (eq $key "type") }} |
| 582 | {{ $key }}: {{ if kindIs "string" $value }}{{ tpl $value $ | quote }}{{ else }}{{ $value }}{{ end }} |
| 583 | {{- end }} |
| 584 | {{- end }} |
| 585 | {{- end }} |
| 586 | {{- if .Values.agent.yamlTemplate }} |
| 587 | yaml: |- |
| 588 | {{- tpl (trim .Values.agent.yamlTemplate) . | nindent 4 }} |
| 589 | {{- end }} |
| 590 | yamlMergeStrategy: {{ .Values.agent.yamlMergeStrategy }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 591 | inheritYamlMergeStrategy: {{ .Values.agent.inheritYamlMergeStrategy }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 592 | {{- end -}} |
| 593 | |
| 594 | {{- define "jenkins.kubernetes-version" -}} |
| 595 | {{- if .Values.controller.installPlugins -}} |
| 596 | {{- range .Values.controller.installPlugins -}} |
| 597 | {{- if hasPrefix "kubernetes:" . }} |
| 598 | {{- $split := splitList ":" . }} |
| 599 | {{- printf "%s" (index $split 1 ) -}} |
| 600 | {{- end -}} |
| 601 | {{- end -}} |
| 602 | {{- end -}} |
| 603 | {{- end -}} |
| 604 | |
| 605 | {{- define "jenkins.casc.security" }} |
| 606 | security: |
| 607 | {{- with .Values.controller.JCasC }} |
| 608 | {{- if .security }} |
| 609 | {{- .security | toYaml | nindent 2 }} |
| 610 | {{- end }} |
| 611 | {{- end }} |
| 612 | {{- end -}} |
| 613 | |
| 614 | {{/* |
| 615 | Create the name of the service account to use |
| 616 | */}} |
| 617 | {{- define "jenkins.serviceAccountName" -}} |
| 618 | {{- if .Values.serviceAccount.create -}} |
| 619 | {{ default (include "jenkins.fullname" .) .Values.serviceAccount.name }} |
| 620 | {{- else -}} |
| 621 | {{ default "default" .Values.serviceAccount.name }} |
| 622 | {{- end -}} |
| 623 | {{- end -}} |
| 624 | |
| 625 | {{/* |
| 626 | Create the name of the service account for Jenkins agents to use |
| 627 | */}} |
| 628 | {{- define "jenkins.serviceAccountAgentName" -}} |
| 629 | {{- if .Values.serviceAccountAgent.create -}} |
| 630 | {{ default (printf "%s-%s" (include "jenkins.fullname" .) "agent") .Values.serviceAccountAgent.name }} |
| 631 | {{- else -}} |
| 632 | {{ default "default" .Values.serviceAccountAgent.name }} |
| 633 | {{- end -}} |
| 634 | {{- end -}} |
| 635 | |
| 636 | {{/* |
| 637 | Create a full tag name for controller image |
| 638 | */}} |
| 639 | {{- define "controller.image.tag" -}} |
| 640 | {{- if .Values.controller.image.tagLabel -}} |
| 641 | {{- default (printf "%s-%s" .Chart.AppVersion .Values.controller.image.tagLabel) .Values.controller.image.tag -}} |
| 642 | {{- else -}} |
| 643 | {{- default .Chart.AppVersion .Values.controller.image.tag -}} |
| 644 | {{- end -}} |
| 645 | {{- end -}} |
| 646 | |
| 647 | {{/* |
| 648 | Create the HTTP port for interacting with the controller |
| 649 | */}} |
| 650 | {{- define "controller.httpPort" -}} |
| 651 | {{- if .Values.controller.httpsKeyStore.enable -}} |
| 652 | {{- .Values.controller.httpsKeyStore.httpPort -}} |
| 653 | {{- else -}} |
| 654 | {{- .Values.controller.targetPort -}} |
| 655 | {{- end -}} |
| 656 | {{- end -}} |
| 657 | |
| 658 | {{- define "jenkins.configReloadContainer" -}} |
| 659 | {{- $root := index . 0 -}} |
| 660 | {{- $containerName := index . 1 -}} |
| 661 | {{- $containerType := index . 2 -}} |
| 662 | - name: {{ $containerName }} |
| 663 | image: "{{ $root.Values.controller.sidecars.configAutoReload.image.registry }}/{{ $root.Values.controller.sidecars.configAutoReload.image.repository }}:{{ $root.Values.controller.sidecars.configAutoReload.image.tag }}" |
| 664 | imagePullPolicy: {{ $root.Values.controller.sidecars.configAutoReload.imagePullPolicy }} |
| 665 | {{- if $root.Values.controller.sidecars.configAutoReload.containerSecurityContext }} |
| 666 | securityContext: {{- toYaml $root.Values.controller.sidecars.configAutoReload.containerSecurityContext | nindent 4 }} |
| 667 | {{- end }} |
| 668 | {{- if $root.Values.controller.sidecars.configAutoReload.envFrom }} |
| 669 | envFrom: |
| 670 | {{ (tpl (toYaml $root.Values.controller.sidecars.configAutoReload.envFrom) $root) | indent 4 }} |
| 671 | {{- end }} |
| 672 | env: |
| 673 | - name: POD_NAME |
| 674 | valueFrom: |
| 675 | fieldRef: |
| 676 | fieldPath: metadata.name |
| 677 | - name: LABEL |
| 678 | value: "{{ template "jenkins.fullname" $root }}-jenkins-config" |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 679 | - name: HEALTH_PORT |
| 680 | value: "{{ $root.Values.controller.sidecars.configAutoReload.healthPort }}" |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 681 | - name: FOLDER |
| 682 | value: "{{ $root.Values.controller.sidecars.configAutoReload.folder }}" |
| 683 | - name: NAMESPACE |
| 684 | value: '{{ $root.Values.controller.sidecars.configAutoReload.searchNamespace | default (include "jenkins.namespace" $root) }}' |
| 685 | {{- if eq $containerType "init" }} |
| 686 | - name: METHOD |
| 687 | value: "LIST" |
| 688 | {{- else if $root.Values.controller.sidecars.configAutoReload.sleepTime }} |
| 689 | - name: METHOD |
| 690 | value: "SLEEP" |
| 691 | - name: SLEEP_TIME |
| 692 | value: "{{ $root.Values.controller.sidecars.configAutoReload.sleepTime }}" |
| 693 | {{- end }} |
| 694 | {{- if eq $containerType "sidecar" }} |
| 695 | - name: REQ_URL |
| 696 | value: "{{- default "http" $root.Values.controller.sidecars.configAutoReload.scheme }}://localhost:{{- include "controller.httpPort" $root -}}{{- $root.Values.controller.jenkinsUriPrefix -}}/reload-configuration-as-code/?casc-reload-token=$(POD_NAME)" |
| 697 | - name: REQ_METHOD |
| 698 | value: "POST" |
| 699 | - name: REQ_RETRY_CONNECT |
| 700 | value: "{{ $root.Values.controller.sidecars.configAutoReload.reqRetryConnect }}" |
| 701 | {{- if $root.Values.controller.sidecars.configAutoReload.skipTlsVerify }} |
| 702 | - name: REQ_SKIP_TLS_VERIFY |
| 703 | value: "true" |
| 704 | {{- end }} |
| 705 | {{- end }} |
| 706 | |
| 707 | {{- if $root.Values.controller.sidecars.configAutoReload.env }} |
| 708 | {{- range $envVarItem := $root.Values.controller.sidecars.configAutoReload.env -}} |
| 709 | {{- if or (ne $containerType "init") (ne .name "METHOD") }} |
| 710 | {{- (tpl (toYaml (list $envVarItem)) $root) | nindent 4 }} |
| 711 | {{- end -}} |
| 712 | {{- end -}} |
| 713 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 714 | {{- if $root.Values.controller.sidecars.configAutoReload.logging.configuration.override }} |
| 715 | - name: LOG_CONFIG |
| 716 | value: "{{ $root.Values.controller.jenkinsHome }}/auto-reload/auto-reload-config.yaml" |
| 717 | {{- end }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 718 | |
| 719 | resources: |
| 720 | {{ toYaml $root.Values.controller.sidecars.configAutoReload.resources | indent 4 }} |
| 721 | volumeMounts: |
| 722 | - name: sc-config-volume |
| 723 | mountPath: {{ $root.Values.controller.sidecars.configAutoReload.folder | quote }} |
| 724 | - name: jenkins-home |
| 725 | mountPath: {{ $root.Values.controller.jenkinsHome }} |
| 726 | {{- if $root.Values.persistence.subPath }} |
| 727 | subPath: {{ $root.Values.persistence.subPath }} |
| 728 | {{- end }} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 729 | - name: tmp-volume |
| 730 | mountPath: /tmp |
| 731 | {{- if $root.Values.controller.sidecars.configAutoReload.logging.configuration.override }} |
| 732 | - name: auto-reload-config |
| 733 | mountPath: {{ $root.Values.controller.jenkinsHome }}/auto-reload |
| 734 | - name: auto-reload-config-logs |
| 735 | mountPath: {{ $root.Values.controller.jenkinsHome }}/auto-reload-logs |
| 736 | {{- end }} |
| 737 | {{- if $root.Values.controller.sidecars.configAutoReload.additionalVolumeMounts }} |
| 738 | {{ (tpl (toYaml $root.Values.controller.sidecars.configAutoReload.additionalVolumeMounts) $root) | indent 4 }} |
| 739 | {{- end }} |
| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 740 | |
| 741 | {{- end -}} |
| gio | 20157e8 | 2026-07-22 13:10:48 +0400 | [diff] [blame^] | 742 | |
| 743 | {{- define "controller.replicas" -}} |
| 744 | {{- $replicas := int (default 1 .Values.controller.replicas) -}} |
| 745 | {{- if or (lt $replicas 0) (gt $replicas 1) -}} |
| 746 | {{- fail "controller.replicas must be 0 or 1" -}} |
| 747 | {{- end -}} |
| 748 | {{- .Values.controller.replicas -}} |
| 749 | {{- end -}} |