cert-controller-deployment.yaml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. {{- if and .Values.certController.create (not .Values.webhook.certManager.enabled) }}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ include "external-secrets.fullname" . }}-cert-controller
  6. namespace: {{ template "external-secrets.namespace" . }}
  7. labels:
  8. {{- include "external-secrets-cert-controller.labels" . | nindent 4 }}
  9. {{- with .Values.certController.deploymentAnnotations }}
  10. annotations:
  11. {{- toYaml . | nindent 4 }}
  12. {{- end }}
  13. spec:
  14. replicas: {{ .Values.certController.replicaCount }}
  15. revisionHistoryLimit: {{ .Values.certController.revisionHistoryLimit }}
  16. selector:
  17. matchLabels:
  18. {{- include "external-secrets-cert-controller.selectorLabels" . | nindent 6 }}
  19. {{- with .Values.certController.strategy }}
  20. strategy:
  21. {{- toYaml . | nindent 4 }}
  22. {{- end }}
  23. template:
  24. metadata:
  25. {{- if .Values.certController.podAnnotations }}
  26. annotations:
  27. {{- toYaml .Values.certController.podAnnotations | nindent 8 }}
  28. {{- else if .Values.global.podAnnotations }}
  29. annotations:
  30. {{- toYaml .Values.global.podAnnotations | nindent 8 }}
  31. {{- end }}
  32. labels:
  33. {{- include "external-secrets-cert-controller.labels" . | nindent 8 }}
  34. {{- if .Values.certController.podLabels }}
  35. {{- toYaml .Values.certController.podLabels | nindent 8 }}
  36. {{- else if .Values.global.podLabels }}
  37. {{- toYaml .Values.global.podLabels | nindent 8 }}
  38. {{- end }}
  39. spec:
  40. {{- if .Values.certController.imagePullSecrets }}
  41. imagePullSecrets:
  42. {{- toYaml .Values.certController.imagePullSecrets | nindent 8 }}
  43. {{- else if .Values.global.imagePullSecrets }}
  44. imagePullSecrets:
  45. {{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
  46. {{- end }}
  47. serviceAccountName: {{ include "external-secrets-cert-controller.serviceAccountName" . }}
  48. automountServiceAccountToken: {{ .Values.certController.serviceAccount.automount }}
  49. {{- if (semverCompare ">= 1.33-0" .Capabilities.KubeVersion.Version) }}
  50. {{- if kindIs "bool" .Values.certController.hostUsers }}
  51. hostUsers: {{ .Values.certController.hostUsers }}
  52. {{- end }}
  53. {{- end }}
  54. {{- with .Values.certController.podSecurityContext }}
  55. {{- if and (.enabled) (gt (keys . | len) 1) }}
  56. securityContext:
  57. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 8 }}
  58. {{- end }}
  59. {{- end }}
  60. hostNetwork: {{ .Values.certController.hostNetwork }}
  61. containers:
  62. - name: cert-controller
  63. {{- with .Values.certController.securityContext }}
  64. {{- if and (.enabled) (gt (keys . | len) 1) }}
  65. securityContext:
  66. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 12 }}
  67. {{- end }}
  68. {{- end }}
  69. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.certController.image "context" .) | trim }}
  70. imagePullPolicy: {{ .Values.certController.image.pullPolicy }}
  71. args:
  72. - certcontroller
  73. - --crd-requeue-interval={{ .Values.certController.requeueInterval }}
  74. - --service-name={{ include "external-secrets.componentName" (list . "-webhook") }}
  75. - --service-namespace={{ template "external-secrets.namespace" . }}
  76. - --secret-name={{ include "external-secrets.fullname" . }}-webhook
  77. - --secret-namespace={{ template "external-secrets.namespace" . }}
  78. - --metrics-addr=:{{ .Values.certController.metrics.listen.port }}
  79. - --healthz-addr={{ .Values.certController.readinessProbe.address }}:{{ .Values.certController.readinessProbe.port }}
  80. - --loglevel={{ .Values.certController.log.level }}
  81. - --zap-time-encoding={{ .Values.certController.log.timeEncoding }}
  82. {{- if not .Values.crds.createClusterSecretStore }}
  83. - --crd-names=externalsecrets.external-secrets.io
  84. - --crd-names=secretstores.external-secrets.io
  85. {{- end }}
  86. {{- if .Values.installCRDs }}
  87. - --enable-partial-cache=true
  88. {{- end }}
  89. {{- if .Values.enableHTTP2 }}
  90. - --enable-http2=true
  91. {{- end }}
  92. {{- if .Values.leaderElect }}
  93. - --enable-leader-election=true
  94. {{- end }}
  95. {{- range $key, $value := .Values.certController.extraArgs }}
  96. {{- if $value }}
  97. - --{{ $key }}={{ $value }}
  98. {{- else }}
  99. - --{{ $key }}
  100. {{- end }}
  101. {{- end }}
  102. {{- if .Values.certController.metrics.listen.secure.enabled }}
  103. - --metrics-secure=true
  104. - --metrics-cert-dir={{ .Values.certController.metrics.listen.secure.certDir }}
  105. - --metrics-cert-name={{ .Values.certController.metrics.listen.secure.certFile }}
  106. - --metrics-key-name={{ .Values.certController.metrics.listen.secure.keyFile }}
  107. {{- end }}
  108. {{- if .Values.certController.metrics.listen.auth.enabled }}
  109. - --metrics-auth=true
  110. {{- end }}
  111. ports:
  112. - containerPort: {{ .Values.certController.metrics.listen.port }}
  113. protocol: TCP
  114. name: metrics
  115. - containerPort: {{ .Values.certController.readinessProbe.port }}
  116. protocol: TCP
  117. name: ready
  118. {{- if and .Values.certController.startupProbe.enabled (not .Values.certController.startupProbe.useReadinessProbePort) }}
  119. - containerPort: {{ .Values.certController.startupProbe.port }}
  120. protocol: TCP
  121. name: startup
  122. {{- end }}
  123. {{- if .Values.certController.livenessProbe.enabled }}
  124. livenessProbe:
  125. httpGet:
  126. port: {{ .Values.certController.livenessProbe.port }}
  127. path: /healthz
  128. initialDelaySeconds: {{ .Values.certController.livenessProbe.initialDelaySeconds }}
  129. periodSeconds: {{ .Values.certController.livenessProbe.periodSeconds }}
  130. timeoutSeconds: {{ .Values.certController.livenessProbe.timeoutSeconds }}
  131. failureThreshold: {{ .Values.certController.livenessProbe.failureThreshold }}
  132. successThreshold: {{ .Values.certController.livenessProbe.successThreshold }}
  133. {{- end }}
  134. {{- if .Values.certController.readinessProbe.enabled }}
  135. readinessProbe:
  136. httpGet:
  137. port: ready
  138. path: /readyz
  139. initialDelaySeconds: {{ .Values.certController.readinessProbe.initialDelaySeconds }}
  140. periodSeconds: {{ .Values.certController.readinessProbe.periodSeconds }}
  141. timeoutSeconds: {{ .Values.certController.readinessProbe.timeoutSeconds }}
  142. failureThreshold: {{ .Values.certController.readinessProbe.failureThreshold }}
  143. successThreshold: {{ .Values.certController.readinessProbe.successThreshold }}
  144. {{- end }}
  145. {{- if .Values.certController.startupProbe.enabled }}
  146. startupProbe:
  147. httpGet:
  148. {{- if .Values.certController.startupProbe.useReadinessProbePort }}
  149. port: ready
  150. {{- else }}
  151. port: startup
  152. {{- end }}
  153. path: /readyz
  154. initialDelaySeconds: 20
  155. periodSeconds: 5
  156. {{- end }}
  157. {{- with .Values.certController.extraEnv }}
  158. env:
  159. {{- toYaml . | nindent 12 }}
  160. {{- end }}
  161. {{- with .Values.certController.resources }}
  162. resources:
  163. {{- toYaml . | nindent 12 }}
  164. {{- end }}
  165. {{- if .Values.certController.extraVolumeMounts }}
  166. volumeMounts:
  167. {{- toYaml .Values.certController.extraVolumeMounts | nindent 12 }}
  168. {{- end }}
  169. {{- with .Values.certController.extraInitContainers }}
  170. initContainers:
  171. {{- tpl (toYaml . | nindent 8) $ }}
  172. {{- end }}
  173. {{- if .Values.certController.extraVolumes }}
  174. volumes:
  175. {{- toYaml .Values.certController.extraVolumes | nindent 8 }}
  176. {{- end }}
  177. {{- with .Values.certController.hostAliases | default .Values.global.hostAliases }}
  178. hostAliases:
  179. {{- toYaml . | nindent 8 }}
  180. {{- end }}
  181. {{- with .Values.certController.nodeSelector | default .Values.global.nodeSelector }}
  182. nodeSelector:
  183. {{- toYaml . | nindent 8 }}
  184. {{- end }}
  185. {{- with .Values.certController.affinity | default .Values.global.affinity }}
  186. affinity:
  187. {{- toYaml . | nindent 8 }}
  188. {{- end }}
  189. {{- with .Values.certController.tolerations | default .Values.global.tolerations }}
  190. tolerations:
  191. {{- toYaml . | nindent 8 }}
  192. {{- end }}
  193. {{- with .Values.certController.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  194. topologySpreadConstraints:
  195. {{- range $constraint := . }}
  196. - {{ toYaml $constraint | nindent 10 | trim }}
  197. {{- if not $constraint.labelSelector }}
  198. labelSelector:
  199. matchLabels:
  200. {{- include "external-secrets-cert-controller.selectorLabels" $ | nindent 14 }}
  201. {{- end }}
  202. {{- end }}
  203. {{- end }}
  204. {{- if .Values.certController.priorityClassName }}
  205. priorityClassName: {{ .Values.certController.priorityClassName }}
  206. {{- end }}
  207. {{- end }}