cert-controller-deployment.yaml 7.6 KB

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