{{- if .Values.chartmuseum.enabled }}
{{- $persistence := .Values.persistence -}}
{{- if $persistence.enabled }}
{{- $chartmuseum := $persistence.persistentVolumeClaim.chartmuseum -}}
{{- if and (not $chartmuseum.existingClaim) (eq $persistence.imageChartStorage.type "filesystem") }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ template "harbor.chartmuseum" . }}
  {{- if eq $persistence.resourcePolicy "keep" }}
  annotations:
    helm.sh/resource-policy: keep
  {{- end }}
  labels:
{{ include "harbor.labels" . | indent 4 }}
    component: chartmuseum
spec:
  accessModes: 
    - {{ $chartmuseum.accessMode }}
  resources:
    requests:
      storage: {{ $chartmuseum.size }}
  {{- if $chartmuseum.storageClass }}
    {{- if eq "-" $chartmuseum.storageClass }}
  storageClassName: ""
    {{- else }}
  storageClassName: {{ $chartmuseum.storageClass }}
    {{- end }}
  {{- end }}
{{- end }}
{{- end }}
{{- end }}