apiVersion: apps/v1
kind: Deployment
metadata:
  name: server
  namespace: {{ .Release.Namespace }}
spec:
  selector:
    matchLabels:
      app: server
  replicas: 1
  template:
    metadata:
      labels:
        app: server
    spec:
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: {{ .Values.persistentVolumeClaimName }}
      containers:
      - name: server
        image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
        imagePullPolicy: {{ .Values.image.pullPolicy }}
        env:
        - name: ROCKET_PORT
          value: "80"
        - name: DISABLE_ADMIN_TOKEN
          value: "true"
        - name: DOMAIN
          value: https://{{ .Values.domain }}
        ports:
        - name: {{ .Values.httpPortName }}
          containerPort: 80
          protocol: TCP
        volumeMounts:
        - name: data
          mountPath: /data
---
apiVersion: v1
kind: Service
metadata:
  name: server
  namespace: {{ .Release.Namespace }}
spec:
  type: ClusterIP
  selector:
    app: server
  ports:
  - name: http
    port: 80
    targetPort: {{ .Values.httpPortName }}
    protocol: TCP
