apache / solr-operator

Official Kubernetes operator for Apache Solr
https://solr.apache.org/operator
Apache License 2.0
243 stars 112 forks source link

Adding support to dynamic value in values.yaml #661

Open idolaman opened 7 months ago

idolaman commented 7 months ago

First of all this project is amazing!

I encountered an issue when i tried to use this chart as an dependency to my chart.

in my use case i want to be able to give a dynamic value in values yaml. for an example i want that the configmap name to be dynamic because i want to deploy multiple solr cluters in the same k8s envirement. my chart values.yaml

global:
  configmap: idolaman

solr:
  podOptions:
    volumes:
      - name: my-configmap
        source:
          configMap:
            name: "{{ .Values.global.configmap }}"

...

my Chart.yaml

name: idolaman-solr
dependencies:
  - name: solr
    ....

an solution might be change the solr chart to evaluate using tpl every value it gets

HoustonPutman commented 7 months ago

Is this common for other Helm charts?

I understand how it could be useful, but it would add a lot of complexity to the already fairly complex helm chart.

almogtavor commented 7 months ago

@HoustonPutman I also think that it would be nice and actually I think it's quite common. I've found this article that helps with this issue. In this example, the tpl function is used in the Helm chart templates to allow for dynamic referencing of values. Useful for scenarios where you want to deploy multiple instances of an application (like multiple Solr clusters).

This example aligns with this scenario where we want to dynamically set the configmap name for deploying multiple Solr clusters.

To show the need for the feature in general I'm referring you to a SO question the requests the same.