deployment.yaml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {{- if .Values.createOperator }}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ include "external-secrets.fullname" . }}
  6. namespace: {{ template "external-secrets.namespace" . }}
  7. labels:
  8. {{- include "external-secrets.labels" . | nindent 4 }}
  9. {{- with .Values.deploymentAnnotations }}
  10. annotations:
  11. {{- toYaml . | nindent 4 }}
  12. {{- end }}
  13. spec:
  14. replicas: {{ .Values.replicaCount }}
  15. revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
  16. selector:
  17. matchLabels:
  18. {{- include "external-secrets.selectorLabels" . | nindent 6 }}
  19. template:
  20. metadata:
  21. {{- with .Values.podAnnotations }}
  22. annotations:
  23. {{- toYaml . | nindent 8 }}
  24. {{- end }}
  25. labels:
  26. {{- include "external-secrets.labels" . | nindent 8 }}
  27. {{- with .Values.podLabels }}
  28. {{- toYaml . | nindent 8 }}
  29. {{- end }}
  30. spec:
  31. {{- with .Values.imagePullSecrets }}
  32. imagePullSecrets:
  33. {{- toYaml . | nindent 8 }}
  34. {{- end }}
  35. serviceAccountName: {{ include "external-secrets.serviceAccountName" . }}
  36. automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
  37. {{- with .Values.podSecurityContext }}
  38. {{- if and (.enabled) (gt (keys . | len) 1) }}
  39. securityContext:
  40. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 8 }}
  41. {{- end }}
  42. {{- end }}
  43. hostNetwork: {{ .Values.hostNetwork }}
  44. containers:
  45. - name: {{ .Chart.Name }}
  46. {{- with .Values.securityContext }}
  47. {{- if and (.enabled) (gt (keys . | len) 1) }}
  48. securityContext:
  49. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 12 }}
  50. {{- end }}
  51. {{- end }}
  52. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.image) | trim }}
  53. imagePullPolicy: {{ .Values.image.pullPolicy }}
  54. {{- if or (.Values.leaderElect) (.Values.scopedNamespace) (.Values.processClusterStore) (.Values.processClusterExternalSecret) (.Values.processClusterPushSecret) (.Values.concurrent) (.Values.extraArgs) }}
  55. args:
  56. {{- if .Values.leaderElect }}
  57. - --enable-leader-election=true
  58. {{- end }}
  59. {{- if .Values.scopedNamespace }}
  60. - --namespace={{ .Values.scopedNamespace }}
  61. {{- end }}
  62. {{- if and .Values.scopedNamespace .Values.scopedRBAC }}
  63. - --enable-cluster-store-reconciler=false
  64. - --enable-cluster-external-secret-reconciler=false
  65. - --enable-cluster-push-secret-reconciler=false
  66. {{- else }}
  67. {{- if not .Values.processClusterStore }}
  68. - --enable-cluster-store-reconciler=false
  69. {{- end }}
  70. {{- if not .Values.processClusterExternalSecret }}
  71. - --enable-cluster-external-secret-reconciler=false
  72. {{- end }}
  73. {{- if not .Values.processClusterPushSecret }}
  74. - --enable-cluster-push-secret-reconciler=false
  75. {{- end }}
  76. {{- end }}
  77. {{- if not .Values.processPushSecret }}
  78. - --enable-push-secret-reconciler=false
  79. {{- end }}
  80. {{- if .Values.controllerClass }}
  81. - --controller-class={{ .Values.controllerClass }}
  82. {{- end }}
  83. {{- if .Values.extendedMetricLabels }}
  84. - --enable-extended-metric-labels={{ .Values.extendedMetricLabels }}
  85. {{- end }}
  86. {{- if .Values.concurrent }}
  87. - --concurrent={{ .Values.concurrent }}
  88. {{- end }}
  89. {{- range $key, $value := .Values.extraArgs }}
  90. {{- if $value }}
  91. - --{{ $key }}={{ $value }}
  92. {{- else }}
  93. - --{{ $key }}
  94. {{- end }}
  95. {{- end }}
  96. {{- end }}
  97. - --metrics-addr=:{{ .Values.metrics.listen.port }}
  98. - --loglevel={{ .Values.log.level }}
  99. - --zap-time-encoding={{ .Values.log.timeEncoding }}
  100. ports:
  101. - containerPort: {{ .Values.metrics.listen.port }}
  102. protocol: TCP
  103. name: metrics
  104. {{- with .Values.extraEnv }}
  105. env:
  106. {{- toYaml . | nindent 12 }}
  107. {{- end }}
  108. {{- with .Values.resources }}
  109. resources:
  110. {{- toYaml . | nindent 12 }}
  111. {{- end }}
  112. {{- if .Values.extraVolumeMounts }}
  113. volumeMounts:
  114. {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
  115. {{- end }}
  116. {{- if .Values.extraContainers }}
  117. {{ toYaml .Values.extraContainers | nindent 8 }}
  118. {{- end }}
  119. {{- with .Values.extraInitContainers }}
  120. initContainers:
  121. {{- tpl (toYaml . | nindent 8) $ }}
  122. {{- end }}
  123. dnsPolicy: {{ .Values.dnsPolicy }}
  124. {{- if .Values.dnsConfig }}
  125. dnsConfig:
  126. {{- toYaml .Values.dnsConfig | nindent 8 }}
  127. {{- end }}
  128. {{- if .Values.extraVolumes }}
  129. volumes:
  130. {{- toYaml .Values.extraVolumes | nindent 8 }}
  131. {{- end }}
  132. {{- with .Values.nodeSelector | default .Values.global.nodeSelector }}
  133. nodeSelector:
  134. {{- toYaml . | nindent 8 }}
  135. {{- end }}
  136. {{- with .Values.affinity | default .Values.global.affinity }}
  137. affinity:
  138. {{- toYaml . | nindent 8 }}
  139. {{- end }}
  140. {{- with .Values.tolerations | default .Values.global.tolerations }}
  141. tolerations:
  142. {{- toYaml . | nindent 8 }}
  143. {{- end }}
  144. {{- with .Values.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  145. topologySpreadConstraints:
  146. {{- toYaml . | nindent 8 }}
  147. {{- end }}
  148. {{- if .Values.priorityClassName }}
  149. priorityClassName: {{ .Values.priorityClassName }}
  150. {{- end }}
  151. {{- if .Values.podSpecExtra }}
  152. {{- toYaml .Values.podSpecExtra | nindent 6 }}
  153. {{- end }}
  154. {{- end }}