seaweedfs / seaweedfs-csi-driver

SeaweedFS CSI Driver https://github.com/seaweedfs/seaweedfs
Apache License 2.0
220 stars 50 forks source link

Simplify Helm Charts for Maximum Flexibility #116

Open washcycle opened 1 year ago

washcycle commented 1 year ago

Right now, folks are hardcoding their specific use cases into the helm charts creating spaghetti code.

I propose a refactoring to pull all parameters into the values.yaml

e.g.

possible values.yaml definition

container:
  args:
    - "--endpoint=$(CSI_ENDPOINT)"
    - "--filer=$(SEAWEEDFS_FILER)"
    - "--nodeid=$(NODE_ID)"
    - "--cacheDir=/var/cache/seaweedfs"
    - "--concurrentWriters=10"
    - "--cacheSizeMB=2024"

helm template simplifies from

           args:
            - "--endpoint=$(CSI_ENDPOINT)"
            - "--filer=$(SEAWEEDFS_FILER)"
            - "--nodeid=$(NODE_ID)"
            - "--cacheDir=/var/cache/seaweedfs"
            - "--dataLocality={{ .Values.dataLocality }}"
            - "--concurrentWriters=10"
            # {{- if .Values.node.injectTopologyInfoFromNodeLabel.enabled }}
            # - "--dataCenter=$(DATACENTER)"
            # {{- end }}

to

          args:
            {{- toYaml .Values.container.args | nindent 12 }}        

Then each individual can add things like data locality without breaking the base helm templates for others. This also makes it forward compatible with any parameter additions. Just update the image and the values.yaml with the new parameter you want to use.

Would need to do this modification for annotations, labels, envs, persistence storage etc.