{{ define "app.customer_volume" }}

{{ if .Values.persistent_volume_claim }}
persistentVolumeClaim:
  claimName: {{ .Values.persistent_volume_claim }}
{{ else }}
hostPath:
  path: /data/{{.Values.customer}}
  type: Directory
{{ end }}

{{ end }}

{{- define "app.customer_volume_config" -}}
{{- if .Values.persistent_volume_claim -}}
{ "persistentVolumeClaim": { "claimName": "{{ .Values.persistent_volume_claim }}" } }
{{- else -}}
{ "hostPath": { "path": "/data/{{.Values.customer}}", "type": "Directory" } }
{{- end -}}

{{- end -}}

{{- define "app.affinity" -}}
{{- if .Values.azure }}
affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: agentpool
          operator: NotIn
          values:
          - agentpool
{{- end -}}
{{- end }}
