{{ if .Values.pages_server.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pages-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pages-server
  template:
    metadata:
      name: pages-server
      labels:
        app: pages-server
    spec:
      terminationGracePeriodSeconds: 1
      containers:
      - name: pages-server
        image: docker.io/goalprofit/pages-server:{{.Values.pages_server.version}}
        imagePullPolicy: Always
        env:
          - name: WORK_DIR
            value: {{.Values.pages_server.workDir}}
          - name: STATIC_DIR
            value: {{.Values.pages_server.staticDir}}
          - name: TARGET_SERVER_HOSTNAME
            value: {{.Values.pages_server.targetServerHostname}}
        volumeMounts:
        - mountPath: /data
          name: customer
          subPath: data/pages-server
        - mountPath: /work
          name: customer
          subPath: data
      imagePullSecrets:
      - name: regcred
        
      volumes:
      - name: customer
        {{ include "app.customer_volume" . | nindent 8}}
      {{ include "app.affinity" . | nindent 6}}
---
apiVersion: v1
kind: Service
metadata:
  name: pages-server
spec:
  type: ClusterIP
  selector:
    app: pages-server
  ports:
    - name: http
      protocol: TCP
      port: 8080
      targetPort: 8080
{{ end }}