apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: proton-affiliate-postgres
    version: ${VERSION}
  name: proton-affiliate-postgres
spec:
  serviceName: proton-affiliate-postgres
  replicas: 1
  selector:
    matchLabels:
      app: proton-affiliate-postgres
      version: ${VERSION}
  template:
    metadata:
      labels:
        app: proton-affiliate-postgres
        version: ${VERSION}
    spec:
      imagePullSecrets:
        - name: regcred
      containers:
        - image: postgres:13.3-alpine
          imagePullPolicy: 'Always'
          name: proton-affiliate-postgres
          envFrom:
            - configMapRef:
                name: proton-affiliate-postgres-config
          ports:
            - containerPort: 5432
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgres
              subPath: postgres
  volumeClaimTemplates:
    - metadata:
        name: postgres
      spec:
        accessModes: ['ReadWriteOnce']
        storageClassName: proton-affiliate-storage
        resources:
          requests:
            storage: 100Gi
