es-index-cleaner-cronjob.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. {{- if .Values.esIndexCleaner.enabled -}}
  2. apiVersion: {{ include "common.capabilities.cronjob.apiVersion" $ }}
  3. kind: CronJob
  4. metadata:
  5. name: {{ include "jaeger.fullname" . }}-es-index-cleaner
  6. labels:
  7. {{- include "jaeger.labels" . | nindent 4 }}
  8. app.kubernetes.io/component: es-index-cleaner
  9. {{- if .Values.esIndexCleaner.annotations }}
  10. annotations:
  11. {{- toYaml .Values.esIndexCleaner.annotations | nindent 4 }}
  12. {{- end }}
  13. spec:
  14. concurrencyPolicy: {{ .Values.esIndexCleaner.concurrencyPolicy }}
  15. schedule: {{ .Values.esIndexCleaner.schedule | quote }}
  16. successfulJobsHistoryLimit: {{ .Values.esIndexCleaner.successfulJobsHistoryLimit }}
  17. failedJobsHistoryLimit: {{ .Values.esIndexCleaner.failedJobsHistoryLimit }}
  18. suspend: false
  19. jobTemplate:
  20. spec:
  21. {{- if .Values.esIndexCleaner.activeDeadlineSeconds }}
  22. activeDeadlineSeconds: {{ .Values.esIndexCleaner.activeDeadlineSeconds }}
  23. {{- end }}
  24. {{- if .Values.esIndexCleaner.ttlSecondsAfterFinished }}
  25. ttlSecondsAfterFinished: {{ .Values.esIndexCleaner.ttlSecondsAfterFinished }}
  26. {{- end }}
  27. template:
  28. metadata:
  29. {{- if .Values.esIndexCleaner.podAnnotations }}
  30. annotations:
  31. {{- toYaml .Values.esIndexCleaner.podAnnotations | nindent 12 }}
  32. {{- end }}
  33. labels:
  34. {{- include "jaeger.selectorLabels" . | nindent 12 }}
  35. app.kubernetes.io/component: es-index-cleaner
  36. {{- if .Values.esIndexCleaner.podLabels }}
  37. {{- toYaml .Values.esIndexCleaner.podLabels | nindent 12 }}
  38. {{- end }}
  39. spec:
  40. serviceAccountName: {{ template "jaeger.esIndexCleaner.serviceAccountName" . }}
  41. {{- with .Values.esIndexCleaner.imagePullSecrets }}
  42. imagePullSecrets:
  43. {{- toYaml . | nindent 12 }}
  44. {{- end }}
  45. securityContext:
  46. {{- toYaml .Values.esIndexCleaner.podSecurityContext | nindent 12 }}
  47. containers:
  48. - name: {{ include "jaeger.fullname" . }}-es-index-cleaner
  49. securityContext:
  50. {{- toYaml .Values.esIndexCleaner.securityContext | nindent 14 }}
  51. image: {{ .Values.esIndexCleaner.image }}:{{- .Values.esIndexCleaner.tag | default (include "jaeger.image.tag" .) }}
  52. imagePullPolicy: {{ .Values.esIndexCleaner.pullPolicy }}
  53. args:
  54. - {{ .Values.esIndexCleaner.numberOfDays | quote }}
  55. - {{ include "elasticsearch.client.url" . }}
  56. {{ include "extra.cmdArgs" ( dict "cmdlineParams" .Values.esIndexCleaner.cmdlineParams ) | nindent 14 }}
  57. env:
  58. {{- if .Values.esIndexCleaner.extraEnv }}
  59. {{- toYaml .Values.esIndexCleaner.extraEnv | nindent 14 }}
  60. {{- end }}
  61. {{ include "elasticsearch.env" . | nindent 14 }}
  62. resources:
  63. {{- toYaml .Values.esIndexCleaner.resources | nindent 14 }}
  64. volumeMounts:
  65. {{- range .Values.esIndexCleaner.extraConfigmapMounts }}
  66. - name: {{ .name }}
  67. mountPath: {{ .mountPath }}
  68. subPath: {{ .subPath }}
  69. readOnly: {{ .readOnly }}
  70. {{- end }}
  71. {{- range .Values.esIndexCleaner.extraSecretMounts }}
  72. - name: {{ .name }}
  73. mountPath: {{ .mountPath }}
  74. subPath: {{ .subPath }}
  75. readOnly: {{ .readOnly }}
  76. {{- end }}
  77. {{- if .Values.storage.elasticsearch.tls.enabled }}
  78. - name: {{ .Values.storage.elasticsearch.tls.secretName }}
  79. mountPath: "/es-tls/ca-cert.pem"
  80. subPath: "ca-cert.pem"
  81. readOnly: true
  82. {{- end }}
  83. restartPolicy: OnFailure
  84. {{- with .Values.esIndexCleaner.nodeSelector }}
  85. nodeSelector:
  86. {{- toYaml . | nindent 12 }}
  87. {{- end }}
  88. {{- with .Values.esIndexCleaner.affinity }}
  89. affinity:
  90. {{- toYaml . | nindent 12 }}
  91. {{- end }}
  92. {{- with .Values.esIndexCleaner.tolerations }}
  93. tolerations:
  94. {{- toYaml . | nindent 12 }}
  95. {{- end }}
  96. volumes:
  97. {{- range .Values.esIndexCleaner.extraConfigmapMounts }}
  98. - name: {{ .name }}
  99. configMap:
  100. name: {{ .configMap }}
  101. {{- end }}
  102. {{- range .Values.esIndexCleaner.extraSecretMounts }}
  103. - name: {{ .name }}
  104. secret:
  105. secretName: {{ .secretName }}
  106. {{- end }}
  107. {{- if .Values.storage.elasticsearch.tls.enabled }}
  108. - name: {{ .Values.storage.elasticsearch.tls.secretName }}
  109. secret:
  110. secretName: {{ .Values.storage.elasticsearch.tls.secretName }}
  111. {{- end }}
  112. {{- end -}}