apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: 'my-gitlabpostgres'
  name: 'my-gitlabpostgres'
spec:
  replicas: 1
  selector:
    matchLabels:
      app: 'my-gitlabpostgres'
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: 'my-gitlabpostgres'
    spec:
      containers:
        - name: 'my-gitlabpostgres'
          env:
            - name: POSTGRES_USER
              value: root
            - name: POSTGRES_PASSWORD
              value: 'STRONGPOSTGRESPASS'
            - name: POSTGRES_DB
              value: 'my-gitlab'
          image: 'postgres:11.8'
          ports:
            - containerPort: 5432
              protocol: TCP
          resources:
            limits:
              cpu: '2'
              ephemeral-storage: '2G'
              memory: '2G'
            requests:
              cpu: '2'
              ephemeral-storage: '2G'
              memory: '2G'
          volumeMounts:
            - name: 'my-gitlabpostgres-vol'
              mountPath: /var/lib/postgresql/data
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
        - name: 'my-gitlabpostgres-adminer'
          env:
            - name: ADMINER_DEFAULT_SERVER
              value: 'my-gitlabpostgres-svc'
          image: 'adminer:latest'
          ports:
            - containerPort: 8080
              protocol: TCP
          resources:
            limits:
              cpu: '1'
              ephemeral-storage: '1G'
              memory: '1G'
            requests:
              cpu: '1'
              ephemeral-storage: '1G'
              memory: '1G'
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      volumes:
        - name: 'my-gitlabpostgres-vol'
          persistentVolumeClaim:
            claimName: 'my-gitlabpostgres-vol'
