deployment.yaml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. {{- if or (.Values.leaderElect) (.Values.scopedNamespace) (.Values.processClusterStore) (.Values.processClusterExternalSecret) (.Values.processClusterPushSecret) (.Values.concurrent) (.Values.extraArgs) }}
  73. args:
  74. {{- if .Values.leaderElect }}
  75. - --enable-leader-election=true
  76. {{- end }}
  77. {{- if .Values.scopedNamespace }}
  78. - --namespace={{ .Values.scopedNamespace }}
  79. {{- end }}
  80. {{- if and .Values.scopedNamespace .Values.scopedRBAC }}
  81. - --enable-cluster-store-reconciler=false
  82. - --enable-cluster-external-secret-reconciler=false
  83. - --enable-cluster-push-secret-reconciler=false
  84. {{- else }}
  85. {{- if not .Values.processClusterStore }}
  86. - --enable-cluster-store-reconciler=false
  87. {{- end }}
  88. {{- if not .Values.processClusterExternalSecret }}
  89. - --enable-cluster-external-secret-reconciler=false
  90. {{- end }}
  91. {{- if not .Values.processClusterPushSecret }}
  92. - --enable-cluster-push-secret-reconciler=false
  93. {{- end }}
  94. {{- end }}
  95. {{- if not .Values.processPushSecret }}
  96. - --enable-push-secret-reconciler=false
  97. {{- end }}
  98. {{- if not .Values.processSecretStore }}
  99. - --enable-secret-store-reconciler=false
  100. {{- end }}
  101. {{- if .Values.controllerClass }}
  102. - --controller-class={{ .Values.controllerClass }}
  103. {{- end }}
  104. {{- if .Values.extendedMetricLabels }}
  105. - --enable-extended-metric-labels={{ .Values.extendedMetricLabels }}
  106. {{- end }}
  107. {{- if .Values.enableHTTP2 }}
  108. - --enable-http2=true
  109. {{- end }}
  110. {{- if .Values.concurrent }}
  111. - --concurrent={{ .Values.concurrent }}
  112. {{- end }}
  113. {{- if .Values.genericTargets.enabled }}
  114. - --unsafe-allow-generic-targets=true
  115. {{- end }}
  116. {{- range $key, $value := .Values.extraArgs }}
  117. {{- if $value }}
  118. - --{{ $key }}={{ $value }}
  119. {{- else }}
  120. - --{{ $key }}
  121. {{- end }}
  122. {{- end }}
  123. {{- end }}
  124. - --metrics-addr=:{{ .Values.metrics.listen.port }}
  125. - --loglevel={{ .Values.log.level }}
  126. - --zap-time-encoding={{ .Values.log.timeEncoding }}
  127. {{- if .Values.livenessProbe.enabled }}
  128. {{- if eq (kindOf .Values.livenessProbe.spec.httpGet.port) "string" }}
  129. - --live-addr={{ .Values.livenessProbe.spec.address }}:{{ .Values.livenessProbe.spec.port }}
  130. {{- else }}
  131. - --live-addr={{ .Values.livenessProbe.spec.address }}:{{ .Values.livenessProbe.spec.httpGet.port }}
  132. {{- end }}
  133. {{- end }}
  134. {{- if .Values.metrics.listen.secure.enabled }}
  135. - --metrics-secure=true
  136. - --metrics-cert-dir={{ .Values.metrics.listen.secure.certDir }}
  137. - --metrics-cert-name={{ .Values.metrics.listen.secure.certFile }}
  138. - --metrics-key-name={{ .Values.metrics.listen.secure.keyFile }}
  139. {{- end }}
  140. ports:
  141. - containerPort: {{ .Values.metrics.listen.port }}
  142. protocol: TCP
  143. name: metrics
  144. {{- if .Values.livenessProbe.enabled }}
  145. - name: live
  146. protocol: TCP
  147. {{- if eq (kindOf .Values.livenessProbe.spec.httpGet.port) "string" }}
  148. containerPort: {{ .Values.livenessProbe.spec.port }}
  149. {{- else }}
  150. containerPort: {{ .Values.livenessProbe.spec.httpGet.port }}
  151. {{- end }}
  152. {{- end }}
  153. {{- if .Values.livenessProbe.enabled }}
  154. livenessProbe:
  155. {{- toYaml (omit .Values.livenessProbe.spec "address" "port") | nindent 12 }}
  156. {{- end }}
  157. {{- with .Values.extraEnv }}
  158. env:
  159. {{- toYaml . | nindent 12 }}
  160. {{- end }}
  161. {{- with .Values.resources }}
  162. resources:
  163. {{- toYaml . | nindent 12 }}
  164. {{- end }}
  165. {{- if .Values.extraVolumeMounts }}
  166. volumeMounts:
  167. {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
  168. {{- end }}
  169. {{- if .Values.extraContainers }}
  170. {{ toYaml .Values.extraContainers | nindent 8 }}
  171. {{- end }}
  172. {{- with .Values.extraInitContainers }}
  173. initContainers:
  174. {{- tpl (toYaml . | nindent 8) $ }}
  175. {{- end }}
  176. dnsPolicy: {{ .Values.dnsPolicy }}
  177. {{- if .Values.dnsConfig }}
  178. dnsConfig:
  179. {{- toYaml .Values.dnsConfig | nindent 8 }}
  180. {{- end }}
  181. {{- with .Values.hostAliases | default .Values.global.hostAliases }}
  182. hostAliases:
  183. {{- toYaml . | nindent 8 }}
  184. {{- end }}
  185. {{- if .Values.extraVolumes }}
  186. volumes:
  187. {{- toYaml .Values.extraVolumes | nindent 8 }}
  188. {{- end }}
  189. {{- with .Values.nodeSelector | default .Values.global.nodeSelector }}
  190. nodeSelector:
  191. {{- toYaml . | nindent 8 }}
  192. {{- end }}
  193. {{- with .Values.affinity | default .Values.global.affinity }}
  194. affinity:
  195. {{- toYaml . | nindent 8 }}
  196. {{- end }}
  197. {{- with .Values.tolerations | default .Values.global.tolerations }}
  198. tolerations:
  199. {{- toYaml . | nindent 8 }}
  200. {{- end }}
  201. {{- with .Values.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  202. topologySpreadConstraints:
  203. {{- range $constraint := . }}
  204. - {{ toYaml $constraint | nindent 10 | trim }}
  205. {{- if not $constraint.labelSelector }}
  206. labelSelector:
  207. matchLabels:
  208. {{- include "external-secrets.selectorLabels" $ | nindent 14 }}
  209. {{- end }}
  210. {{- end }}
  211. {{- end }}
  212. {{- if .Values.priorityClassName }}
  213. priorityClassName: {{ .Values.priorityClassName }}
  214. {{- end }}
  215. {{- if .Values.podSpecExtra }}
  216. {{- toYaml .Values.podSpecExtra | nindent 6 }}
  217. {{- end }}
  218. {{- end }}