apiVersion: apps/v1
kind: Deployment
metadata:
  name: azure-votes-postgresql-deployment
  namespace: asodemo
spec:
  selector:
    matchLabels:
      app: azure-votes-postgresql
  replicas: 1
  template:
    metadata:
      name: postgresql-demo
      labels:
        app: azure-votes-postgresql
    spec:
      containers:
        - name: azure-votes-postgresql
          image: mcr.microsoft.com/k8s/asodemos/postgresqlvotes:latest
          ports:
            - containerPort: 8080
          env:
            - name: USERNAME
              valueFrom:
                secretKeyRef:
                  name: postgres-secret
                  key: USERNAME
            - name: PASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres-secret
                  key: PASSWORD
            - name: SERVER
              valueFrom:
                secretKeyRef:
                  name: postgres-secret
                  key: SERVER
            - name: DATABASE
              valueFrom:
                secretKeyRef:
                  name: postgres-secret
                  key: DATABASE
            - name: PORT
              valueFrom:
                secretKeyRef:
                  name: postgres-secret
                  key: PORT
