--- #---------------- Orderer1 1Deployment ---------------
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: orderer1
  name: orderer1
  namespace: hyperledger
spec:
  selector:
    matchLabels:
      app: orderer1
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: orderer1
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: "app"
                      operator: In
                      values:
                        - orderer0
                        - orderer2
                topologyKey: "kubernetes.io/hostname"
      containers:
        - args:
            - orderer
          env:
            - name: FABRIC_LOGGING_SPEC
              value: INFO
            - name: ORDERER_OPERATIONS_LISTENADDRESS
              value: 0.0.0.0:8443
            - name: ORDERER_METRICS_PROVIDER
              value: prometheus
            - name: ORDERER_GENERAL_GENESISFILE
              value: /var/hyperledger/orderer/genesis.block
            - name: ORDERER_GENERAL_BOOTSTRAPMETHOD
              value: file
            - name: ORDERER_CHANNELPARTICIPATION_ENABLED
              value: "true"
            - name: ORDERER_GENERAL_LISTENADDRESS
              value: 0.0.0.0
            - name: ORDERER_GENERAL_LISTENPORT
              value: "7050"
            - name: ORDERER_GENERAL_LOCALMSPDIR
              value: /var/hyperledger/orderer/msp
            - name: ORDERER_GENERAL_LOCALMSPID
              value: OrdererMSP
            - name: ORDERER_GENERAL_TLS_CERTIFICATE
              value: /var/hyperledger/orderer/tls/server.crt
            - name: ORDERER_GENERAL_TLS_ENABLED
              value: "true"
            - name: ORDERER_GENERAL_TLS_PRIVATEKEY
              value: /var/hyperledger/orderer/tls/server.key
            - name: ORDERER_GENERAL_TLS_ROOTCAS
              value: "[/var/hyperledger/orderer/tls/ca.crt]"
            - name: ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE
              value: /var/hyperledger/orderer/tls/server.crt
            - name: ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY
              value: /var/hyperledger/orderer/tls/server.key
            - name: ORDERER_GENERAL_CLUSTER_ROOTCAS
              value: "[/var/hyperledger/orderer/tls/ca.crt]"
            - name: ORDERER_ADMIN_TLS_CERTIFICATE
              value: /var/hyperledger/orderer/tls/server.crt
            - name: ORDERER_ADMIN_TLS_ENABLED
              value: "true"
            - name: ORDERER_ADMIN_TLS_PRIVATEKEY
              value: /var/hyperledger/orderer/tls/server.key
            - name: ORDERER_ADMIN_TLS_ROOTCAS
              value: "[/var/hyperledger/orderer/tls/ca.crt]"
            - name: ORDERER_ADMIN_TLS_CLIENTROOTCAS
              value: "[/var/hyperledger/orderer/tls/ca.crt]"
            - name: ORDERER_ADMIN_LISTENADDRESS
              value: "0.0.0.0:7053"
          image: hyperledger/fabric-orderer:amd64-2.3.1
          name: orderer
          ports:
            - containerPort: 7050
            - containerPort: 8443
          volumeMounts:
            - mountPath: /var/hyperledger/production
              name: orderer1-persistentdata
            - mountPath: /var/hyperledger/orderer/genesis.block
              name: orderer1-claim0
            - mountPath: /var/hyperledger/orderer/msp
              name: orderer1-claim1
            - mountPath: /var/hyperledger/orderer/tls
              name: orderer1-claim2
          workingDir: /opt/gopath/src/github.com/hyperledger/fabric
      restartPolicy: Always
      volumes:
        - name: orderer1-persistentdata
          hostPath:
            path: /home/storage/orderer1
            type: DirectoryOrCreate
        - name: orderer1-claim0
          hostPath:
            path: /home/fabric-external-chaincodes/channel-artifacts/genesis.block
        - name: orderer1-claim1
          hostPath:
            path: /home/fabric-external-chaincodes/crypto-config/ordererOrganizations/consortium/orderers/orderer1/msp
        - name: orderer1-claim2
          hostPath:
            path: /home/fabric-external-chaincodes/crypto-config/ordererOrganizations/consortium/orderers/orderer1/tls
