me25
me25

Reputation: 557

how to apply custom-values.yaml on two subchart which is part for main chart

Chart.yaml:-

dependencies:
     - name: prometheus-operator
       version: 8.16.1
       repository: https://kubernetes-charts.storage.googleapis.com/
     - name: fluentd-elasticsearch
       version: 9.4.2
       repository: https://kiwigrid.github.io

Custom-values.yaml

# Change default node-exporter port
prometheus-node-exporter:
  service:
    port: 30206
    targetPort: 30206
prometheus:
  prometheusSpec:
    storageSpec:
       volumeClaimTemplate:
         spec:
           storageClassName: efs
           accessModes: ["ReadWriteOnce"]
           resources:
             requests:
               storage: 5Gi
         selector: {}
elasticsearch:
  hosts: ["https://vpc-logs-abcd:443"]

Running command:-

helm install --namespace dependency test -f /root/custom-values.yaml  /root/customchart

Error/Problem:- Custom-values.yaml is NOT applied on the chart !! Chart Installed with "Default values"

Upvotes: 0

Views: 616

Answers (2)

hoque
hoque

Reputation: 6471

As described here to pass value in subchart you need to define value under dependent chart name section like following

prometheus-operator:
# Change default node-exporter port
  prometheus-node-exporter:
    service:
      port: 30206
      targetPort: 30206
  prometheus:
    prometheusSpec:
      storageSpec:
         volumeClaimTemplate:
           spec:
             storageClassName: efs
             accessModes: ["ReadWriteOnce"]
             resources:
               requests:
                 storage: 5Gi
           selector: {}

fluentd-elasticsearch:
  elasticsearch:
    hosts: ["https://vpc-logs-abcd:443"]

Upvotes: 0

David Maze
David Maze

Reputation: 159790

When Helm installs a dependency chart, only the values under the dependency's name are made visible to that chart. When for instance the prometheus-operator chart documentation lists configuration values, those need to be underneath the name of the dependency in your custom-values.yaml.

So your values need to be rearranged to look like:

prometheus-operator: # dependency name from requirements.yaml/chart.yaml
  prometheus:
    prometheusSpec:
      storageSpec: { ... } # as you have it
  prometheus-node-exporter:
    # (Some settings are under nodeExporter; "service" isn't listed
    # in the chart docs)
    ...

fluentd-elasticsearch: # settings for the other dependency
  elasticsearch:
    hosts: ["https://vpc-logs-abcd:443"]

Upvotes: 1

Related Questions