apiVersion: batch/v1
kind: Job
metadata:
  name: fabric-ca-k8s
spec:
  backoffLimit: 1
  template:
    metadata:
      name: fabric-ca-k8s
    spec:
      restartPolicy: "Never"
      volumes:
      - name: redis-storage
        persistentVolumeClaim:
          claimName: mypvc
      
      containers:
      - name: fabric-ca-k8s
        image: hyperledger/fabric-ca:1.4.4
        command: ["sh", "-c", "sleep 1 && fabric-ca-server init -b admin:adminpw -d --port 7054 "]
        env:
        - name: FABRIC_CA_SERVER_HOME
          value: /shared/hyperledger/fabric-ca/k8s
        - name: FABRIC_CA_SERVER_CSR_CN
          value: "fabric-ca-k8s"
        - name: FABRIC_CA_SERVER_CSR_HOSTS
          value: 0.0.0.0
        - name: FABRIC_CA_SERVER_DEBUG
          value: "true"
        # Uncomment if you want to run the CA with TLS enabled.  It is disabled by default. You can also run fabric-ca-server init and customize the fabric-ca-server-config.yaml file.  
        # - name: FABRIC_CA_SERVER_TLS_ENABLED
        #   value: "true"
        - name: GODEBUG
          value: "netdns=go"
        ports:
        - containerPort: 7054
        volumeMounts:
        - mountPath: /shared
          name: redis-storage