statefulset.yaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. {{- with (mergeOverwrite (deepCopy .Values.global.statefulsetAnnotations) .Values.controller.statefulsetAnnotations) }}
  5. annotations:
  6. {{- range $key, $value := . }}
  7. {{ $key }}: {{ $value | quote }}
  8. {{- end }}
  9. {{- end }}
  10. name: {{ template "argo-cd.controller.fullname" . }}
  11. namespace: {{ .Release.Namespace | quote }}
  12. labels:
  13. {{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 4 }}
  14. spec:
  15. replicas: {{ .Values.controller.replicas }}
  16. # TODO: Remove for breaking release as history limit cannot be patched
  17. revisionHistoryLimit: 5
  18. serviceName: {{ include "argo-cd.controller.fullname" . }}
  19. selector:
  20. matchLabels:
  21. {{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }}
  22. template:
  23. metadata:
  24. annotations:
  25. checksum/cmd-params: {{ include (print $.Template.BasePath "/argocd-configs/argocd-cmd-params-cm.yaml") . | sha256sum }}
  26. {{- if (hasKey .Values.server "configEnabled") | ternary .Values.server.configEnabled .Values.configs.cm.create }}
  27. checksum/cm: {{ include (print $.Template.BasePath "/argocd-configs/argocd-cm.yaml") . | sha256sum }}
  28. {{- end }}
  29. {{- with (mergeOverwrite (deepCopy .Values.global.podAnnotations) .Values.controller.podAnnotations) }}
  30. {{- range $key, $value := . }}
  31. {{ $key }}: {{ $value | quote }}
  32. {{- end }}
  33. {{- end }}
  34. labels:
  35. {{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | nindent 8 }}
  36. {{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.controller.podLabels) }}
  37. {{- toYaml . | nindent 8 }}
  38. {{- end }}
  39. spec:
  40. {{- with .Values.controller.imagePullSecrets | default .Values.global.imagePullSecrets }}
  41. imagePullSecrets:
  42. {{- toYaml . | nindent 8 }}
  43. {{- end }}
  44. {{- with .Values.global.hostAliases }}
  45. hostAliases:
  46. {{- toYaml . | nindent 8 }}
  47. {{- end }}
  48. {{- with .Values.global.securityContext }}
  49. securityContext:
  50. {{- toYaml . | nindent 8 }}
  51. {{- end }}
  52. {{- with .Values.controller.priorityClassName | default .Values.global.priorityClassName }}
  53. priorityClassName: {{ . }}
  54. {{- end }}
  55. {{- if .Values.controller.terminationGracePeriodSeconds }}
  56. terminationGracePeriodSeconds: {{ .Values.controller.terminationGracePeriodSeconds }}
  57. {{- end }}
  58. serviceAccountName: {{ include "argo-cd.controller.serviceAccountName" . }}
  59. containers:
  60. - args:
  61. - /usr/local/bin/argocd-application-controller
  62. - --metrics-port={{ .Values.controller.containerPorts.metrics }}
  63. {{- if .Values.controller.metrics.applicationLabels.enabled }}
  64. {{- range .Values.controller.metrics.applicationLabels.labels }}
  65. - --metrics-application-labels
  66. - {{ . }}
  67. {{- end }}
  68. {{- end }}
  69. {{- with .Values.controller.args.statusProcessors }}
  70. - --status-processors
  71. - {{ . | quote }}
  72. {{- end }}
  73. {{- with .Values.controller.args.operationProcessors }}
  74. - --operation-processors
  75. - {{ . | quote }}
  76. {{- end }}
  77. {{- with .Values.controller.args.appResyncPeriod }}
  78. - --app-resync
  79. - {{ . | quote }}
  80. {{- end }}
  81. {{- with .Values.controller.args.appHardResyncPeriod }}
  82. - --app-hard-resync
  83. - {{ . | quote }}
  84. {{- end }}
  85. {{- with .Values.controller.args.selfHealTimeout }}
  86. - --self-heal-timeout-seconds
  87. - {{ . | quote }}
  88. {{- end }}
  89. {{- with .Values.controller.args.repoServerTimeoutSeconds }}
  90. - --repo-server-timeout-seconds
  91. - {{ . | quote }}
  92. {{- end }}
  93. {{- with .Values.controller.logFormat }}
  94. - --logformat
  95. - {{ . | quote }}
  96. {{- end }}
  97. {{- with .Values.controller.logLevel }}
  98. - --loglevel
  99. - {{ . | quote }}
  100. {{- end }}
  101. {{- with .Values.controller.extraArgs }}
  102. {{- toYaml . | nindent 8 }}
  103. {{- end }}
  104. image: {{ default .Values.global.image.repository .Values.controller.image.repository }}:{{ default (include "argo-cd.defaultTag" .) .Values.controller.image.tag }}
  105. imagePullPolicy: {{ default .Values.global.image.imagePullPolicy .Values.controller.image.imagePullPolicy }}
  106. name: {{ .Values.controller.name }}
  107. env:
  108. {{- with (concat .Values.global.env .Values.controller.env) }}
  109. {{- toYaml . | nindent 10 }}
  110. {{- end }}
  111. - name: ARGOCD_CONTROLLER_REPLICAS
  112. value: {{ .Values.controller.replicas | quote }}
  113. - name: ARGOCD_RECONCILIATION_TIMEOUT
  114. valueFrom:
  115. configMapKeyRef:
  116. name: argocd-cm
  117. key: timeout.reconciliation
  118. optional: true
  119. - name: ARGOCD_HARD_RECONCILIATION_TIMEOUT
  120. valueFrom:
  121. configMapKeyRef:
  122. name: argocd-cm
  123. key: timeout.hard.reconciliation
  124. optional: true
  125. - name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER
  126. valueFrom:
  127. configMapKeyRef:
  128. name: argocd-cmd-params-cm
  129. key: repo.server
  130. optional: true
  131. - name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER_TIMEOUT_SECONDS
  132. valueFrom:
  133. configMapKeyRef:
  134. name: argocd-cmd-params-cm
  135. key: controller.repo.server.timeout.seconds
  136. optional: true
  137. - name: ARGOCD_APPLICATION_CONTROLLER_STATUS_PROCESSORS
  138. valueFrom:
  139. configMapKeyRef:
  140. name: argocd-cmd-params-cm
  141. key: controller.status.processors
  142. optional: true
  143. - name: ARGOCD_APPLICATION_CONTROLLER_OPERATION_PROCESSORS
  144. valueFrom:
  145. configMapKeyRef:
  146. name: argocd-cmd-params-cm
  147. key: controller.operation.processors
  148. optional: true
  149. - name: ARGOCD_APPLICATION_CONTROLLER_LOGFORMAT
  150. valueFrom:
  151. configMapKeyRef:
  152. name: argocd-cmd-params-cm
  153. key: controller.log.format
  154. optional: true
  155. - name: ARGOCD_APPLICATION_CONTROLLER_LOGLEVEL
  156. valueFrom:
  157. configMapKeyRef:
  158. name: argocd-cmd-params-cm
  159. key: controller.log.level
  160. optional: true
  161. - name: ARGOCD_APPLICATION_CONTROLLER_METRICS_CACHE_EXPIRATION
  162. valueFrom:
  163. configMapKeyRef:
  164. name: argocd-cmd-params-cm
  165. key: controller.metrics.cache.expiration
  166. optional: true
  167. - name: ARGOCD_APPLICATION_CONTROLLER_SELF_HEAL_TIMEOUT_SECONDS
  168. valueFrom:
  169. configMapKeyRef:
  170. name: argocd-cmd-params-cm
  171. key: controller.self.heal.timeout.seconds
  172. optional: true
  173. - name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER_PLAINTEXT
  174. valueFrom:
  175. configMapKeyRef:
  176. name: argocd-cmd-params-cm
  177. key: controller.repo.server.plaintext
  178. optional: true
  179. - name: ARGOCD_APPLICATION_CONTROLLER_REPO_SERVER_STRICT_TLS
  180. valueFrom:
  181. configMapKeyRef:
  182. name: argocd-cmd-params-cm
  183. key: controller.repo.server.strict.tls
  184. optional: true
  185. - name: ARGOCD_APPLICATION_CONTROLLER_PERSIST_RESOURCE_HEALTH
  186. valueFrom:
  187. configMapKeyRef:
  188. name: argocd-cmd-params-cm
  189. key: controller.resource.health.persist
  190. optional: true
  191. - name: ARGOCD_APP_STATE_CACHE_EXPIRATION
  192. valueFrom:
  193. configMapKeyRef:
  194. name: argocd-cmd-params-cm
  195. key: controller.app.state.cache.expiration
  196. optional: true
  197. - name: REDIS_SERVER
  198. valueFrom:
  199. configMapKeyRef:
  200. name: argocd-cmd-params-cm
  201. key: redis.server
  202. optional: true
  203. - name: REDIS_COMPRESSION
  204. valueFrom:
  205. configMapKeyRef:
  206. name: argocd-cmd-params-cm
  207. key: redis.compression
  208. optional: true
  209. - name: REDISDB
  210. valueFrom:
  211. configMapKeyRef:
  212. name: argocd-cmd-params-cm
  213. key: redis.db
  214. optional: true
  215. - name: REDIS_USERNAME
  216. valueFrom:
  217. secretKeyRef:
  218. name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
  219. key: redis-username
  220. optional: true
  221. - name: REDIS_PASSWORD
  222. valueFrom:
  223. secretKeyRef:
  224. name: {{ default (include "argo-cd.redis.fullname" .) .Values.externalRedis.existingSecret }}
  225. key: redis-password
  226. optional: true
  227. - name: ARGOCD_DEFAULT_CACHE_EXPIRATION
  228. valueFrom:
  229. configMapKeyRef:
  230. name: argocd-cmd-params-cm
  231. key: controller.default.cache.expiration
  232. optional: true
  233. - name: ARGOCD_APPLICATION_CONTROLLER_OTLP_ADDRESS
  234. valueFrom:
  235. configMapKeyRef:
  236. name: argocd-cmd-params-cm
  237. key: otlp.address
  238. optional: true
  239. - name: ARGOCD_APPLICATION_NAMESPACES
  240. valueFrom:
  241. configMapKeyRef:
  242. name: argocd-cmd-params-cm
  243. key: application.namespaces
  244. optional: true
  245. - name: ARGOCD_CONTROLLER_SHARDING_ALGORITHM
  246. valueFrom:
  247. configMapKeyRef:
  248. name: argocd-cmd-params-cm
  249. key: controller.sharding.algorithm
  250. optional: true
  251. - name: ARGOCD_APPLICATION_CONTROLLER_KUBECTL_PARALLELISM_LIMIT
  252. valueFrom:
  253. configMapKeyRef:
  254. name: argocd-cmd-params-cm
  255. key: controller.kubectl.parallelism.limit
  256. optional: true
  257. {{- with .Values.controller.envFrom }}
  258. envFrom:
  259. {{- toYaml . | nindent 10 }}
  260. {{- end }}
  261. ports:
  262. - name: metrics
  263. containerPort: {{ .Values.controller.containerPorts.metrics }}
  264. protocol: TCP
  265. readinessProbe:
  266. httpGet:
  267. path: /healthz
  268. port: metrics
  269. initialDelaySeconds: {{ .Values.controller.readinessProbe.initialDelaySeconds }}
  270. periodSeconds: {{ .Values.controller.readinessProbe.periodSeconds }}
  271. timeoutSeconds: {{ .Values.controller.readinessProbe.timeoutSeconds }}
  272. successThreshold: {{ .Values.controller.readinessProbe.successThreshold }}
  273. failureThreshold: {{ .Values.controller.readinessProbe.failureThreshold }}
  274. resources:
  275. {{- toYaml .Values.controller.resources | nindent 10 }}
  276. {{- with .Values.controller.containerSecurityContext }}
  277. securityContext:
  278. {{- toYaml . | nindent 10 }}
  279. {{- end }}
  280. workingDir: /home/argocd
  281. volumeMounts:
  282. {{- with .Values.controller.volumeMounts }}
  283. {{- toYaml . | nindent 8 }}
  284. {{- end }}
  285. - mountPath: /app/config/controller/tls
  286. name: argocd-repo-server-tls
  287. - mountPath: /home/argocd
  288. name: argocd-home
  289. {{- with .Values.controller.extraContainers }}
  290. {{- tpl (toYaml .) $ | nindent 6 }}
  291. {{- end }}
  292. {{- with .Values.controller.initContainers }}
  293. initContainers:
  294. {{- tpl (toYaml .) $ | nindent 6 }}
  295. {{- end }}
  296. {{- with include "argo-cd.affinity" (dict "context" . "component" .Values.controller) }}
  297. affinity:
  298. {{- trim . | nindent 8 }}
  299. {{- end }}
  300. {{- with .Values.controller.nodeSelector | default .Values.global.nodeSelector }}
  301. nodeSelector:
  302. {{- toYaml . | nindent 8 }}
  303. {{- end }}
  304. {{- with .Values.controller.tolerations | default .Values.global.tolerations }}
  305. tolerations:
  306. {{- toYaml . | nindent 8 }}
  307. {{- end }}
  308. {{- with .Values.controller.topologySpreadConstraints | default .Values.global.topologySpreadConstraints }}
  309. topologySpreadConstraints:
  310. {{- range $constraint := . }}
  311. - {{ toYaml $constraint | nindent 8 | trim }}
  312. {{- if not $constraint.labelSelector }}
  313. labelSelector:
  314. matchLabels:
  315. {{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.controller.name) | nindent 12 }}
  316. {{- end }}
  317. {{- end }}
  318. {{- end }}
  319. volumes:
  320. {{- with .Values.controller.volumes }}
  321. {{- toYaml . | nindent 6 }}
  322. {{- end }}
  323. - name: argocd-home
  324. emptyDir: {}
  325. - name: argocd-repo-server-tls
  326. secret:
  327. secretName: argocd-repo-server-tls
  328. optional: true
  329. items:
  330. - key: tls.crt
  331. path: tls.crt
  332. - key: tls.key
  333. path: tls.key
  334. - key: ca.crt
  335. path: ca.crt
  336. {{- if .Values.controller.hostNetwork }}
  337. hostNetwork: {{ .Values.controller.hostNetwork }}
  338. {{- end }}
  339. {{- with .Values.controller.dnsConfig }}
  340. dnsConfig:
  341. {{- toYaml . | nindent 8 }}
  342. {{- end }}
  343. dnsPolicy: {{ .Values.controller.dnsPolicy }}