_firefly_cron.tpl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. {{- define "firefly.cron" -}}
  2. {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) }}
  3. workload:
  4. firefly-cron:
  5. enabled: true
  6. type: CronJob
  7. schedule: "0 3 * * *"
  8. podSpec:
  9. restartPolicy: Never
  10. backoffLimit: 2
  11. containers:
  12. firefly-cron:
  13. enabled: true
  14. primary: true
  15. imageSelector: bashImage
  16. env:
  17. CRON_TOKEN:
  18. secretKeyRef:
  19. name: firefly-config
  20. key: STATIC_CRON_TOKEN
  21. probes:
  22. startup:
  23. enabled: false
  24. readiness:
  25. enabled: false
  26. liveness:
  27. enabled: false
  28. command:
  29. - bash
  30. args:
  31. - -c
  32. - |
  33. until wget --spider --quiet --timeout=3 --tries=1 \
  34. {{ $fullname }}:{{ .Values.fireflyNetwork.webPort }}/health; do
  35. echo "Waiting for Firefly to start..."
  36. sleep 2
  37. done
  38. if wget --spider --quiet --timeout=3 --tries=1 \
  39. {{ $fullname }}:{{ .Values.fireflyNetwork.webPort }}/api/v1/cron/$(CRON_TOKEN);
  40. then
  41. echo "Cron job successfully executed"
  42. else
  43. echo "Cron job failed"
  44. exit 1
  45. fi
  46. {{- end -}}