apiVersion: batch/v1
kind: CronJob
metadata:
  name: actions-runner
  # namespace: runners
spec:
  schedule: "*/1 * * * *"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      parallelism: 2
      completions: 4
      ttlSecondsAfterFinished: 100
      template:
        metadata:
          labels:
            app: actions-runner
        spec:
          restartPolicy: Never
          volumes:
          - name: dockersock
            hostPath:
              path: /var/run/docker.sock
          containers:
          - name: runner
            image: myoung34/github-runner:latest
            env:
            - name: EPHEMERAL # Add new env that created by little patch for enable --ephemeral
              value: "1"
            - name: ACCESS_TOKEN
              valueFrom:
                configMapKeyRef:
                  name: runner-config # Need to create runner-config configMap
                  key: ACCESS_TOKEN
            - name: ORG_NAME
              valueFrom:
                configMapKeyRef:
                  name: runner-config # Need to create runner-config configMap
                  key: ORG_NAME
            - name: RUNNER_SCOPE
              value: "org"
            - name: LABELS
              value: container
            - name: RUNNER_NAME_PREFIX
              value: ephemeral-k8s
            volumeMounts:
            - name: dockersock
              mountPath: /var/run/docker.sock
