apiVersion: batch/v1
kind: Job
metadata:
  name: bbrf-url2domain-BBS_PROJECT_CODE
  labels:
    app: bbrf-url2domain-BBS_PROJECT_CODE
spec:
  ttlSecondsAfterFinished: 100
  template:
    metadata:
      labels:
        app: bbrf-url2domain-BBS_PROJECT_CODE
    spec:
      volumes:
      - name: data-volume
        hostPath: 
          path: /mnt/volume_lon1_01
          type: Directory
      containers:
      - name: bbrf-url2domain-BBS_PROJECT_CODE
        image: smokingcaterpillar/bbs-osintel-gau-subs
        volumeMounts:
        - name: data-volume
          mountPath: /optdata
        command: 
        - /bin/sh
        - -c
        - |
          echo bbrf-url2domain v1
          echo Code: BBS_PROJECT_CODE
          echo Id: BBS_PROJECT_ID
          echo List: BBS_PROJECT_LIST
          
          ## BBRF SETUP ##
          echo setting up BBRF...
          cp /optdata/BBS/output/private/bbrs-config.json /root/.bbrf/config.json
          bbrf use BBS_PROJECT_CODE
          ## BBRF SETUP ##
          
          mkdir -p /optdata/BBS/output/project-data/BBS_PROJECT_CODE/data/bbrf/
          
          
          echo dumping domains from urls
          bbrf urls | unfurl format %d | anew | bbrf domain add - -t "added_by:url2domain"
         
            
          echo all done
      restartPolicy: Never

