How to set label for cronjob(scheduledjob)?

Solution In Progress - Updated -

Issue

  • Job pods don't have label even though I created ScheduledJob/CronJobs as:
apiVersion: batch/v2alpha1
kind: ScheduledJob
metadata:
  name: hello
labels:
  job: test
spec:
  schedule: "* * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: hello
            image: busybox
            args:
            - /bin/sh
            - -c
            - date; echo Hello from the Kubernetes cluster
          restartPolicy: OnFailure
  • Following all pods don't take over the label.
$ oc get pod
NAME                     READY     STATUS      RESTARTS   AGE
hello-1160671760-tahw1   0/1       Completed   0          6h
hello-1160737296-ywvge   0/1       Completed   0          3h
hello-1160802832-3ciew   0/1       Completed   0          23h

Environment

  • OpenShift Container Platform
    • 3.x
  • openshift dedicated

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content