apiVersion: apps/v1
kind: Deployment
metadata:
  name: apicurio-studio-db
  labels:
    module: apicurio-studio-db
    app.kubernetes.io/managed-by: apicurio-studio-operator
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      module: apicurio-studio-db
  template:
    metadata:
      labels:
        module: apicurio-studio-db
    spec:
      containers:
        - name: postgresql
          image: centos/postgresql-95-centos7:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 5432
              protocol: TCP
          resources:
            limits:
              memory: 512Mi
          livenessProbe:
            tcpSocket:
              port: 5432
            initialDelaySeconds: 30
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            exec:
              command:
                - /bin/sh
                - '-i'
                - '-c'
                - >-
                  psql 127.0.0.1 -U ${POSTGRESQL_USER} -q -d
                  ${POSTGRESQL_DATABASE} -c 'SELECT 1'
            initialDelaySeconds: 5
            timeoutSeconds: 1
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          volumeMounts:
            - name: postgresql-apicurio
              mountPath: /var/lib/pgsql/data
          terminationMessagePath: /dev/termination-log
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}

