deployment.yaml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ template "docker-registry.fullname" . }}
  5. namespace: {{ .Values.namespace | default .Release.Namespace }}
  6. labels:
  7. app: {{ template "docker-registry.name" . }}
  8. chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
  9. release: {{ .Release.Name }}
  10. heritage: {{ .Release.Service }}
  11. spec:
  12. selector:
  13. matchLabels:
  14. app: {{ template "docker-registry.name" . }}
  15. release: {{ .Release.Name }}
  16. replicas: {{ .Values.replicaCount }}
  17. {{- if .Values.updateStrategy }}
  18. strategy: {{ toYaml .Values.updateStrategy | nindent 4 }}
  19. {{- end }}
  20. minReadySeconds: 5
  21. template:
  22. metadata:
  23. labels:
  24. app: {{ template "docker-registry.name" . }}
  25. release: {{ .Release.Name }}
  26. {{- with .Values.podLabels }}
  27. {{ toYaml . | nindent 8 }}
  28. {{- end }}
  29. annotations:
  30. checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
  31. checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
  32. {{- if .Values.podAnnotations }}
  33. {{ toYaml .Values.podAnnotations | nindent 8 }}
  34. {{- end }}
  35. spec:
  36. {{- if or (eq .Values.serviceAccount.create true) (ne .Values.serviceAccount.name "") }}
  37. serviceAccountName: {{ .Values.serviceAccount.name | default (include "docker-registry.fullname" .) }}
  38. {{- end }}
  39. {{- if .Values.imagePullSecrets }}
  40. imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 8 }}
  41. {{- end }}
  42. {{- if .Values.priorityClassName }}
  43. priorityClassName: "{{ .Values.priorityClassName }}"
  44. {{- end }}
  45. {{- if .Values.securityContext.enabled }}
  46. securityContext:
  47. fsGroup: {{ .Values.securityContext.fsGroup }}
  48. runAsUser: {{ .Values.securityContext.runAsUser }}
  49. {{- end }}
  50. {{- with .Values.initContainers }}
  51. initContainers:
  52. {{- toYaml . | nindent 8 }}
  53. {{- end }}
  54. containers:
  55. - name: {{ .Chart.Name }}
  56. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  57. imagePullPolicy: {{ .Values.image.pullPolicy }}
  58. command:
  59. - /bin/registry
  60. - serve
  61. - /etc/docker/registry/config.yml
  62. ports:
  63. - containerPort: 5000
  64. {{- if .Values.metrics.enabled }}
  65. - containerPort: {{ (split ":" .Values.configData.http.debug.addr)._1 }}
  66. name: http-metrics
  67. protocol: TCP
  68. {{- end }}
  69. livenessProbe:
  70. httpGet:
  71. {{- if .Values.tlsSecretName }}
  72. scheme: HTTPS
  73. {{- end }}
  74. path: /
  75. port: 5000
  76. readinessProbe:
  77. httpGet:
  78. {{- if .Values.tlsSecretName }}
  79. scheme: HTTPS
  80. {{- end }}
  81. path: /
  82. port: 5000
  83. resources: {{ toYaml .Values.resources | nindent 12 }}
  84. env: {{ include "docker-registry.envs" . | nindent 12 }}
  85. volumeMounts: {{ include "docker-registry.volumeMounts" . | nindent 12 }}
  86. {{- if .Values.nodeSelector }}
  87. nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
  88. {{- end }}
  89. {{- if .Values.affinity }}
  90. affinity: {{ toYaml .Values.affinity | nindent 8 }}
  91. {{- end }}
  92. {{- if .Values.tolerations }}
  93. tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
  94. {{- end }}
  95. volumes: {{ include "docker-registry.volumes" . | nindent 8 }}