apiVersion: v1
kind: ReplicationController
metadata:
  name: database
  labels:
    name: database
spec:
  replicas: 1
  selector:
    name: database
  template:
    metadata:
      labels:
        name: database
    spec:
      containers:
        - name: postgres
          image: hnarayanan/postgresql:9.5
          env:
            - name: POSTGRES_DB
              value: app_db
            - name: PGDATA
              value: /var/lib/postgresql/data/pgdata
            # TODO: Use Kubernetes Secret objects to hold the following credentials
            - name: POSTGRES_USER
              value: app_db_user
            - name: POSTGRES_PASSWORD
              value: app_db_pw
          ports:
            - containerPort: 5432
      # TODO: User persistent disks, volumes and claims for the following
      #     volumeMounts:
      #       - mountPath: /var/lib/postgresql/data
      #         name: pg-data
      # volumes:
      #   - name: pg-data
      #     persistentVolumeClaim:
      #       claimName: pg-data-claim
