|
| 1 | +# Code generated by skv2. DO NOT EDIT. |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +{{- $painter := $.Values.painter }} |
| 6 | +--- |
| 7 | + |
| 8 | +{{- define "painter.deploymentSpec" }} |
| 9 | +# Deployment manifest for painter |
| 10 | + |
| 11 | +apiVersion: apps/v1 |
| 12 | +kind: Deployment |
| 13 | +metadata: |
| 14 | + labels: |
| 15 | + app: painter |
| 16 | + annotations: |
| 17 | + app.kubernetes.io/name: painter |
| 18 | + name: painter |
| 19 | + namespace: {{ default .Release.Namespace $.Values.painter.namespace }} |
| 20 | +spec: |
| 21 | + selector: |
| 22 | + matchLabels: |
| 23 | + app: painter |
| 24 | + template: |
| 25 | + metadata: |
| 26 | + labels: |
| 27 | + app: painter |
| 28 | + annotations: |
| 29 | + app.kubernetes.io/name: painter |
| 30 | + spec: |
| 31 | + serviceAccountName: painter |
| 32 | + {{- /* Override the default podSecurityContext config if it is set. */}} |
| 33 | +{{- if or ($.Values.painter.podSecurityContext) (eq "map[]" (printf "%v" $.Values.painter.podSecurityContext)) }} |
| 34 | + securityContext: |
| 35 | +{{ toYaml $.Values.painter.podSecurityContext | indent 8 }} |
| 36 | +{{- end }} |
| 37 | + containers: |
| 38 | +{{- $painter := $.Values.painter }} |
| 39 | +{{- $painterImage := $painter.image }} |
| 40 | + - name: painter |
| 41 | + image: {{ $painterImage.registry }}/{{ $painterImage.repository }}:{{ $painterImage.tag }} |
| 42 | + imagePullPolicy: {{ $painterImage.pullPolicy }} |
| 43 | + {{- if or $painter.env $painter.extraEnvs }} |
| 44 | + env: |
| 45 | + {{- end }} |
| 46 | +{{- if $painter.env }} |
| 47 | +{{- toYaml $painter.env | nindent 10 }} |
| 48 | +{{- end }} |
| 49 | +{{- range $name, $item := $painter.extraEnvs }} |
| 50 | + - name: {{ $name }} |
| 51 | + {{- $item | toYaml | nindent 12 }} |
| 52 | +{{- end }} |
| 53 | + resources: |
| 54 | +{{- if $painter.resources }} |
| 55 | +{{ toYaml $painter.resources | indent 10}} |
| 56 | +{{- else}} |
| 57 | + requests: |
| 58 | + cpu: 500m |
| 59 | + memory: 256Mi |
| 60 | +{{- end }} |
| 61 | + {{- /* |
| 62 | + Render securityContext configs if it is set. |
| 63 | + If securityContext is not set, render the default securityContext. |
| 64 | + If securityContext is set to 'false', render an empty map. |
| 65 | + */}} |
| 66 | + securityContext: |
| 67 | +{{- if or ($painter.securityContext) (eq "map[]" (printf "%v" $painter.securityContext)) }} |
| 68 | +{{ toYaml $painter.securityContext | indent 10}} |
| 69 | +{{/* Because securityContext is nil by default we can only perform following conversion if it is a boolean. Skip conditional otherwise. */}} |
| 70 | +{{- else if eq (ternary $painter.securityContext true (eq "bool" (printf "%T" $painter.securityContext))) false }} |
| 71 | + {} |
| 72 | +{{- else}} |
| 73 | + runAsNonRoot: true |
| 74 | + {{- if not $painter.floatingUserId }} |
| 75 | + runAsUser: {{ printf "%.0f" (float64 $painter.runAsUser) }} |
| 76 | + {{- end }} |
| 77 | + readOnlyRootFilesystem: true |
| 78 | + allowPrivilegeEscalation: false |
| 79 | + capabilities: |
| 80 | + drop: |
| 81 | + - ALL |
| 82 | +{{- end }} |
| 83 | +{{- $pullSecrets := (list) -}} |
| 84 | +{{- if $painterImage.pullSecret }} |
| 85 | + {{- $pullSecrets = concat $pullSecrets (list (dict "name" $painterImage.pullSecret)) -}} |
| 86 | +{{- end }} |
| 87 | +{{- if $painter.imagePullSecrets }} |
| 88 | + {{- $pullSecrets = concat $pullSecrets $painter.imagePullSecrets -}} |
| 89 | +{{- end }} |
| 90 | +{{- if gt (len $pullSecrets) 0 -}} |
| 91 | + {{- (dict "imagePullSecrets" $pullSecrets) | toYaml | nindent 6 }} |
| 92 | +{{- end }} |
| 93 | +{{- end }} {{/* define "painter.deploymentSpec" */}} |
| 94 | + |
| 95 | +{{/* Render painter deployment template with overrides from values*/}} |
| 96 | +{{ if $painter.enabled }} |
| 97 | +{{- $painterDeploymentOverrides := dict }} |
| 98 | +{{- if $painter.deploymentOverrides }} |
| 99 | +{{- $painterDeploymentOverrides = $painter.deploymentOverrides }} |
| 100 | +{{- end }} |
| 101 | +--- |
| 102 | +{{ include "skv2.utils.merge" (list . $painterDeploymentOverrides "painter.deploymentSpec") }} |
| 103 | +{{- end }} |
| 104 | +--- |
| 105 | +{{ if $painter.enabled }} |
| 106 | +apiVersion: v1 |
| 107 | +kind: ServiceAccount |
| 108 | +metadata: |
| 109 | + labels: |
| 110 | + app: painter |
| 111 | + {{- if $painter.serviceAccount}} |
| 112 | + {{- if $painter.serviceAccount.extraAnnotations }} |
| 113 | + annotations: |
| 114 | + {{- range $key, $value := $painter.serviceAccount.extraAnnotations }} |
| 115 | + {{ $key }}: {{ $value }} |
| 116 | + {{- end }} |
| 117 | + {{- end }} |
| 118 | + {{- end}} |
| 119 | + name: painter |
| 120 | + namespace: {{ default .Release.Namespace $.Values.painter.namespace }} |
| 121 | +{{- end }} |
| 122 | + |
| 123 | + |
| 124 | +{{- define "painter.serviceSpec"}} |
| 125 | + |
| 126 | +{{- end }} {{/* define "painter.serviceSpec" */}} |
| 127 | +{{ if $painter.enabled }} |
| 128 | +{{/* Render painter service template with overrides from values*/}} |
| 129 | +{{- $painterServiceOverrides := dict }} |
| 130 | +{{- if $painter.serviceOverrides }} |
| 131 | +{{- $painterServiceOverrides = $painter.serviceOverrides }} |
| 132 | +{{- end }} |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +{{ include "skv2.utils.merge" (list . $painterServiceOverrides "painter.serviceSpec") }} |
| 137 | +{{- end }} |
| 138 | + |
0 commit comments