apiVersion: v1
kind: PersistentVolume
metadata:
  name: data-elasticsearch-cluster-0
  labels:
    type: local
    app: elasticsearch 
spec:
  capacity:
    storage: 30Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: {{ .Values.global.ELASTICSEARCH_PATH1 }}
  persistentVolumeReclaimPolicy: Retain
  storageClassName: elasticsearch-storage
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: {{ .Values.global.affinity_key }}
          operator: In
          values:
          - {{ .Values.global.affinity_value1 }}
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: data-elasticsearch-cluster-1
  labels:
    type: local
    app: elasticsearch
spec:
  capacity:
    storage: 30Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: {{ .Values.global.ELASTICSEARCH_PATH2 }}
  persistentVolumeReclaimPolicy: Retain
  storageClassName: elasticsearch-storage
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: {{ .Values.global.affinity_key }}
          operator: In
          values:
          - {{ .Values.global.affinity_value2 }}
---
#apiVersion: v1
#kind: PersistentVolume
#metadata:
#  name: data-elasticsearch-cluster-2
#  labels:
#    type: local
#    app: elasticsearch
#spec:
#  capacity:
#    storage: 30Gi
#  accessModes:
#    - ReadWriteOnce
#  hostPath:
#    path: {{ .Values.global.ELASTICSEARCH_PATH3 }}
#  persistentVolumeReclaimPolicy: Retain
#  storageClassName: elasticsearch-storage
#  nodeAffinity:
#    required:
#      nodeSelectorTerms:
#      - matchExpressions:
#        - key: kubernetes.io/hostname
#          operator: In
#          values:
#          - {{ .Values.global.ELASTICSEARCH_HOST3 }}
