Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(buildkitd): specify per-registry configuration e.g. caCert, insecure, mirrors #566

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/buildkitd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Helm chart for https://github.com/moby/buildkit (rootless)
type: application
appVersion: 0.17.0
kubeVersion: ">=1.19.0-0"
version: 0.18.0
version: 0.18.1
maintainers:
- name: Wiremind
url: https://github.com/wiremind/wiremind-helm-charts
35 changes: 35 additions & 0 deletions charts/buildkitd/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ data:
# maxEntries is the maximum number of history entries to keep.
maxEntries = {{ .Values.config.history.maxEntries }}

{{- if eq "slice" (kindOf .Values.config.registries) }}
{{- range .Values.config.registries }}
[registry."{{ .host }}"]
{{- if eq "bool" (kindOf .http) }}
http = {{ .http }}
{{- end }}
{{- if eq "bool" (kindOf .insecure) }}
insecure = {{ .insecure }}
{{- end }}
{{- if eq "slice" (kindOf .mirrors) }}
mirrors = {{ toJson .mirrors }}
{{- end }}
ca = ["/etc/ssl/private/{{ replace ":" "-" .host }}.crt"]

{{- end }}
{{- end }}


---

# See https://github.com/moby/buildkit/blob/master/Dockerfile
Expand Down Expand Up @@ -119,3 +137,20 @@ data:
OTEL_EXPORTER_OTLP_INSECURE: {{ .Values.config.otel.common.insecure | quote }}
OTEL_EXPORTER_OTLP_TRACES_INSECURE: {{ .Values.config.otel.traces.insecure | quote }}
OTEL_EXPORTER_OTLP_METRICS_INSECURE: {{ .Values.config.otel.metrics.insecure | quote }}
{{- if eq "slice" (kindOf .Values.config.registries) }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "buildkitd.fullname" . }}-registry-ca-certs
labels:
app: {{ template "buildkitd.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
{{- range .Values.config.registries }}
"{{ replace ":" "-" .host }}.crt":
{{ toYaml .caCert | nindent 4 }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/buildkitd/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ spec:
emptyDir:
medium: Memory
sizeLimit: 1Gi
{{- if eq "slice" (kindOf .Values.config.registries) }}
- name: registry-certs
configMap:
defaultMode: 420
name: {{ include "buildkitd.fullname" . }}-registry-ca-certs
{{- end }}
containers:
- name: buildkitd
image: {{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "v%s-rootless" .Chart.AppVersion) }}
Expand All @@ -53,6 +59,10 @@ spec:
mountPath: /home/{{ .Values.user.name }}/.config/buildkit
- name: runtime-dir
mountPath: /run/{{ .Values.user.name }}/{{ .Values.user.uid }}
{{- if eq "slice" (kindOf .Values.config.registries) }}
- name: registry-certs
mountPath: /etc/ssl/private
{{- end }}
args:
{{- with .Values.extraArgs }}
{{- toYaml . | nindent 12 }}
Expand Down
9 changes: 9 additions & 0 deletions charts/buildkitd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ config:
history:
maxAge: 172800
maxEntries: 50
registries:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put an empty list by default please

# - host: my-registry.com:5000
# insecure: false
# http: false # use https only
# mirrors:
# - mirror1.com
# - mirror2.net
# caCert: |-
# ...CA cert goes here...

livenessProbe:
initialDelaySeconds: 5
Expand Down