deployment.yaml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. {{- with .Values.podAnnotations }}
  27. annotations:
  28. {{- toYaml . | nindent 8 }}
  29. {{- end }}
  30. labels:
  31. {{- include "external-secrets.labels" . | nindent 8 }}
  32. {{- with .Values.podLabels }}
  33. {{- toYaml . | nindent 8 }}
  34. {{- end }}
  35. spec:
  36. {{- with .Values.imagePullSecrets }}
  37. imagePullSecrets:
  38. {{- toYaml . | nindent 8 }}
  39. {{- end }}
  40. serviceAccountName: {{ include "external-secrets.serviceAccountName" . }}
  41. automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
  42. {{- with .Values.podSecurityContext }}
  43. {{- if and (.enabled) (gt (keys . | len) 1) }}
  44. securityContext:
  45. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 8 }}
  46. {{- end }}
  47. {{- end }}
  48. hostNetwork: {{ .Values.hostNetwork }}
  49. containers:
  50. - name: {{ .Chart.Name }}
  51. {{- with .Values.securityContext }}
  52. {{- if and (.enabled) (gt (keys . | len) 1) }}
  53. securityContext:
  54. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 12 }}
  55. {{- end }}
  56. {{- end }}
  57. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.image) | trim }}
  58. imagePullPolicy: {{ .Values.image.pullPolicy }}
  59. {{- if or (.Values.leaderElect) (.Values.scopedNamespace) (.Values.processClusterStore) (.Values.processClusterExternalSecret) (.Values.processClusterPushSecret) (.Values.concurrent) (.Values.extraArgs) }}
  60. args:
  61. {{- if .Values.leaderElect }}
  62. - --enable-leader-election=true
  63. {{- end }}
  64. {{- if .Values.scopedNamespace }}
  65. - --namespace={{ .Values.scopedNamespace }}
  66. {{- end }}
  67. {{- if and .Values.scopedNamespace .Values.scopedRBAC }}
  68. - --enable-cluster-store-reconciler=false
  69. - --enable-cluster-external-secret-reconciler=false
  70. - --enable-cluster-push-secret-reconciler=false
  71. {{- else }}
  72. {{- if not .Values.processClusterStore }}
  73. - --enable-cluster-store-reconciler=false
  74. {{- end }}
  75. {{- if not .Values.processClusterExternalSecret }}
  76. - --enable-cluster-external-secret-reconciler=false
  77. {{- end }}
  78. {{- if not .Values.processClusterPushSecret }}
  79. - --enable-cluster-push-secret-reconciler=false
  80. {{- end }}
  81. {{- end }}
  82. {{- if not .Values.processPushSecret }}
  83. - --enable-push-secret-reconciler=false
  84. {{- end }}
  85. {{- if .Values.controllerClass }}
  86. - --controller-class={{ .Values.controllerClass }}
  87. {{- end }}
  88. {{- if .Values.extendedMetricLabels }}
  89. - --enable-extended-metric-labels={{ .Values.extendedMetricLabels }}
  90. {{- end }}
  91. {{- if .Values.enableHTTP2 }}
  92. - --enable-http2=true
  93. {{- end }}
  94. {{- if .Values.concurrent }}
  95. - --concurrent={{ .Values.concurrent }}
  96. {{- end }}
  97. {{- range $key, $value := .Values.extraArgs }}
  98. {{- if $value }}
  99. - --{{ $key }}={{ $value }}
  100. {{- else }}
  101. - --{{ $key }}
  102. {{- end }}
  103. {{- end }}
  104. {{- end }}
  105. - --metrics-addr=:{{ .Values.metrics.listen.port }}
  106. - --loglevel={{ .Values.log.level }}
  107. - --zap-time-encoding={{ .Values.log.timeEncoding }}
  108. {{- if .Values.livenessProbe.enabled }}
  109. - --live-addr={{ .Values.livenessProbe.spec.address }}:{{ .Values.livenessProbe.spec.httpGet.port }}
  110. {{- end }}
  111. {{- if .Values.metrics.listen.secure.enabled }}
  112. - --metrics-secure=true
  113. - --metrics-cert-dir={{ .Values.metrics.listen.secure.certDir }}
  114. - --metrics-cert-name={{ .Values.metrics.listen.secure.certFile }}
  115. - --metrics-key-name={{ .Values.metrics.listen.secure.keyFile }}
  116. {{- end }}
  117. ports:
  118. - containerPort: {{ .Values.metrics.listen.port }}
  119. protocol: TCP
  120. name: metrics
  121. {{- if .Values.livenessProbe.enabled }}
  122. livenessProbe:
  123. {{- toYaml (omit .Values.livenessProbe.spec "address") | nindent 12 }}
  124. {{- end }}
  125. {{- with .Values.extraEnv }}
  126. env:
  127. {{- toYaml . | nindent 12 }}
  128. {{- end }}
  129. {{- with .Values.resources }}
  130. resources:
  131. {{- toYaml . | nindent 12 }}
  132. {{- end }}
  133. {{- if .Values.extraVolumeMounts }}
  134. volumeMounts:
  135. {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
  136. {{- end }}
  137. {{- if .Values.extraContainers }}
  138. {{ toYaml .Values.extraContainers | nindent 8 }}
  139. {{- end }}
  140. {{- with .Values.extraInitContainers }}
  141. initContainers:
  142. {{- tpl (toYaml . | nindent 8) $ }}
  143. {{- end }}
  144. dnsPolicy: {{ .Values.dnsPolicy }}
  145. {{- if .Values.dnsConfig }}
  146. dnsConfig:
  147. {{- toYaml .Values.dnsConfig | nindent 8 }}
  148. {{- end }}
  149. {{- if .Values.extraVolumes }}
  150. volumes:
  151. {{- toYaml .Values.extraVolumes | nindent 8 }}
  152. {{- end }}
  153. {{- with .Values.nodeSelector | default .Values.global.nodeSelector }}
  154. nodeSelector:
  155. {{- toYaml . | nindent 8 }}
  156. {{- end }}
  157. {{- with .Values.affinity | default .Values.global.affinity }}
  158. affinity:
  159. {{- toYaml . | nindent 8 }}
  160. {{- end }}
  161. {{- with .Values.tolerations | default .Values.global.tolerations }}
  162. tolerations:
  163. {{- toYaml . | nindent 8 }}
  164. {{- end }}
  165. {{- with .Values.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  166. topologySpreadConstraints:
  167. {{- toYaml . | nindent 8 }}
  168. {{- end }}
  169. {{- if .Values.priorityClassName }}
  170. priorityClassName: {{ .Values.priorityClassName }}
  171. {{- end }}
  172. {{- if .Values.podSpecExtra }}
  173. {{- toYaml .Values.podSpecExtra | nindent 6 }}
  174. {{- end }}
  175. {{- end }}