config/static-pods/master/docker-registries-mirror.yaml

42 lines
1.3 KiB
YAML
Raw Permalink Normal View History

2023-05-15 14:36:48 +00:00
{{- if .vars.docker_registries_mirror_cache.enable }}
{{- $cache_port := .vars.docker_registries_mirror_cache.port }}
apiVersion: v1
kind: Pod
metadata:
namespace: kube-system
name: docker-registries-mirror
annotations:
novit.io/bootstrap-prio: "100"
labels:
app: docker-registries-mirror
spec:
hostNetwork: true
dnsPolicy: Default
priorityClassName: system-node-critical
containers:
- name: docker-registries-mirror
image: mcluseau/docker-registries-mirror
command:
- ash
- -c
- |
ALL_HOSTS="{{ if .vars.docker_registries_mirror_cache.remote }}{{ .vars.docker_registries_mirror_cache.remote}}{{ end }}{{ range $i, $host := hosts_by_group "master" }} http://{{$host.ip}}:{{ $cache_port }}{{end}}" \
CURRENT_HOST="http://{{ .host.ip }}:{{ $cache_port }}" \
OTHER_HOSTS="$(echo ${ALL_HOSTS/${CURRENT_HOST}/})" \
sh -c '/bin/docker-registries-mirror -addr=:{{ $cache_port }} -cache-mib={{ .vars.docker_registries_mirror_cache.mb }} -peers=${OTHER_HOSTS/ /,}'
{{- if .vars.proxy }}
env:
- name: HTTP_PROXY
value: {{ .vars.proxy }}
- name: HTTPS_PROXY
value: {{ .vars.proxy }}
{{ end }}
volumeMounts:
- name: cache
mountPath: "/cache"
volumes:
- name: cache
hostPath:
path: /var/lib/containerd/cache
{{ end }}