Yaml file | schedule a cronjob

Question:

I’m trying to schedule a cronjob to run every 10 minutes during a specific time window, specifically from 4:00 am to 5:30 am. the job should execute at these times:
4:00, 4:10, 4:20, …, 5:10, 5:20, 5:30. what is the best practice to do this?

Cluster information:

Client Version: v1.25.9
Kustomize Version: v4.5.7
Installation method: Jenkins & Helm
Host OS: Linux

Beginning of yaml file

pipeline:
appName: “index-flag”
namespace: “bi-lan”
department: “bi”
network: “LAN”
imageRepo: da-ml

extra:
installTimeOut: 120
labels:
siem: “false”
index_name: “infra-kubernetes”
cronjob:
enabled: true
jobname: APPNAME-job
schedule: “*/10 2-3 * * *”
concurrencyPolicy: Forbid

try this…

pipeline:
  appName: "index-flag"
  namespace: "bi-lan"
  department: "bi"
  network: "LAN"
  imageRepo: da-ml

extra:
  installTimeOut: 120
  labels:
    siem: "false"
    index_name: "infra-kubernetes"
cronjob:
  enabled: true
  jobname: APPNAME-job
  schedule: "*/10 4 * * *, 0-30/10 5 * * *"
  concurrencyPolicy: Forbid

Error: UPGRADE FAILED: cannot patch “index-flag-job” with kind CronJob: CronJob.batch “index-flag-job” is invalid: spec.schedule: Invalid value: “*/10 4 * * *, 0-30/10 5 * * *”: Expected exactly 5 fields, found 10: */10 4 * * *, 0-30/10 5 * * * @jayeshmahajan

Looks like it doenst like 2 schedule in sinngle cron with coma
I would suggest to try with 2 different job

or

Cron schedule: “*/10 4-5 * * *” # Covers 4:00 AM to 5:59 AM
and add condition check like this.

#!/bin/bash
current_time=$(date +%H:%M)
if [[ "$current_time" > "03:59" && "$current_time" < "05:31" ]]; then
  echo "Running job at $current_time"
  # Add your job logic here
else
  echo "Skipping job at $current_time"
fi