deployment.yaml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. ports:
  106. - containerPort: {{ .Values.metrics.listen.port }}
  107. protocol: TCP
  108. name: metrics
  109. {{- with .Values.extraEnv }}
  110. env:
  111. {{- toYaml . | nindent 12 }}
  112. {{- end }}
  113. {{- with .Values.resources }}
  114. resources:
  115. {{- toYaml . | nindent 12 }}
  116. {{- end }}
  117. {{- if .Values.extraVolumeMounts }}
  118. volumeMounts:
  119. {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
  120. {{- end }}
  121. {{- if .Values.extraContainers }}
  122. {{ toYaml .Values.extraContainers | nindent 8 }}
  123. {{- end }}
  124. {{- with .Values.extraInitContainers }}
  125. initContainers:
  126. {{- tpl (toYaml . | nindent 8) $ }}
  127. {{- end }}
  128. dnsPolicy: {{ .Values.dnsPolicy }}
  129. {{- if .Values.dnsConfig }}
  130. dnsConfig:
  131. {{- toYaml .Values.dnsConfig | nindent 8 }}
  132. {{- end }}
  133. {{- if .Values.extraVolumes }}
  134. volumes:
  135. {{- toYaml .Values.extraVolumes | nindent 8 }}
  136. {{- end }}
  137. {{- with .Values.nodeSelector | default .Values.global.nodeSelector }}
  138. nodeSelector:
  139. {{- toYaml . | nindent 8 }}
  140. {{- end }}
  141. {{- with .Values.affinity | default .Values.global.affinity }}
  142. affinity:
  143. {{- toYaml . | nindent 8 }}
  144. {{- end }}
  145. {{- with .Values.tolerations | default .Values.global.tolerations }}
  146. tolerations:
  147. {{- toYaml . | nindent 8 }}
  148. {{- end }}
  149. {{- with .Values.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  150. topologySpreadConstraints:
  151. {{- toYaml . | nindent 8 }}
  152. {{- end }}
  153. {{- if .Values.priorityClassName }}
  154. priorityClassName: {{ .Values.priorityClassName }}
  155. {{- end }}
  156. {{- if .Values.podSpecExtra }}
  157. {{- toYaml .Values.podSpecExtra | nindent 6 }}
  158. {{- end }}
  159. {{- end }}