deployment.yaml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. {{- if .Values.createOperator }}
  2. {{- include "external-secrets.reconciler-sanity-test" . }}
  3. apiVersion: apps/v1
  4. kind: Deployment
  5. metadata:
  6. name: {{ include "external-secrets.fullname" . }}
  7. namespace: {{ template "external-secrets.namespace" . }}
  8. labels:
  9. {{- include "external-secrets.labels" . | nindent 4 }}
  10. {{- with .Values.deploymentAnnotations }}
  11. annotations:
  12. {{- toYaml . | nindent 4 }}
  13. {{- end }}
  14. spec:
  15. replicas: {{ .Values.replicaCount }}
  16. revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
  17. selector:
  18. matchLabels:
  19. {{- include "external-secrets.selectorLabels" . | nindent 6 }}
  20. {{- with .Values.strategy }}
  21. strategy:
  22. {{- toYaml . | nindent 4 }}
  23. {{- end }}
  24. template:
  25. metadata:
  26. {{- if .Values.podAnnotations }}
  27. annotations:
  28. {{- toYaml .Values.podAnnotations | nindent 8 }}
  29. {{- else if .Values.global.podAnnotations }}
  30. annotations:
  31. {{- toYaml .Values.global.podAnnotations | nindent 8 }}
  32. {{- end }}
  33. labels:
  34. {{- include "external-secrets.labels" . | nindent 8 }}
  35. {{- if .Values.podLabels }}
  36. {{- toYaml .Values.podLabels | nindent 8 }}
  37. {{- else if .Values.global.podLabels }}
  38. {{- toYaml .Values.global.podLabels | nindent 8 }}
  39. {{- end }}
  40. spec:
  41. {{- if .Values.imagePullSecrets }}
  42. imagePullSecrets:
  43. {{- toYaml .Values.imagePullSecrets | nindent 8 }}
  44. {{- else if .Values.global.imagePullSecrets }}
  45. imagePullSecrets:
  46. {{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
  47. {{- end }}
  48. serviceAccountName: {{ include "external-secrets.serviceAccountName" . }}
  49. automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
  50. {{- with .Values.podSecurityContext }}
  51. {{- if and (.enabled) (gt (keys . | len) 1) }}
  52. securityContext:
  53. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 8 }}
  54. {{- end }}
  55. {{- end }}
  56. hostNetwork: {{ .Values.hostNetwork }}
  57. containers:
  58. - name: {{ .Chart.Name }}
  59. {{- with .Values.securityContext }}
  60. {{- if and (.enabled) (gt (keys . | len) 1) }}
  61. securityContext:
  62. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 12 }}
  63. {{- end }}
  64. {{- end }}
  65. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.image "context" .) | trim }}
  66. imagePullPolicy: {{ .Values.image.pullPolicy }}
  67. {{- if or (.Values.leaderElect) (.Values.scopedNamespace) (.Values.processClusterStore) (.Values.processClusterExternalSecret) (.Values.processClusterPushSecret) (.Values.concurrent) (.Values.extraArgs) }}
  68. args:
  69. {{- if .Values.leaderElect }}
  70. - --enable-leader-election=true
  71. {{- end }}
  72. {{- if .Values.scopedNamespace }}
  73. - --namespace={{ .Values.scopedNamespace }}
  74. {{- end }}
  75. {{- if and .Values.scopedNamespace .Values.scopedRBAC }}
  76. - --enable-cluster-store-reconciler=false
  77. - --enable-cluster-external-secret-reconciler=false
  78. - --enable-cluster-push-secret-reconciler=false
  79. {{- else }}
  80. {{- if not .Values.processClusterStore }}
  81. - --enable-cluster-store-reconciler=false
  82. {{- end }}
  83. {{- if not .Values.processClusterExternalSecret }}
  84. - --enable-cluster-external-secret-reconciler=false
  85. {{- end }}
  86. {{- if not .Values.processClusterPushSecret }}
  87. - --enable-cluster-push-secret-reconciler=false
  88. {{- end }}
  89. {{- end }}
  90. {{- if not .Values.processPushSecret }}
  91. - --enable-push-secret-reconciler=false
  92. {{- end }}
  93. {{- if not .Values.processSecretStore }}
  94. - --enable-secret-store-reconciler=false
  95. {{- end }}
  96. {{- if .Values.controllerClass }}
  97. - --controller-class={{ .Values.controllerClass }}
  98. {{- end }}
  99. {{- if .Values.extendedMetricLabels }}
  100. - --enable-extended-metric-labels={{ .Values.extendedMetricLabels }}
  101. {{- end }}
  102. {{- if .Values.enableHTTP2 }}
  103. - --enable-http2=true
  104. {{- end }}
  105. {{- if .Values.concurrent }}
  106. - --concurrent={{ .Values.concurrent }}
  107. {{- end }}
  108. {{- if .Values.genericTargets.enabled }}
  109. - --unsafe-allow-generic-targets=true
  110. {{- end }}
  111. {{- range $key, $value := .Values.extraArgs }}
  112. {{- if $value }}
  113. - --{{ $key }}={{ $value }}
  114. {{- else }}
  115. - --{{ $key }}
  116. {{- end }}
  117. {{- end }}
  118. {{- end }}
  119. - --metrics-addr=:{{ .Values.metrics.listen.port }}
  120. - --loglevel={{ .Values.log.level }}
  121. - --zap-time-encoding={{ .Values.log.timeEncoding }}
  122. {{- if .Values.livenessProbe.enabled }}
  123. - --live-addr={{ .Values.livenessProbe.spec.address }}:{{ .Values.livenessProbe.spec.httpGet.port }}
  124. {{- end }}
  125. {{- if .Values.metrics.listen.secure.enabled }}
  126. - --metrics-secure=true
  127. - --metrics-cert-dir={{ .Values.metrics.listen.secure.certDir }}
  128. - --metrics-cert-name={{ .Values.metrics.listen.secure.certFile }}
  129. - --metrics-key-name={{ .Values.metrics.listen.secure.keyFile }}
  130. {{- end }}
  131. ports:
  132. - containerPort: {{ .Values.metrics.listen.port }}
  133. protocol: TCP
  134. name: metrics
  135. {{- if .Values.livenessProbe.enabled }}
  136. livenessProbe:
  137. {{- toYaml (omit .Values.livenessProbe.spec "address") | nindent 12 }}
  138. {{- end }}
  139. {{- with .Values.extraEnv }}
  140. env:
  141. {{- toYaml . | nindent 12 }}
  142. {{- end }}
  143. {{- with .Values.resources }}
  144. resources:
  145. {{- toYaml . | nindent 12 }}
  146. {{- end }}
  147. {{- if .Values.extraVolumeMounts }}
  148. volumeMounts:
  149. {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
  150. {{- end }}
  151. {{- if .Values.extraContainers }}
  152. {{ toYaml .Values.extraContainers | nindent 8 }}
  153. {{- end }}
  154. {{- with .Values.extraInitContainers }}
  155. initContainers:
  156. {{- tpl (toYaml . | nindent 8) $ }}
  157. {{- end }}
  158. dnsPolicy: {{ .Values.dnsPolicy }}
  159. {{- if .Values.dnsConfig }}
  160. dnsConfig:
  161. {{- toYaml .Values.dnsConfig | nindent 8 }}
  162. {{- end }}
  163. {{- if .Values.extraVolumes }}
  164. volumes:
  165. {{- toYaml .Values.extraVolumes | nindent 8 }}
  166. {{- end }}
  167. {{- with .Values.nodeSelector | default .Values.global.nodeSelector }}
  168. nodeSelector:
  169. {{- toYaml . | nindent 8 }}
  170. {{- end }}
  171. {{- with .Values.affinity | default .Values.global.affinity }}
  172. affinity:
  173. {{- toYaml . | nindent 8 }}
  174. {{- end }}
  175. {{- with .Values.tolerations | default .Values.global.tolerations }}
  176. tolerations:
  177. {{- toYaml . | nindent 8 }}
  178. {{- end }}
  179. {{- with .Values.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  180. topologySpreadConstraints:
  181. {{- range $constraint := . }}
  182. - {{ toYaml $constraint | nindent 10 | trim }}
  183. {{- if not $constraint.labelSelector }}
  184. labelSelector:
  185. matchLabels:
  186. {{- include "external-secrets.selectorLabels" $ | nindent 14 }}
  187. {{- end }}
  188. {{- end }}
  189. {{- end }}
  190. {{- if .Values.priorityClassName }}
  191. priorityClassName: {{ .Values.priorityClassName }}
  192. {{- end }}
  193. {{- if .Values.podSpecExtra }}
  194. {{- toYaml .Values.podSpecExtra | nindent 6 }}
  195. {{- end }}
  196. {{- end }}