apiVersion: v1
kind: PersistentVolume
metadata:
  name: data-kafka-cluster-1
  labels:
    type: local
    app: kafka
spec:
  capacity:
    storage: 30Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: {{ .Values.global.IMXC_KAFKA_PV_PATH1 }}
  persistentVolumeReclaimPolicy: Retain
  storageClassName: kafka-broker
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
          - key: {{ .Values.global.affinity_key }}
            operator: In
            values:
            - {{ .Values.global.affinity_value1 }}
          
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: data-kafka-cluster-2
  labels:
    type: local
    app: kafka
spec:
  capacity:
    storage: 30Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: {{ .Values.global.IMXC_KAFKA_PV_PATH2 }}
  persistentVolumeReclaimPolicy: Retain
  storageClassName: kafka-broker
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
          - key: {{ .Values.global.affinity_key }}
            operator: In
            values:
            - {{ .Values.global.affinity_value2 }}
---
# On-prem/워커노드 두개/브로커 두개 환경에서 발생할 수 있는 affinity 충돌때문에 주석처리
#apiVersion: v1
#kind: PersistentVolume
#metadata:
#  name: data-kafka-cluster-3
#  labels:
#    type: local
#    app: kafka
#spec:
#  capacity:
#    storage: 30Gi
#  accessModes:
#    - ReadWriteOnce
#  hostPath:
#    path: {{ .Values.global.IMXC_KAFKA_PV_PATH3 }}
#  persistentVolumeReclaimPolicy: Retain
#  storageClassName: kafka-broker
#  nodeAffinity:
#    required:
#      nodeSelectorTerms:
#      - matchExpressions:
#        - key: kubernetes.io/hostname
#          operator: In
#          values:
  #          - {{ .Values.global.IMXC_KAFKA_HOST3 }}
