apiVersion: apps/v1
kind: Deployment
metadata:
  name: db
  namespace: tekton-hub-preview
  labels:
    app: db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: db
  template:
    metadata:
      labels:
        app: db
    spec:
      containers:
        - name: db
          image: postgres:13@sha256:260a98d976574b439712c35914fdcb840755233f79f3e27ea632543f78b7a21e
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 5432
              protocol: TCP
          env:
            - name: POSTGRES_DB
              valueFrom:
                secretKeyRef:
                  name: db
                  key: POSTGRESQL_DATABASE
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  name: db
                  key: POSTGRESQL_USER
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: db
                  key: POSTGRESQL_PASSWORD
            - name: PGDATA
              value: /var/lib/postgresql/data/pgdata
          volumeMounts:
            - name: db
              mountPath: /var/lib/postgresql/data
      volumes:
        - name: db
          persistentVolumeClaim:
            claimName: db
      restartPolicy: Always
