apiVersion: v1
kind: Service
metadata:
  name: memberships
  namespace: {{ .Release.Namespace }}
spec:
  type: ClusterIP
  selector:
    app: memberships
  ports:
    - name: {{ .Values.portName }}
      protocol: TCP
      port: 80
      targetPort: {{ .Values.portName }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: memberships
  namespace: {{ .Release.Namespace }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: memberships
  template:
    metadata:
      labels:
        app: memberships
    spec:
      containers:
      - name: memberships
        image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
        ports:
        - name: {{ .Values.portName }}
          containerPort: 8080
          protocol: TCP
        command:
        - memberships
        - --port=8080
        - --db-path=/data/memberships.db
        volumeMounts:
        - name: memberships
          mountPath: /data
      volumes:
      - name: memberships
        persistentVolumeClaim:
          claimName: memberships
