--- #---------------- Peer0 org2 Deployment ---------------
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: peer0-org2
  name: peer0-org2
  namespace: hyperledger
spec:
  selector:
    matchLabels:
      app: peer0-org2
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: peer0-org2
    spec:
      containers:
        - args:
            - peer
            - node
            - start
          env:
            - name: FABRIC_LOGGING_SPEC
              value: INFO
            - name: CORE_PEER_ADDRESS
              value: peer0-org2:7051
            - name: CORE_PEER_GOSSIP_EXTERNALENDPOINT
              value: peer0-org2:7051
            - name: CORE_PEER_GOSSIP_BOOTSTRAP
              value: peer0-org2:7051
            - name: CORE_PEER_CHAINCODELISTENADDRESS
              value: localhost:7052
            - name: CORE_PEER_GOSSIP_USELEADERELECTION
              value: "true"
            - name: CORE_PEER_ID
              value: peer0-org2
            - name: CORE_PEER_LOCALMSPID
              value: org2MSP
            - name: CORE_PEER_PROFILE_ENABLED
              value: "true"
            - name: CORE_PEER_TLS_CERT_FILE
              value: /etc/hyperledger/fabric/tls/server.crt
            - name: CORE_PEER_TLS_ENABLED
              value: "true"
            - name: CORE_PEER_TLS_KEY_FILE
              value: /etc/hyperledger/fabric/tls/server.key
            - name: CORE_PEER_TLS_ROOTCERT_FILE
              value: /etc/hyperledger/fabric/tls/ca.crt
            - name: CORE_OPERATIONS_LISTENADDRESS
              value: 0.0.0.0:9443
            - name: CORE_METRICS_PROVIDER
              value: prometheus
          image: hyperledger/fabric-peer:amd64-2.3.1
          name: peer0
          ports:
            - containerPort: 7051
            - containerPort: 7052
            - containerPort: 7053
            - containerPort: 9443
          volumeMounts:
            - mountPath: /etc/hyperledger/fabric/msp
              name: peer0-org2-claim1
            - mountPath: /etc/hyperledger/fabric/tls
              name: peer0-org2-claim2
            - mountPath: /var/hyperledger/production
              name: peer0-persistentdata
            - mountPath: /etc/hyperledger/fabric/core.yaml
              name: builders-config
              subPath: core.yaml
            - mountPath: /builders/external/bin/detect
              name: external-builder-detect
              subPath: detect
            - mountPath: /builders/external/bin/build
              name: external-builder-build
              subPath: build
            - mountPath: /builders/external/bin/release
              name: external-builder-release
              subPath: release
      restartPolicy: Always
      volumes:
        - name: peer0-org2-claim1
          hostPath:
            path: /home/fabric-external-chaincodes/crypto-config/peerOrganizations/org2/peers/peer0-org2/msp
            type: Directory
        - name: peer0-org2-claim2
          hostPath:
            path: /home/fabric-external-chaincodes/crypto-config/peerOrganizations/org2/peers/peer0-org2/tls
            type: Directory
        - name: peer0-persistentdata
          hostPath:
            path: /home/storage/peer0-org2
            type: DirectoryOrCreate
        - name: builders-config
          configMap:
            name: builders-config
            items:
              - key: core.yaml
                path: core.yaml
        - name: external-builder-detect
          configMap:
            name: builders-config
            items:
              - key: detect
                path: detect
                mode: 0544
        - name: external-builder-build
          configMap:
            name: builders-config
            items:
              - key: build
                path: build
                mode: 0544
        - name: external-builder-release
          configMap:
            name: builders-config
            items:
              - key: release
                path: release
                mode: 0544
