deployment.yaml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. {{- if .Values.createOperator }}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ include "external-secrets.fullname" . }}
  6. namespace: {{ .Release.Namespace | quote }}
  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.selectorLabels" . | 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. securityContext:
  39. {{- toYaml . | nindent 8 }}
  40. {{- end }}
  41. hostNetwork: {{ .Values.hostNetwork }}
  42. containers:
  43. - name: {{ .Chart.Name }}
  44. {{- with .Values.securityContext }}
  45. securityContext:
  46. {{- toYaml . | nindent 12 }}
  47. {{- end }}
  48. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  49. imagePullPolicy: {{ .Values.image.pullPolicy }}
  50. {{- if or (.Values.leaderElect) (.Values.scopedNamespace) (.Values.processClusterStore) (.Values.processClusterExternalSecret) (.Values.concurrent) (.Values.extraArgs) }}
  51. {{- if .Values.providers.sidecar.enabled }}
  52. command: ["/bin/external-secrets-providerless"]
  53. {{- end }}
  54. args:
  55. {{- if .Values.leaderElect }}
  56. - --enable-leader-election=true
  57. {{- end }}
  58. {{- if .Values.scopedNamespace }}
  59. - --namespace={{ .Values.scopedNamespace }}
  60. {{- end }}
  61. {{- if and .Values.scopedNamespace .Values.scopedRBAC }}
  62. - --enable-cluster-store-reconciler=false
  63. - --enable-cluster-external-secret-reconciler=false
  64. {{- else }}
  65. {{- if not .Values.processClusterStore }}
  66. - --enable-cluster-store-reconciler=false
  67. {{- end }}
  68. {{- if not .Values.processClusterExternalSecret }}
  69. - --enable-cluster-external-secret-reconciler=false
  70. {{- end }}
  71. {{- end }}
  72. {{- if .Values.controllerClass }}
  73. - --controller-class={{ .Values.controllerClass }}
  74. {{- end }}
  75. {{- if .Values.extendedMetricLabels }}
  76. - --enable-extended-metric-labels={{ .Values.extendedMetricLabels }}
  77. {{- end }}
  78. {{- if .Values.concurrent }}
  79. - --concurrent={{ .Values.concurrent }}
  80. {{- end }}
  81. {{- range $key, $value := .Values.extraArgs }}
  82. {{- if $value }}
  83. - --{{ $key }}={{ $value }}
  84. {{- else }}
  85. - --{{ $key }}
  86. {{- end }}
  87. {{- end }}
  88. {{- end }}
  89. ports:
  90. - containerPort: {{ .Values.prometheus.service.port }}
  91. protocol: TCP
  92. name: metrics
  93. {{- with .Values.extraEnv }}
  94. env:
  95. {{- toYaml . | nindent 12 }}
  96. {{- end }}
  97. {{- with .Values.resources }}
  98. resources:
  99. {{- toYaml . | nindent 12 }}
  100. {{- end }}
  101. {{- if or .Values.providers.sidecar.enabled .Values.extraVolumeMounts }}
  102. volumeMounts:
  103. {{- if .Values.providers.sidecar.enabled }}
  104. - name: provider-uds
  105. mountPath: /var/run/eso/provider/sockets
  106. {{- end }}
  107. {{- if .Values.extraVolumeMounts }}
  108. {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
  109. {{- end }}
  110. {{- end }}
  111. {{- if .Values.extraContainers }}
  112. {{ toYaml .Values.extraContainers | nindent 8}}
  113. {{- end }}
  114. {{- if .Values.providers.sidecar.enabled }}
  115. {{ $valuesCtx := .Values }}
  116. {{ $chartCtx := .Chart }}
  117. {{- range $key, $value := .Values.providers.sidecar.providers }}
  118. {{- $data := dict "Values" $valuesCtx "Chart" $chartCtx "Name" $value "Index" $key }}
  119. {{- include "external-secrets.provider-sidecar" $data | nindent 8 }}
  120. {{- end -}}
  121. {{- end }}
  122. {{- if .Values.dnsConfig }}
  123. dnsConfig:
  124. {{- toYaml .Values.dnsConfig | nindent 8 }}
  125. {{- end }}
  126. {{- if or .Values.extraVolumes .Values.providers.sidecar.enabled }}
  127. volumes:
  128. {{- if .Values.providers.sidecar.enabled }}
  129. - name: provider-uds
  130. emptyDir: {}
  131. {{- end }}
  132. {{- if .Values.extraVolumes }}
  133. {{- toYaml .Values.extraVolumes | nindent 8 }}
  134. {{- end }}
  135. {{- end }}
  136. {{- with .Values.nodeSelector }}
  137. nodeSelector:
  138. {{- toYaml . | nindent 8 }}
  139. {{- end }}
  140. {{- with .Values.affinity }}
  141. affinity:
  142. {{- toYaml . | nindent 8 }}
  143. {{- end }}
  144. {{- with .Values.tolerations }}
  145. tolerations:
  146. {{- toYaml . | nindent 8 }}
  147. {{- end }}
  148. {{- with .Values.topologySpreadConstraints }}
  149. topologySpreadConstraints:
  150. {{- toYaml . | nindent 8 }}
  151. {{- end }}
  152. {{- if .Values.priorityClassName }}
  153. priorityClassName: {{ .Values.priorityClassName }}
  154. {{- end }}
  155. {{- end }}