---
apiVersion: v1
kind: Service
metadata:
  name: wrestlingdev-influxdb
  labels:
    app: wrestlingdev
    tier: metrics
spec:
  ports:
    - port: 8086
  selector:
    app: wrestlingdev
    tier: metrics
  clusterIP: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wrestlingdev-influxdb
  labels:
    app: wrestlingdev
    tier: metrics
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wrestlingdev
  template:
    metadata:
      labels:
        app: wrestlingdev
        tier: metrics
    spec:
      containers:
      - name: wrestlingdev-influxdb
        image: influxdb:1.8-alpine
        ports:
        - containerPort: 8086
        env:
        - name: INFLUXDB_DB
          valueFrom:
            secretKeyRef:
               name: wrestlingdev-secrets
               key: influxdb_database
        volumeMounts:
        - name: wrestlingdev-influxdb-persistent-storage
          mountPath: /var/lib/influxdb
        # resources:
        #   limits:
        #     memory: "512Mi"
        #   requests:
        #     memory: "128Mi"
        #     cpu: "0.5"
      volumes:
      - name: wrestlingdev-influxdb-persistent-storage
        persistentVolumeClaim:
          claimName: wrestlingdev-influxdb-pv-claim
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wrestlingdev-influxdb-pv-claim
  labels:
    app: wrestlingdev
    tier: metrics
spec:
  # storageClassName: standard
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi