deployment.yaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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.concurrent }}
  92. - --concurrent={{ .Values.concurrent }}
  93. {{- end }}
  94. {{- range $key, $value := .Values.extraArgs }}
  95. {{- if $value }}
  96. - --{{ $key }}={{ $value }}
  97. {{- else }}
  98. - --{{ $key }}
  99. {{- end }}
  100. {{- end }}
  101. {{- end }}
  102. - --metrics-addr=:{{ .Values.metrics.listen.port }}
  103. - --loglevel={{ .Values.log.level }}
  104. - --zap-time-encoding={{ .Values.log.timeEncoding }}
  105. {{- if .Values.livenessProbe.enabled }}
  106. - --live-addr={{ .Values.livenessProbe.address }}:{{ .Values.livenessProbe.httpGet.port }}
  107. {{- end }}
  108. ports:
  109. - containerPort: {{ .Values.metrics.listen.port }}
  110. protocol: TCP
  111. name: metrics
  112. {{- if .Values.livenessProbe.enabled }}
  113. livenessProbe:
  114. {{- toYaml .Values.livenessProbe | nindent 12 }}
  115. {{- end }}
  116. {{- with .Values.extraEnv }}
  117. env:
  118. {{- toYaml . | nindent 12 }}
  119. {{- end }}
  120. {{- with .Values.resources }}
  121. resources:
  122. {{- toYaml . | nindent 12 }}
  123. {{- end }}
  124. {{- if .Values.extraVolumeMounts }}
  125. volumeMounts:
  126. {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
  127. {{- end }}
  128. {{- if .Values.extraContainers }}
  129. {{ toYaml .Values.extraContainers | nindent 8 }}
  130. {{- end }}
  131. {{- with .Values.extraInitContainers }}
  132. initContainers:
  133. {{- tpl (toYaml . | nindent 8) $ }}
  134. {{- end }}
  135. dnsPolicy: {{ .Values.dnsPolicy }}
  136. {{- if .Values.dnsConfig }}
  137. dnsConfig:
  138. {{- toYaml .Values.dnsConfig | nindent 8 }}
  139. {{- end }}
  140. {{- if .Values.extraVolumes }}
  141. volumes:
  142. {{- toYaml .Values.extraVolumes | nindent 8 }}
  143. {{- end }}
  144. {{- with .Values.nodeSelector | default .Values.global.nodeSelector }}
  145. nodeSelector:
  146. {{- toYaml . | nindent 8 }}
  147. {{- end }}
  148. {{- with .Values.affinity | default .Values.global.affinity }}
  149. affinity:
  150. {{- toYaml . | nindent 8 }}
  151. {{- end }}
  152. {{- with .Values.tolerations | default .Values.global.tolerations }}
  153. tolerations:
  154. {{- toYaml . | nindent 8 }}
  155. {{- end }}
  156. {{- with .Values.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  157. topologySpreadConstraints:
  158. {{- toYaml . | nindent 8 }}
  159. {{- end }}
  160. {{- if .Values.priorityClassName }}
  161. priorityClassName: {{ .Values.priorityClassName }}
  162. {{- end }}
  163. {{- if .Values.podSpecExtra }}
  164. {{- toYaml .Values.podSpecExtra | nindent 6 }}
  165. {{- end }}
  166. {{- end }}