Skip to content
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 templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
path: htpasswd
{{- end }}

{{- if eq .Values.storage "filesystem" }}
{{- if (and (eq .Values.storage "filesystem") (not .Values.useStatefulSet)) }}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
Expand Down
5 changes: 5 additions & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if (and (not .Values.useStatefulSet) (or (not .Values.persistence.enabled) (eq .Values.persistence.type "pvc"))) }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -54,6 +55,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
{{- if .Values.extraContainers -}}
{{ toYaml .Values.extraContainers | nindent 8 }}
{{- end }}
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand Down Expand Up @@ -98,3 +102,4 @@ spec:
tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
{{- end }}
volumes: {{ include "docker-registry.volumes" . | nindent 8 }}
{{- end }}
6 changes: 3 additions & 3 deletions templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.persistence.enabled }}
{{- if not .Values.persistence.existingClaim -}}
{{- if (not .Values.useStatefulSet) }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) (eq .Values.persistence.type "pvc")}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand All @@ -24,4 +24,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
{{- end }}
127 changes: 127 additions & 0 deletions templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{{- $sts := list "sts" "StatefulSet" -}}
{{- if (or (.Values.useStatefulSet) (and .Values.persistence.enabled (not .Values.persistence.existingClaim) (has .Values.persistence.type $sts)))}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "docker-registry.fullname" . }}
namespace: {{ .Values.namespace | default .Release.Namespace }}
labels:
app: {{ template "docker-registry.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
selector:
matchLabels:
app: {{ template "docker-registry.name" . }}
release: {{ .Release.Name }}
replicas: {{ .Values.replicaCount }}
serviceName: {{ .Values.service.name }}
{{- if .Values.updateStrategy }}
strategy: {{ toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
minReadySeconds: 5
template:
metadata:
labels:
app: {{ template "docker-registry.name" . }}
release: {{ .Release.Name }}
{{- with .Values.podLabels }}
{{ toYaml . | nindent 8 }}
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | nindent 8 }}
{{- end }}
spec:
{{- if or (eq .Values.serviceAccount.create true) (ne .Values.serviceAccount.name "") }}
serviceAccountName: {{ .Values.serviceAccount.name | default (include "docker-registry.fullname" .) }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 8 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
{{- with .Values.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
{{- if .Values.extraContainers -}}
{{ toYaml .Values.extraContainers | nindent 8 }}
{{- end }}
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /bin/registry
- serve
- /etc/docker/registry/config.yml
ports:
- containerPort: 5000
{{- if .Values.metrics.enabled }}
- containerPort: {{ (split ":" .Values.configData.http.debug.addr)._1 }}
name: http-metrics
protocol: TCP
{{- end }}
livenessProbe:
httpGet:
{{- if .Values.tlsSecretName }}
scheme: HTTPS
{{- end }}
path: /
port: 5000
readinessProbe:
httpGet:
{{- if .Values.tlsSecretName }}
scheme: HTTPS
{{- end }}
path: /
port: 5000
resources: {{ toYaml .Values.resources | nindent 12 }}
env: {{ include "docker-registry.envs" . | nindent 12 }}
volumeMounts: {{ include "docker-registry.volumeMounts" . | nindent 12 }}
{{- if .Values.nodeSelector }}
nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity: {{ toYaml .Values.affinity | nindent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
{{- end }}
volumes: {{ include "docker-registry.volumes" . | nindent 8 }}
{{- if .Values.persistence.enabled}}
volumeClaimTemplates:
- metadata:
# This should match the name defined in the file _helpers.tpl when the
# condition (if eq .Values.storage "filesystem") is met.
name: data
namespace: {{ .Values.namespace | default .Release.Namespace }}
labels:
app: {{ template "docker-registry.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
storageClassName: {{ .Values.persistence.storageClass }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- with .Values.persistence.selectorLabels }}
selector:
matchLabels:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ resources: {}
# cpu: 100m
# memory: 128Mi
persistence:
# Persistence can be achieved either with a PVC or StatefulSet. Default to PVC.
type: pvc
accessMode: 'ReadWriteOnce'
enabled: false
size: 10Gi
# storageClass: '-'
## Name of an existing PVC. Can be templated.
# existingClaim:

# set the type of filesystem to use: filesystem, s3
storage: filesystem
Expand Down Expand Up @@ -245,6 +249,9 @@ initContainers: []
# image: busybox
# command: []

extraContainers: []
# Additional containers to be added

garbageCollect:
enabled: false
deleteUntagged: true
Expand All @@ -262,3 +269,6 @@ garbageCollect:
# requests:
# cpu: 100m
# memory: 128Mi

# Use StatefulSet instead of Deployment. Default uses Deployment.
useStatefulSet: false