cert-controller-deployment.yaml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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.fullname" . }}-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. ports:
  103. - containerPort: {{ .Values.certController.metrics.listen.port }}
  104. protocol: TCP
  105. name: metrics
  106. - containerPort: {{ .Values.certController.readinessProbe.port }}
  107. protocol: TCP
  108. name: ready
  109. {{- if and .Values.certController.startupProbe.enabled (not .Values.certController.startupProbe.useReadinessProbePort) }}
  110. - containerPort: {{ .Values.certController.startupProbe.port }}
  111. protocol: TCP
  112. name: startup
  113. {{- end }}
  114. readinessProbe:
  115. httpGet:
  116. port: ready
  117. path: /readyz
  118. initialDelaySeconds: 20
  119. periodSeconds: 5
  120. {{- if .Values.certController.startupProbe.enabled }}
  121. startupProbe:
  122. httpGet:
  123. {{- if .Values.certController.startupProbe.useReadinessProbePort }}
  124. port: ready
  125. {{- else }}
  126. port: startup
  127. {{- end }}
  128. path: /readyz
  129. initialDelaySeconds: 20
  130. periodSeconds: 5
  131. {{- end }}
  132. {{- with .Values.certController.extraEnv }}
  133. env:
  134. {{- toYaml . | nindent 12 }}
  135. {{- end }}
  136. {{- with .Values.certController.resources }}
  137. resources:
  138. {{- toYaml . | nindent 12 }}
  139. {{- end }}
  140. {{- if .Values.certController.extraVolumeMounts }}
  141. volumeMounts:
  142. {{- toYaml .Values.certController.extraVolumeMounts | nindent 12 }}
  143. {{- end }}
  144. {{- with .Values.certController.extraInitContainers }}
  145. initContainers:
  146. {{- tpl (toYaml . | nindent 8) $ }}
  147. {{- end }}
  148. {{- if .Values.certController.extraVolumes }}
  149. volumes:
  150. {{- toYaml .Values.certController.extraVolumes | nindent 8 }}
  151. {{- end }}
  152. {{- with .Values.certController.hostAliases | default .Values.global.hostAliases }}
  153. hostAliases:
  154. {{- toYaml . | nindent 8 }}
  155. {{- end }}
  156. {{- with .Values.certController.nodeSelector | default .Values.global.nodeSelector }}
  157. nodeSelector:
  158. {{- toYaml . | nindent 8 }}
  159. {{- end }}
  160. {{- with .Values.certController.affinity | default .Values.global.affinity }}
  161. affinity:
  162. {{- toYaml . | nindent 8 }}
  163. {{- end }}
  164. {{- with .Values.certController.tolerations | default .Values.global.tolerations }}
  165. tolerations:
  166. {{- toYaml . | nindent 8 }}
  167. {{- end }}
  168. {{- with .Values.certController.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  169. topologySpreadConstraints:
  170. {{- range $constraint := . }}
  171. - {{ toYaml $constraint | nindent 10 | trim }}
  172. {{- if not $constraint.labelSelector }}
  173. labelSelector:
  174. matchLabels:
  175. {{- include "external-secrets-cert-controller.selectorLabels" $ | nindent 14 }}
  176. {{- end }}
  177. {{- end }}
  178. {{- end }}
  179. {{- if .Values.certController.priorityClassName }}
  180. priorityClassName: {{ .Values.certController.priorityClassName }}
  181. {{- end }}
  182. {{- end }}