apiVersion: apps/v1
kind: Deployment
metadata:
  name: dlt-gateway
  namespace: dlt
spec:
  replicas: 3
  selector:
    matchLabels:
      app: dlt-gateway
  template:
    metadata:
      labels:
        app: dlt-gateway
    spec:
      containers:
      - name: dlt-gateway
        image: shaifvier/dltgateway:v1.0.0
        ports:
        - containerPort: 50051
        volumeMounts:
        - mountPath: /test-network
          name: dlt-volume
          readOnly: true  # Mount the volume as read-only
        env:
        - name: CHANNEL_NAME
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: CHANNEL_NAME
        - name: CHAINCODE_NAME
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: CHAINCODE_NAME
        - name: MSP_ID
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: MSP_ID
        - name: PEER_ENDPOINT
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: PEER_ENDPOINT
        - name: PEER_HOST_ALIAS
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: PEER_HOST_ALIAS
        - name: CRYPTO_PATH
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: CRYPTO_PATH
        - name: KEY_DIRECTORY_PATH
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: KEY_DIRECTORY_PATH
        - name: CERT_DIRECTORY_PATH
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: CERT_DIRECTORY_PATH
        - name: TLS_CERT_PATH
          valueFrom:
            configMapKeyRef:
              name: dlt-config
              key: TLS_CERT_PATH
      volumes:
      - name: dlt-volume
        persistentVolumeClaim:
          claimName: dlt-pvc
