{{- if .Values.kubecostChecks -}} {{- if .Values.kubecostChecks.enabled -}} apiVersion: batch/v1beta1 kind: CronJob metadata: name: cost-analyzer-checks labels: {{ include "cost-analyzer.commonLabels" . | nindent 4 }} spec: {{- if .Values.kubecostChecks.debug }} schedule: "*/1 * * * *" {{- else if .Values.kubecostChecks.schedule }} schedule: {{ .Values.kubecostChecks.schedule | quote }} {{- else }} schedule: "*/10 * * * *" {{- end }} jobTemplate: metadata: labels: {{ include "cost-analyzer.commonLabels" . | nindent 8 }} spec: template: spec: containers: - name: cost-analyzer-checks {{- if .Values.kubecostChecks }} image: {{ .Values.kubecostChecks.image }}:prod-{{ $.Chart.AppVersion }} {{- else }} image: gcr.io/kubecost1/checks:prod-{{ $.Chart.AppVersion }} {{ end }} imagePullPolicy: Always args: - node - ./node/cron.js resources: {{ toYaml .Values.kubecostChecks.resources | indent 14 }} env: - name: COST_ANALYZER_SERVER_ENDPOINT value: {{ template "cost-analyzer.serviceName" . }}.{{ .Release.Namespace }}:9001 - name: COST_ANALYZER_MODEL_ENDPOINT {{- if .Values.saml.enabled }} value: {{ template "cost-analyzer.serviceName" . }}.{{ .Release.Namespace }}:9004 {{- else }} value: {{ template "cost-analyzer.serviceName" . }}.{{ .Release.Namespace }}:9003 {{ end }} {{- if .Values.kubecostChecks }} {{- if .Values.kubecostChecks.debug }} - name: SEND_UPDATES_NOW value: "true" {{- end }} {{- end }} - name: PROMETHEUS_ALERTMANAGER_ENDPOINT valueFrom: configMapKeyRef: name: {{ template "cost-analyzer.fullname" . }} key: prometheus-alertmanager-endpoint {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 2 }} {{- end }} restartPolicy: OnFailure {{- end -}} {{- end -}}