apiVersion: batch/v1
kind: Job
metadata:
# Kubernetes 社区里使用 Job 的一个很普遍的模式。
# mkdir ./jobs
# for i in apple banana cherry
# do
#   cat job-tmpl.yaml | sed "s/\$ITEM/$i/" > ./jobs/job-$i.yaml
# done
  name: process-item-$ITEM
  labels:
    jobgroup: jobexample
spec:
  template:
    metadata:
      name: jobexample
      labels:
        jobgroup: jobexample
    spec:
      containers:
      - name: c
        image: busybox
        command: ["sh", "-c", "echo Processing item $ITEM && sleep 5"]
      restartPolicy: Never
