--- #---------------- Peer0 org1 Deployment ---------------
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: peer0-org1
  name: peer0-org1
  namespace: hyperledger
spec:
  selector:
    matchLabels:
      app: peer0-org1
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: peer0-org1
    spec:
      nodeSelector:
        tier: api
      containers:
        - args:
            - peer
            - node
            - start
          env:
            - name: CORE_PEER_ADDRESSAUTODETECT
              value: "true"
            - name: FABRIC_LOGGING_SPEC
              value: INFO
            - name: CORE_PEER_ADDRESS
              value: peer0-org1:7051
            - name: CORE_PEER_GOSSIP_EXTERNALENDPOINT
              value: peer0-org1:7051
            - name: CORE_PEER_CHAINCODELISTENADDRESS
              value: 0.0.0.0:7052
            - name: CORE_PEER_GOSSIP_USELEADERELECTION
              value: "true"
            - name: CORE_PEER_GOSSIP_BOOTSTRAP
              value: peer0-org1:7051
            - name: CORE_PEER_ID
              value: peer0-org1
            - name: CORE_PEER_LOCALMSPID
              value: org1MSP
            - name: CORE_PEER_PROFILE_ENABLED
              value: "true"
            - name: CORE_PEER_TLS_CERT_FILE
              value: /share/crypto-config/peerOrganizations/org1/peers/peer0-org1/tls/server.crt
            - name: CORE_PEER_TLS_ENABLED
              value: "true"
            - name: CORE_PEER_TLS_KEY_FILE
              value: /share/crypto-config/peerOrganizations/org1/peers/peer0-org1/tls/server.key
            - name: CORE_PEER_TLS_ROOTCERT_FILE
              value: /share/crypto-config/peerOrganizations/org1/peers/peer0-org1/tls/ca.crt
            - name: CORE_VM_ENDPOINT
              value: http://localhost:2375
            - name: CORE_OPERATIONS_LISTENADDRESS
              value: 0.0.0.0:9443
            - name: CORE_METRICS_PROVIDER
              value: prometheus
            - name: CORE_PEER_MSPCONFIGPATH
              value: /share/crypto-config/peerOrganizations/org1/peers/peer0-org1/msp
            - name: CORE_VM_ENDPOINT
              value: unix:///host/var/run/docker.sock
            - name: CORE_CHAINCODE_BUILDER
              value: hyperledger/fabric-ccenv:amd64-2.2.0
            - name: CORE_CHAINCODE_NODE_RUNTIME
              value: hyperledger/fabric-nodeenv:amd64-2.2.0
          image: hyperledger/fabric-peer:amd64-2.2.0
          name: peer0
          ports:
            - containerPort: 7051
            - containerPort: 7052
            - containerPort: 7053
            - containerPort: 9443
          volumeMounts:
            - mountPath: /host/var/run/
              name: cli-claim0
            - mountPath: /var/hyperledger/production
              name: peer0-persistentdata
            - mountPath: /share
              name: share-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:
        - hostPath:
            path: /var/run/
            type: Directory
          name: cli-claim0
        - name: peer0-persistentdata
          persistentVolumeClaim:
            claimName: org1-peer0-pvc
        - name: share-persistentdata
          persistentVolumeClaim:
            claimName: share-pvc
        - 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
