cert-controller-deployment.yaml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. {{- with .Values.certController.podSecurityContext }}
  50. {{- if and (.enabled) (gt (keys . | len) 1) }}
  51. securityContext:
  52. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 8 }}
  53. {{- end }}
  54. {{- end }}
  55. hostNetwork: {{ .Values.certController.hostNetwork }}
  56. containers:
  57. - name: cert-controller
  58. {{- with .Values.certController.securityContext }}
  59. {{- if and (.enabled) (gt (keys . | len) 1) }}
  60. securityContext:
  61. {{- include "external-secrets.renderSecurityContext" (dict "securityContext" . "context" $) | nindent 12 }}
  62. {{- end }}
  63. {{- end }}
  64. image: {{ include "external-secrets.image" (dict "chartAppVersion" .Chart.AppVersion "image" .Values.certController.image "context" .) | trim }}
  65. imagePullPolicy: {{ .Values.certController.image.pullPolicy }}
  66. args:
  67. - certcontroller
  68. - --crd-requeue-interval={{ .Values.certController.requeueInterval }}
  69. - --service-name={{ include "external-secrets.fullname" . }}-webhook
  70. - --service-namespace={{ template "external-secrets.namespace" . }}
  71. - --secret-name={{ include "external-secrets.fullname" . }}-webhook
  72. - --secret-namespace={{ template "external-secrets.namespace" . }}
  73. - --metrics-addr=:{{ .Values.certController.metrics.listen.port }}
  74. - --healthz-addr={{ .Values.certController.readinessProbe.address }}:{{ .Values.certController.readinessProbe.port }}
  75. - --loglevel={{ .Values.certController.log.level }}
  76. - --zap-time-encoding={{ .Values.certController.log.timeEncoding }}
  77. {{- if not .Values.crds.createClusterSecretStore }}
  78. - --crd-names=externalsecrets.external-secrets.io
  79. - --crd-names=secretstores.external-secrets.io
  80. {{- end }}
  81. {{- if .Values.installCRDs }}
  82. - --enable-partial-cache=true
  83. {{- end }}
  84. {{- if .Values.enableHTTP2 }}
  85. - --enable-http2=true
  86. {{- end }}
  87. {{- range $key, $value := .Values.certController.extraArgs }}
  88. {{- if $value }}
  89. - --{{ $key }}={{ $value }}
  90. {{- else }}
  91. - --{{ $key }}
  92. {{- end }}
  93. {{- end }}
  94. ports:
  95. - containerPort: {{ .Values.certController.metrics.listen.port }}
  96. protocol: TCP
  97. name: metrics
  98. readinessProbe:
  99. httpGet:
  100. port: {{ .Values.certController.readinessProbe.port }}
  101. path: /readyz
  102. initialDelaySeconds: 20
  103. periodSeconds: 5
  104. {{- if .Values.certController.startupProbe.enabled }}
  105. startupProbe:
  106. httpGet:
  107. {{- if .Values.certController.startupProbe.useReadinessProbePort }}
  108. port: {{ .Values.certController.readinessProbe.port }}
  109. {{- else }}
  110. port: {{ .Values.certController.startupProbe.port }}
  111. {{- end }}
  112. path: /readyz
  113. initialDelaySeconds: 20
  114. periodSeconds: 5
  115. {{- end }}
  116. {{- with .Values.certController.extraEnv }}
  117. env:
  118. {{- toYaml . | nindent 12 }}
  119. {{- end }}
  120. {{- with .Values.certController.resources }}
  121. resources:
  122. {{- toYaml . | nindent 12 }}
  123. {{- end }}
  124. {{- if .Values.certController.extraVolumeMounts }}
  125. volumeMounts:
  126. {{- toYaml .Values.certController.extraVolumeMounts | nindent 12 }}
  127. {{- end }}
  128. {{- with .Values.certController.extraInitContainers }}
  129. initContainers:
  130. {{- tpl (toYaml . | nindent 8) $ }}
  131. {{- end }}
  132. {{- if .Values.certController.extraVolumes }}
  133. volumes:
  134. {{- toYaml .Values.certController.extraVolumes | nindent 8 }}
  135. {{- end }}
  136. {{- with .Values.certController.nodeSelector | default .Values.global.nodeSelector }}
  137. nodeSelector:
  138. {{- toYaml . | nindent 8 }}
  139. {{- end }}
  140. {{- with .Values.certController.affinity | default .Values.global.affinity }}
  141. affinity:
  142. {{- toYaml . | nindent 8 }}
  143. {{- end }}
  144. {{- with .Values.certController.tolerations | default .Values.global.tolerations }}
  145. tolerations:
  146. {{- toYaml . | nindent 8 }}
  147. {{- end }}
  148. {{- with .Values.certController.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  149. topologySpreadConstraints:
  150. {{- range $constraint := . }}
  151. - {{ toYaml $constraint | nindent 10 | trim }}
  152. {{- if not $constraint.labelSelector }}
  153. labelSelector:
  154. matchLabels:
  155. {{- include "external-secrets-cert-controller.selectorLabels" $ | nindent 14 }}
  156. {{- end }}
  157. {{- end }}
  158. {{- end }}
  159. {{- if .Values.certController.priorityClassName }}
  160. priorityClassName: {{ .Values.certController.priorityClassName }}
  161. {{- end }}
  162. {{- end }}