deployment.yaml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. {{- if (semverCompare ">= 1.33-0" .Capabilities.KubeVersion.Version) }}
  51. {{- if kindIs "bool" .Values.hostUsers }}
  52. hostUsers: {{ .Values.hostUsers }}
  53. {{- end }}
  54. {{- end }}
  55. {{- with .Values.podSecurityContext }}
  56. {{- if and (.enabled) (gt (keys . | len) 1) }}
  57. securityContext:
  58. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 8 }}
  59. {{- end }}
  60. {{- end }}
  61. hostNetwork: {{ .Values.hostNetwork }}
  62. containers:
  63. - name: {{ .Chart.Name }}
  64. {{- with .Values.securityContext }}
  65. {{- if and (.enabled) (gt (keys . | len) 1) }}
  66. securityContext:
  67. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 12 }}
  68. {{- end }}
  69. {{- end }}
  70. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.image "context" .) | trim }}
  71. imagePullPolicy: {{ .Values.image.pullPolicy }}
  72. args:
  73. {{- if .Values.leaderElect }}
  74. - --enable-leader-election=true
  75. {{- end }}
  76. {{- if .Values.leaderElectionID }}
  77. - --leader-election-id={{ .Values.leaderElectionID }}
  78. {{- end }}
  79. {{- if or .Values.scopedNamespace .Values.scopedRBAC }}
  80. - --namespace={{ .Values.scopedNamespace | default .Release.Namespace }}
  81. {{- end }}
  82. {{- if .Values.scopedRBAC }}
  83. - --enable-cluster-store-reconciler=false
  84. - --enable-cluster-external-secret-reconciler=false
  85. - --enable-cluster-push-secret-reconciler=false
  86. {{- else }}
  87. {{- if not .Values.processClusterStore }}
  88. - --enable-cluster-store-reconciler=false
  89. {{- end }}
  90. {{- if not .Values.processClusterExternalSecret }}
  91. - --enable-cluster-external-secret-reconciler=false
  92. {{- end }}
  93. {{- if not .Values.processClusterPushSecret }}
  94. - --enable-cluster-push-secret-reconciler=false
  95. {{- end }}
  96. {{- end }}
  97. {{- if not .Values.processPushSecret }}
  98. - --enable-push-secret-reconciler=false
  99. {{- end }}
  100. {{- if not .Values.processSecretStore }}
  101. - --enable-secret-store-reconciler=false
  102. {{- end }}
  103. {{- if .Values.storeRequeueInterval }}
  104. - --store-requeue-interval={{ .Values.storeRequeueInterval }}
  105. {{- end }}
  106. {{- if .Values.controllerClass }}
  107. - --controller-class={{ .Values.controllerClass }}
  108. {{- end }}
  109. {{- if .Values.extendedMetricLabels }}
  110. - --enable-extended-metric-labels={{ .Values.extendedMetricLabels }}
  111. {{- end }}
  112. {{- if .Values.enableHTTP2 }}
  113. - --enable-http2=true
  114. {{- end }}
  115. {{- if .Values.vault.enableTokenCache }}
  116. - --enable-vault-token-cache=true
  117. {{- end }}
  118. {{- if and .Values.vault.enableTokenCache .Values.vault.tokenCacheSize }}
  119. - --vault-token-cache-size={{ .Values.vault.tokenCacheSize }}
  120. {{- end }}
  121. {{- if .Values.concurrent }}
  122. - --concurrent={{ .Values.concurrent }}
  123. {{- end }}
  124. {{- if .Values.genericTargets.enabled }}
  125. - --unsafe-allow-generic-targets=true
  126. {{- end }}
  127. {{- range $key, $value := .Values.extraArgs }}
  128. {{- if $value }}
  129. - --{{ $key }}={{ $value }}
  130. {{- else }}
  131. - --{{ $key }}
  132. {{- end }}
  133. {{- end }}
  134. - --metrics-addr=:{{ .Values.metrics.listen.port }}
  135. - --loglevel={{ .Values.log.level }}
  136. - --zap-time-encoding={{ .Values.log.timeEncoding }}
  137. {{- if or .Values.livenessProbe.enabled .Values.readinessProbe.enabled }}
  138. {{- if eq (kindOf .Values.livenessProbe.spec.httpGet.port) "string" }}
  139. - --live-addr={{ .Values.livenessProbe.spec.address }}:{{ .Values.livenessProbe.spec.port }}
  140. {{- else }}
  141. - --live-addr={{ .Values.livenessProbe.spec.address }}:{{ .Values.livenessProbe.spec.httpGet.port }}
  142. {{- end }}
  143. {{- end }}
  144. {{- if .Values.metrics.listen.secure.enabled }}
  145. - --metrics-secure=true
  146. - --metrics-cert-dir={{ .Values.metrics.listen.secure.certDir }}
  147. - --metrics-cert-name={{ .Values.metrics.listen.secure.certFile }}
  148. - --metrics-key-name={{ .Values.metrics.listen.secure.keyFile }}
  149. {{- end }}
  150. {{- if .Values.metrics.listen.auth.enabled }}
  151. - --metrics-auth=true
  152. {{- end }}
  153. ports:
  154. - containerPort: {{ .Values.metrics.listen.port }}
  155. protocol: TCP
  156. name: metrics
  157. {{- if or .Values.livenessProbe.enabled .Values.readinessProbe.enabled }}
  158. - name: live
  159. protocol: TCP
  160. {{- if eq (kindOf .Values.livenessProbe.spec.httpGet.port) "string" }}
  161. containerPort: {{ .Values.livenessProbe.spec.port }}
  162. {{- else }}
  163. containerPort: {{ .Values.livenessProbe.spec.httpGet.port }}
  164. {{- end }}
  165. {{- end }}
  166. {{- if .Values.livenessProbe.enabled }}
  167. livenessProbe:
  168. {{- toYaml (omit .Values.livenessProbe.spec "address" "port") | nindent 12 }}
  169. {{- end }}
  170. {{- if .Values.readinessProbe.enabled }}
  171. readinessProbe:
  172. {{- toYaml .Values.readinessProbe.spec | nindent 12 }}
  173. {{- end }}
  174. {{- with .Values.extraEnv }}
  175. env:
  176. {{- toYaml . | nindent 12 }}
  177. {{- end }}
  178. {{- with .Values.resources }}
  179. resources:
  180. {{- toYaml . | nindent 12 }}
  181. {{- end }}
  182. {{- if .Values.extraVolumeMounts }}
  183. volumeMounts:
  184. {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
  185. {{- end }}
  186. {{- if .Values.extraContainers }}
  187. {{ toYaml .Values.extraContainers | nindent 8 }}
  188. {{- end }}
  189. {{- with .Values.extraInitContainers }}
  190. initContainers:
  191. {{- tpl (toYaml . | nindent 8) $ }}
  192. {{- end }}
  193. dnsPolicy: {{ .Values.dnsPolicy }}
  194. {{- if .Values.dnsConfig }}
  195. dnsConfig:
  196. {{- toYaml .Values.dnsConfig | nindent 8 }}
  197. {{- end }}
  198. {{- with .Values.hostAliases | default .Values.global.hostAliases }}
  199. hostAliases:
  200. {{- toYaml . | nindent 8 }}
  201. {{- end }}
  202. {{- if .Values.extraVolumes }}
  203. volumes:
  204. {{- toYaml .Values.extraVolumes | nindent 8 }}
  205. {{- end }}
  206. {{- with .Values.nodeSelector | default .Values.global.nodeSelector }}
  207. nodeSelector:
  208. {{- toYaml . | nindent 8 }}
  209. {{- end }}
  210. {{- with .Values.affinity | default .Values.global.affinity }}
  211. affinity:
  212. {{- toYaml . | nindent 8 }}
  213. {{- end }}
  214. {{- with .Values.tolerations | default .Values.global.tolerations }}
  215. tolerations:
  216. {{- toYaml . | nindent 8 }}
  217. {{- end }}
  218. {{- with .Values.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  219. topologySpreadConstraints:
  220. {{- range $constraint := . }}
  221. - {{ toYaml $constraint | nindent 10 | trim }}
  222. {{- if not $constraint.labelSelector }}
  223. labelSelector:
  224. matchLabels:
  225. {{- include "external-secrets.selectorLabels" $ | nindent 14 }}
  226. {{- end }}
  227. {{- end }}
  228. {{- end }}
  229. {{- if .Values.priorityClassName }}
  230. priorityClassName: {{ .Values.priorityClassName }}
  231. {{- end }}
  232. {{- if .Values.podSpecExtra }}
  233. {{- toYaml .Values.podSpecExtra | nindent 6 }}
  234. {{- end }}
  235. {{- end }}