apiVersion: apps/v1
kind: Deployment
metadata:
  name: owasp-zap-workflow
  labels:
    app: owasp-zap
spec:
  replicas: 1
  selector:
    matchLabels:
      app: owasp-zap
  template:
    metadata:
      labels:
        app: owasp-zap
    spec:
      containers:
      - name: owasp-zap-ctr
        imagePullPolicy: Always
        image: appsecco/splat-workshop-owasp-zap
        command: ["/usr/bin/splat-sidecar"]
        env:
          - name: SPLAT_MINIO_ENDPOINT
            valueFrom:
              secretKeyRef:
                  name: common-env-secrets
                  key: SPLAT_MINIO_ENDPOINT
          - name: SPLAT_MINIO_ACCESS_KEY
            valueFrom:
              secretKeyRef:
                  name: common-env-secrets
                  key: SPLAT_MINIO_ACCESS_KEY
          - name: SPLAT_MINIO_SECRET_KEY
            valueFrom:
              secretKeyRef:
                  name: common-env-secrets
                  key: SPLAT_MINIO_SECRET_KEY
          - name: MINIO_OUTPUT_BUCKET
            valueFrom:
              secretKeyRef:
                  name: common-env-secrets
                  key: MINIO_OUTPUT_BUCKET
          - name: SPLAT_NATS_URL
            valueFrom:
              secretKeyRef:
                  name: common-env-secrets
                  key: SPLAT_NATS_URL
          - name: SPLAT_MINIO_FILE_PATTERN
            value: scans/{{SCAN_ID}}/{{OUTPUT_EVENT}}/data-{{TIMESTAMP}}.json 
          - name: SPLAT_MINIO_EVENT_NAME
            value: owasp-zap 
          - name: SPLAT_USE_OUTPUT_FILE_PATH
            value: /zap/wrk/data.json
          - name: SPLAT_NATS_CONSUMER_TOPIC
            value: owasp-zap-input
          - name: SPLAT_QUEUE_GROUP_NAME
            value: owasp-zap-tool
          - name: SPLAT_EXEC_PATTERN
            value: "rm /zap/wrk/data.json; /zap/zap-baseline.py -t {{TARGET}} -g gen.conf -J data.json; exit 0"