cetic / helm-nifi

Helm Chart for Apache Nifi
Apache License 2.0
213 stars 220 forks source link

[cetic/nifi] Using subpath for persistence #289

Closed timesy closed 1 year ago

timesy commented 1 year ago

Thank you for your work on the Helm chart, it was really helpful so far!

Is your feature request related to a problem? Please describe. When using persistent storage with this chart, I want to use azurefile-premium (as it is costly with the many reads/writes on azurefile). However this would currently create a 100Gi volume for each directory (logs, config-data, data, ...).

Describe the solution you'd like I would like to be able to set a sub path in order to put these files all on the same volume. I tested it locally by changing statefulset.yaml and values.yaml:

values.yaml

persistence:
    enabled: true
    subPath: data

statefulset.yaml (Just exemplary, would be replaced for every mountPath that has persistence):

- name: {{ .Values.persistence.subPath | default "auth-conf" }}
            mountPath: /opt/nifi/nifi-current/auth-conf/
            {{- if and .Values.persistence.enabled .Values.persistence.subPath }}
            subPath: auth-conf
       {{- end }}

  ...

{{- if and .Values.persistence.enabled .Values.persistence.subPath }}
  volumeClaimTemplates:
    - metadata:
        name: {{ .Values.persistence.subPath }}
      spec:
        accessModes:
        {{- range .Values.persistence.accessModes }}
          - {{ . | quote }}
        {{- end }}
        storageClassName: {{ .Values.persistence.storageClass | quote }}
        resources:
          requests:
            storage: {{ .Values.persistence.size }}
{{- end }}
{{- if and .Values.persistence.enabled (not .Values.persistence.subPath) }}
 (same as before)
{{- end }}

Describe alternatives you've considered Maybe I am missing something or there is a better way to reach that goal, however I wasn't able to find something else.

emrge-michaeld commented 1 year ago

I second this. 7 volumes is excessive. Digital Ocean only allows 7 PVs per node, so it is hard to fit nifi on there.

Here is the k8s docs on using subpath: https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath In response to the 'not use in production' see this link in response https://stackoverflow.com/questions/70358753/is-it-fundamentally-wrong-to-use-volumemounts-subpath-in-a-production-setup

banzo commented 1 year ago

@timesy @emrge-michaeld Could you propose a pull request with this feature?