apiVersion: apps/v1
kind: Deployment
metadata:
  name: $REPONAME
  labels:
    app: $REPONAME
spec:
  replicas: 2
  selector:
    matchLabels:
      app: $REPONAME
  template:
    metadata:
      labels:
        app: $REPONAME
        name: $REPONAME
    spec:
        containers:
          - name: $REPONAME
            image: $IMAGE
            env:
             - name: ENV
               value: "$ENVIRONMET"
             - name: NATS_SERVICE_URL
               value: "$NATS_SERVICE_URL"
             - name: DATA_SOURCE_URL
               value: "$DATA_SOURCE_URL"
             - name: APPLICATION_PORT
               value: "$APPLICATION_PORT"
            volumeMounts:
              - name: db
                mountPath: "$DATA_SOURCE_URL"
        volumes:
          - name: db
            persistentVolumeClaim:
              claimName: $REPONAME-pvc

---
 apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
   name: $REPONAME-pvc
 spec:
   storageClassName: nfs-csi
   accessModes: [ReadWriteMany]
   resources:
     requests:
       storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
  name: $REPONAME-svc
spec:
  selector:
    app: $REPONAME
  ports:
    - port: 80
      protocol: TCP
      targetPort: $APPLICATION_PORT
      name: grpc
  type: LoadBalancer
