apiVersion: batch/v1
kind: Job
metadata:
  name: update-anchorpeers
spec:
  backoffLimit: 1
  template:
    metadata:
      name: update-anchorpeers
    spec:
      restartPolicy: "Never"
      volumes:
      - name: myvolume
        persistentVolumeClaim:
          claimName: filepvc

      containers:
      - name: update-anchorpeerorg1
        image: hyperledger/fabric-tools:1.4.0
        command: ["sh", "-c", "cd shared/artifacts/channel-artifacts/  && peer channel update -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f Org1MSPanchors.tx"]
        env:
        - name: CHANNEL_NAME
          value: channel1
        - name: CORE_PEER_NETWORKID
          value: nid1
        - name: ORDERER_URL
          value: orderer:31010
        - name: CORE_PEER_ADDRESS
          value: org1peer1:30110
        - name: CORE_PEER_LOCALMSPID
          value: Org1MSP
        - name: CORE_PEER_MSPID
          value: Org1MSP
        - name: FABRIC_LOGGING_SPEC
          value: debug
        - name: CORE_PEER_MSPCONFIGPATH
          value: /shared/artifacts/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
        - name: FABRIC_CFG_PATH
          value: /etc/hyperledger/fabric
        - name: GODEBUG
          value: "netdns=go"
        volumeMounts:
        - mountPath: /shared
          name: myvolume

      - name: update-anchorpeerorg2
        image: hyperledger/fabric-tools:1.4.0
        command: ["sh", "-c", "cd shared/artifacts/channel-artifacts/  && peer channel update -o ${ORDERER_URL} -c ${CHANNEL_NAME} -f Org2MSPanchors.tx"]
        env:
        - name: CHANNEL_NAME
          value: channel1
        - name: CORE_PEER_NETWORKID
          value: nid1
        - name: ORDERER_URL
          value: orderer:31010
        - name: CORE_PEER_ADDRESS
          value: org2peer1:30310
        - name: CORE_PEER_LOCALMSPID
          value: Org2MSP
        - name: CORE_PEER_MSPID
          value: Org2MSP
        - name: FABRIC_LOGGING_SPEC
          value: debug
        - name: CORE_PEER_MSPCONFIGPATH
          value: /shared/artifacts/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
        - name: FABRIC_CFG_PATH
          value: /etc/hyperledger/fabric
        - name: GODEBUG
          value: "netdns=go"
        volumeMounts:
        - mountPath: /shared
          name: myvolume
