deployment.yaml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ include "external-secrets.fullname" . }}
  5. namespace: {{ .Release.Namespace | quote }}
  6. labels:
  7. {{- include "external-secrets.labels" . | nindent 4 }}
  8. {{- with .Values.deploymentAnnotations }}
  9. annotations:
  10. {{- toYaml . | nindent 4 }}
  11. {{- end }}
  12. spec:
  13. replicas: {{ .Values.replicaCount }}
  14. selector:
  15. matchLabels:
  16. {{- include "external-secrets.selectorLabels" . | nindent 6 }}
  17. template:
  18. metadata:
  19. {{- with .Values.podAnnotations }}
  20. annotations:
  21. {{- toYaml . | nindent 8 }}
  22. {{- end }}
  23. labels:
  24. {{- include "external-secrets.selectorLabels" . | nindent 8 }}
  25. {{- with .Values.podLabels }}
  26. {{- toYaml . | nindent 8 }}
  27. {{- end }}
  28. spec:
  29. {{- with .Values.imagePullSecrets }}
  30. imagePullSecrets:
  31. {{- toYaml . | nindent 8 }}
  32. {{- end }}
  33. serviceAccountName: {{ include "external-secrets.serviceAccountName" . }}
  34. {{- with .Values.podSecurityContext }}
  35. securityContext:
  36. {{- toYaml . | nindent 8 }}
  37. {{- end }}
  38. containers:
  39. - name: {{ .Chart.Name }}
  40. {{- with .Values.securityContext }}
  41. securityContext:
  42. {{- toYaml . | nindent 12 }}
  43. {{- end }}
  44. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  45. imagePullPolicy: {{ .Values.image.pullPolicy }}
  46. {{- if or (.Values.leaderElect) (.Values.scopedNamespace) (.Values.concurrent) (.Values.extraArgs) }}
  47. args:
  48. {{- if .Values.leaderElect }}
  49. - --enable-leader-election=true
  50. {{- end }}
  51. {{- if .Values.scopedNamespace }}
  52. - --namespace={{ .Values.scopedNamespace }}
  53. {{- end }}
  54. {{- if .Values.controllerClass }}
  55. - --controller-class={{ .Values.controllerClass }}
  56. {{- end }}
  57. {{- if .Values.concurrent }}
  58. - --concurrent={{ .Values.concurrent }}
  59. {{- end }}
  60. {{- range $key, $value := .Values.extraArgs }}
  61. {{- if $value }}
  62. - --{{ $key }}={{ $value }}
  63. {{- else }}
  64. - --{{ $key }}
  65. {{- end }}
  66. {{- end }}
  67. {{- end }}
  68. ports:
  69. - containerPort: {{ .Values.prometheus.service.port }}
  70. protocol: TCP
  71. name: metrics
  72. {{- with .Values.extraEnv }}
  73. env:
  74. {{- toYaml . | nindent 12 }}
  75. {{- end }}
  76. {{- with .Values.resources }}
  77. resources:
  78. {{- toYaml . | nindent 12 }}
  79. {{- end }}
  80. - name: webhook
  81. {{- with .Values.securityContext }}
  82. securityContext:
  83. {{- toYaml . | nindent 12 }}
  84. {{- end }}
  85. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  86. imagePullPolicy: {{ .Values.image.pullPolicy }}
  87. args:
  88. - --webhook=true
  89. - --metrics-addr=:8081
  90. {{- if or (.Values.leaderElect) (.Values.scopedNamespace) (.Values.concurrent) (.Values.extraArgs) }}
  91. {{- if .Values.leaderElect }}
  92. - --enable-leader-election=true
  93. {{- end }}
  94. {{- if .Values.scopedNamespace }}
  95. - --namespace={{ .Values.scopedNamespace }}
  96. {{- end }}
  97. {{- if .Values.controllerClass }}
  98. - --controller-class={{ .Values.controllerClass }}
  99. {{- end }}
  100. {{- if .Values.concurrent }}
  101. - --concurrent={{ .Values.concurrent }}
  102. {{- end }}
  103. {{- range $key, $value := .Values.extraArgs }}
  104. {{- if $value }}
  105. - --{{ $key }}={{ $value }}
  106. {{- else }}
  107. - --{{ $key }}
  108. {{- end }}
  109. {{- end }}
  110. {{- end }}
  111. {{- if .Values.webhook.enabled }}
  112. volumeMounts:
  113. - name: certs
  114. mountPath: {{ .Values.webhook.certDir }}
  115. {{- end }}
  116. ports:
  117. - containerPort: 9443
  118. protocol: TCP
  119. name: webhook
  120. readinessProbe:
  121. tcpSocket:
  122. port: 9443
  123. initialDelaySeconds: 20
  124. periodSeconds: 5
  125. {{- with .Values.extraEnv }}
  126. env:
  127. {{- toYaml . | nindent 12 }}
  128. {{- end }}
  129. {{- with .Values.resources }}
  130. resources:
  131. {{- toYaml . | nindent 12 }}
  132. {{- end }}
  133. {{- if .Values.webhook.enabled }}
  134. volumes:
  135. - name: certs
  136. secret:
  137. secretName: {{ include "external-secrets.fullname" . }}-webhook
  138. {{- end }}
  139. {{- with .Values.nodeSelector }}
  140. nodeSelector:
  141. {{- toYaml . | nindent 8 }}
  142. {{- end }}
  143. {{- with .Values.affinity }}
  144. affinity:
  145. {{- toYaml . | nindent 8 }}
  146. {{- end }}
  147. {{- with .Values.tolerations }}
  148. tolerations:
  149. {{- toYaml . | nindent 8 }}
  150. {{- end }}
  151. {{- if .Values.priorityClassName }}
  152. priorityClassName: {{ .Values.priorityClassName }}
  153. {{- end }}