apiVersion: batch/v1beta1
kind: CronJob
metadata:
  labels:
    app: get-random-user
  name: get-random-user
spec:
  jobTemplate:
    metadata:
      labels:
        app: get-random-user
      name: get-random-user
    spec:
      parallelism: 2
      completions: 6
      template:
        metadata:
          labels:
            app: get-random-user
        spec:
          containers:
          - command:
            - sh
            - -c
            - "echo Pod ${HOSTNAME} got data from user `curl -sSL https://randomuser.me/api/?format=csv\\&inc=email | grep -v email | cut -d: -f2`"
            image: curlimages/curl
            name: get-random-user
            resources:
              requests:
                cpu: 100m
                memory: 100Mi
              limits:
                cpu: 100m
                memory: 100Mi
          restartPolicy: OnFailure
  schedule: '* * * * *'
