apiVersion: apps/v1
kind: Deployment
metadata:
  name: alameda-influxdb
  namespace: federatorai
  labels:
    app: alameda
    component: alameda-influxdb
  annotations:
    description: Defines how to deploy the application influxdb
    template.alpha.openshift.io/wait-for-ready: 'true'
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
        component: alameda-influxdb
  template:
    metadata:
      labels:
        app: alameda
        component: alameda-influxdb
    spec:
      # securityContext:
      #   runAsUser: 1000
      containers:
      - name: influxdb
        image: influxdb:1.7-alpine
        imagePullPolicy: IfNotPresent
        env:
        - name: INFLUXDB_REPORTING_DISABLED
          value: "true"
        - name: INFLUXDB_HTTP_HTTPS_ENABLED
          value: "true"
        - name: INFLUXDB_HTTP_HTTPS_CERTIFICATE
          value: "/etc/tls/private/tls.crt"
        - name: INFLUXDB_HTTP_HTTPS_PRIVATE_KEY
          value: "/etc/tls/private/tls.key"
        - name: INFLUXDB_HTTP_AUTH_ENABLED
          value: "true"
        - name: INFLUXDB_ADMIN_USER
          value: "admin"
        - name: INFLUXDB_ADMIN_PASSWORD
          value: "adminpass"
        - name: INFLUXDB_USER
          value: "user"
        - name: INFLUXDB_USER_PASSWORD
          value: "userpass"
        volumeMounts:
        - mountPath: /etc/tls/private
          name: alameda-influxdb-tls
          readOnly: false
        - mountPath: /var/lib/influxdb
          name: influxdb-data-storage
          subPath: influxdb
      volumes:
      - name: influxdb-data-storage
      - name: influxdb-log-storage
      - name: alameda-influxdb-tls
        secret:
          secretName: alameda-influxdb-tls
