apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: influxdb
  namespace: openmcp
spec:
  selector:
    matchLabels:
      app: influxdb
  serviceName: influxdb
  replicas: 2
  template:
    metadata:
      labels:
        app: influxdb
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - influx
            topologyKey: "kubernetes.io/hostname"
      containers:
      - name: influxdb
        image: docker.io/influxdb:1.6.4
        imagePullPolicy: IfNotPresent
        envFrom:
        - secretRef:
            name: influxdb-creds
        volumeMounts:
        - mountPath: /var/lib/influxdb
          name: var-lib-influxdb
        - mountPath: /etc/localtime
          name: timezone-config
      volumes:
      #- name: var-lib-influxdb
      #  persistentVolumeClaim:
      #    claimName: pvc-influxdb
      - name: timezone-config
        hostPath:
          path: /usr/share/zoneinfo/Asia/Seoul
      #tolerations:
      #  - key: node.kubernetes.io/not-ready
      #    effect: NoExecute
      #    tolerationSeconds: 0
      #  - key: node.kubernetes.io/unreachable
      #    effect: NoExecute
      #    tolerationSeconds:a
  volumeClaimTemplates:
  - metadata:
      name: var-lib-influxdb
    spec:
      accessModes: 
      - ReadWriteMany
      resources:
        requests:
          storage: 2Gi
