apiVersion: apps/v1
kind: Deployment
metadata:
  name: restfulci-pipeline-postgres
  namespace: pipeline-api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: restfulci/pipeline-postgres:60644c34f3c6cb1ffa31b3ff45aeb36138afeb09
          imagePullPolicy: "IfNotPresent"
          ports:
          - containerPort: 5432
          env:
          - name: POSTGRES_DB
            value: restfulci-pipeline
          - name: POSTGRES_USER
            value: postgres
          - name: POSTGRES_PASSWORD
            value: postgres
          # TODO:
          # We never deploy the database schema to this pod. E2E tests still work,
          # because Hibernates will automatically deploy the database tables.
          # However, we lost the postgres functions:
          # > restfulci=# \df+
          #
          # We should either add a ConfigMap which contains the schema,
          # and potentially generate it from file through Kustomize
          # configMapGenerator:
          # https://kubectl.docs.kubernetes.io/pages/app_management/secrets_and_configmaps.html
          #
          # Or we can bake `setup.sql` into `/docker-entrypoint-initdb.d` into
          # an image (need a docker hub storage then). It is kind of less
          # important, because we probably need to handle liquibase (as a Kubernetes
          # job) anyway.
          resources:
            requests:
              cpu: 50m
