---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: lodging
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lodging
  strategy:
    rollingUpdate:
      maxSurge: 3
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: lodging
    spec:
      volumes:
        - name: postgres-pv-lodging
          persistentVolumeClaim:
            claimName: lodging-pv-claim
      containers:
        - env:
            - name: ConnectionStrings__pgsql
              value: 'Host=localhost;Database=LodgingData;Username=postgres;Password=LodgingData@2020;'
            - name: ConnectionStrings__zipkin
              value: 'http://zipkin:9411/'
          image: docker.pkg.github.com/rvtr/rvtrx-api-lodging/lodging:master-aspnet-rest
          imagePullPolicy: Always
          name: lodging
          ports:
            - containerPort: 80
              name: lodging-http

        - env:
            - name: POSTGRES_PASSWORD
              value: LodgingData@2020
          image: postgres:12
          imagePullPolicy: Always
          name: postgres
          ports:
            - containerPort: 5432
              name: postgres-tcp
          volumeMounts:
            - mountPath: /lodging/storage
              name: postgres-pv-lodging
      imagePullSecrets:
        - name: github
