|
1 | 1 | apiVersion: apps/v1 |
2 | 2 | kind: Deployment |
3 | 3 | metadata: |
4 | | -{{- if .Values.buildkit.rootless }} |
| 4 | +{{- if eq .Values.buildkit.mode "rootless" }} |
5 | 5 | annotations: |
6 | 6 | container.apparmor.security.beta.kubernetes.io/buildkitd: unconfined |
7 | 7 | {{- end }} |
|
36 | 36 | component: pro-builder |
37 | 37 | spec: |
38 | 38 | volumes: |
| 39 | + |
| 40 | +{{- if .Values.buildkit.config }} |
| 41 | + - name: buildkit-config |
| 42 | + configMap: |
| 43 | + name: buildkit-config |
| 44 | +{{- end }} |
| 45 | + |
| 46 | +# If given, mount buildkit caSecret as /var/var/run/registry-tls/ |
| 47 | +{{- if .Values.buildkit.caSecret }} |
| 48 | + - name: registry-tls |
| 49 | + secret: |
| 50 | + secretName: {{ .Values.buildkit.caSecret }} |
| 51 | +{{- end }} |
| 52 | + |
39 | 53 | - name: client-certs |
40 | 54 | secret: |
41 | 55 | secretName: buildkit-client-certs |
@@ -146,27 +160,67 @@ spec: |
146 | 160 | - "--tlscert=/var/secrets/certs/server.crt" |
147 | 161 | - "--tlskey=/var/secrets/certs/server.key" |
148 | 162 | - "--tlscacert=/var/secrets/certs/ca.crt" |
149 | | -{{- if .Values.buildkit.rootless }} |
| 163 | +{{- if eq .Values.buildkit.mode "rootless" }} |
150 | 164 | - "--oci-worker-no-process-sandbox" |
| 165 | + - "--config=/home/user/.config/buildkit/buildkitd.toml" |
151 | 166 | {{- end }} |
152 | | - image: {{ .Values.buildkit.image }} |
| 167 | + |
| 168 | +{{- if eq .Values.buildkit.mode "rootless" }} |
| 169 | + image: {{ .Values.buildkit.rootless.image }} |
| 170 | +{{- else }} |
| 171 | + image: {{ .Values.buildkit.root.image }} |
| 172 | +{{- end }} |
| 173 | + |
153 | 174 | imagePullPolicy: {{ .Values.imagePullPolicy | quote }} |
154 | 175 | ports: |
155 | 176 | - containerPort: 1234 |
156 | 177 | protocol: TCP |
157 | 178 | resources: |
158 | 179 | {{- .Values.buildkit.resources | toYaml | nindent 12 }} |
159 | | - {{- with .Values.buildkit.securityContext }} |
| 180 | + |
| 181 | +{{- if eq .Values.buildkit.mode "rootless" }} |
| 182 | + {{- with .Values.buildkit.rootless.securityContext }} |
160 | 183 | securityContext: |
161 | 184 | {{- . | toYaml | nindent 12 }} |
162 | 185 | {{- end }} |
| 186 | +{{- else }} |
| 187 | + {{- with .Values.buildkit.root.securityContext }} |
| 188 | + securityContext: |
| 189 | + {{- . | toYaml | nindent 12 }} |
| 190 | + {{- end }} |
| 191 | +{{- end }} |
| 192 | + |
163 | 193 | volumeMounts: |
164 | 194 | - name: daemon-certs |
165 | 195 | readOnly: true |
166 | 196 | mountPath: /var/secrets/certs |
167 | 197 | - name: buildkit-workspace |
168 | 198 | mountPath: /tmp/ |
169 | 199 | readOnly: false |
| 200 | + |
| 201 | +{{- if .Values.buildkit.config }} |
| 202 | + |
| 203 | +# If rootless, add buildkit-config ConfigMap to: ~/.config/buildkit/buildkitd |
| 204 | +{{- if eq .Values.buildkit.mode "rootless" }} |
| 205 | + - name: buildkit-config |
| 206 | + mountPath: /home/user/.config/buildkit |
| 207 | +{{- else }} |
| 208 | +# If rootful, add buildkit-config ConfigMap to: /etc/buildkit/buildkitd.toml |
| 209 | + - name: buildkit-config |
| 210 | + mountPath: /etc/buildkit |
| 211 | +{{- end }} |
| 212 | +{{- end }} |
| 213 | + |
| 214 | +# If rootless, mount CA to /home/user/.config/buildkit-tls |
| 215 | +{{- if eq .Values.buildkit.mode "rootless" }} |
| 216 | + - name: registry-tls |
| 217 | + mountPath: /home/user/.config/buildkit-tls |
| 218 | +{{- else }} |
| 219 | +# If rootful, mount CA to /var/run/registry-tls/ |
| 220 | + - name: registry-tls |
| 221 | + mountPath: /var/run/registry-tls/ |
| 222 | +{{- end }} |
| 223 | + |
170 | 224 | {{- with .Values.nodeSelector }} |
171 | 225 | nodeSelector: |
172 | 226 | {{- toYaml . | nindent 8 }} |
|
0 commit comments