# requires configuration loaded as config map, you can do so with
# kubectl create configmap jira-config --from-file=<path to jira config.yaml>,
# example config file is in common/jira/config.yaml same config file works
# for both jira producer and consumer
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: hello
spec:
  schedule: "0 * * * *" # every hour
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: dracon-sync
              image: thoughtmachine/dracon-producer-jira
              env:
                - name: DRACON_SYNC_TOKEN
                  value: "<your jira api token>"
                - name: DRACON_SYNC_USER
                  value: "<the email of the jira user>"
                - name: DRACON_SYNC_DBCON
                  value: "<dracon enrichment db connection string>"
              volumeMounts:
                - name: jira-config
                  mountPath: /etc/jira/
                  readOnly: true
              args:
                - --dryRun  # remove for actual syncing
                - --jira
                - "<url of jira instance>"
                - --query
                - '<a jira JQL that returns the vulnerabilities you want>, usually something like "filter=1234 AND issue.type=Vulnerability"'
                - --config
                - /etc/jira/config.yaml
          restartPolicy: OnFailure
          volumes:
            - name: jira-config
              configMap:
                name: jira-config
