apiVersion: batch/v1
kind: Job
metadata:
  name: create-certs
spec:
  parallelism: 1
  completions: 1
  template:
    metadata:
      name: create-certs
    spec:
      volumes:
        - name: fabricfiles
          persistentVolumeClaim:
            claimName: mypvc
      containers:
        - name: create-certs
          image: hyperledger/fabric-ca-tools:latest
          resources:
            requests:
              memory: "300Mi"
              cpu: "300m"
            limits:
              memory: "500Mi"
              cpu: "350m"
          volumeMounts:
            - mountPath: /organizations
              name: fabricfiles
              subPath: organizations
            - mountPath: /scripts
              name: fabricfiles
              subPath: scripts
          command:
            - /bin/sh
            - -c
            - |
              ./scripts/orderer-certs.sh &&
              ./scripts/org1-certs.sh &&
              ./scripts/org2-certs.sh &&
              ./scripts/org3-certs.sh
      restartPolicy: Never
