This message was deleted.
s
This message was deleted.
p
I am trying to pass values stored in a yaml file
Copy code
const monitoring = new k8s.helm.v3.Chart('prometheus', {
  chart: 'prometheus-operator',
  repo: 'stable',
  version: '9.3.0',
  namespace: 'monitoring',
  values: ['./yaml/monitor-rules.yaml']
}, { provider: clusterProvider })
but got
Copy code
Error: failed to parse /var/folders/_g/0m13wzms5_72f5gxmsv39c6c0000gp/T/tmp-35344jvrL8V6beq0Y.yaml: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal array into Go value of type map[string]interface {}
 
    error: Error: Command failed: helm template /var/folders/_g/0m13wzms5_72f5gxmsv39c6c0000gp/T/tmp-35344t4ns7hzPXR4Q/prometheus-operator --name-template prometheus --values /var/folders/_g/0m13wzms5_72f5gxmsv39c6c0000gp/T/tmp-35344t4ns7hzPXR4Q/prometheus-operator/values.yaml --values /var/folders/_g/0m13wzms5_72f5gxmsv39c6c0000gp/T/tmp-35344jvrL8V6beq0Y.yaml  --namespace monitoring --include-crds
    Error: failed to parse /var/folders/_g/0m13wzms5_72f5gxmsv39c6c0000gp/T/tmp-35344jvrL8V6beq0Y.yaml: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal array into Go value of type map[string]interface {}
so the question is-> how the hell I pass a config file to a helm? 🙂
Copy code
# Installing Prometheus Operator
$ helm install stable/prometheus-operator --version=4.3.6 --name=monitoring --namespace=monitoring --values=values_minikube.yaml
the idea is to pass values as per above
@billowy-army-68599 🙂
b
values
takes a map, so you'll need to pass the values that are in
values_minikube.yaml
as a map. You can read the file with
fs.readFileSync
and pass that to `value, but it might just be easier to copy them from that file
p
mmm
thanks
@billowy-army-68599
the file is quite big, won't be ideal to paste its content there
so, something like this will work?
Copy code
chart: 'prometheus-operator',
  values: {
    value: fs.readSync('yaml/monitor-rules.yaml')
  },
  fetchOpts: {
    repo: '<https://kubernetes-charts.storage.googleapis.com>'
  },
  version: '9.3.0',
  namespace: 'monitoring'
}, { provider: clusterProvider})
b
no, I don't think so. I don't have an example immediately to hand for this and this hasn't been tested, but something like
Copy code
let values = fs.readSync('yaml/monitor-rules.yaml')
values: values
might work
p
let me try 🙂
Copy code
pulumi:pulumi:Stack  ksqldb-dev  running.    manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
so far so good
wonder why it itakes 20 minutes to install prometheus operator
Copy code
pulumi:pulumi:Stack ksqldb-dev running manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
    pulumi:pulumi:Stack ksqldb-dev running manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
    pulumi:pulumi:Stack ksqldb-dev running manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
    pulumi:pulumi:Stack ksqldb-dev running manifest_sorter.go:192: info: skipping unknown hook: "crd-install"
    kubernetes:helm.sh:Chart prometheus  
    gcp:container:Cluster ksqldb-cluster  
    pulumi:providers:kubernetes ksqldb-cluster  
    kubernetes:core:Namespace ksqldb-cluster  
    kubernetes:apps:Deployment ksqldb-cli  
    kubernetes:core:Service ksqldb-service  
    kubernetes:core:Secret ksqldb-secret  
    kubernetes:apps:Deployment ksqldb-server  
@ Previewing update.......
@billowy-army-68599 did not work unfortunately
is there another approach for that?
b
manually is your best bet
p
?
there must be a better way
got a yaml like this
can't put all of that inside values
Copy code
alertmanager:
  config:
    global: {}
    route:
      group_by:
        - alertname
        - cluster
        - service
      group_wait: 10s
      group_interval: 5m
      repeat_interval: 24h
      receiver: slack
      routes:
        - receiver: blackhole
          match:
            alertname: Watchdog
        - receiver: critical
          match_re:
            severity: error|critical
          repeat_interval: 1h
    receivers:
      - name: blackhole
      - name: slack
        slack_configs:
          - api_url: <https://hooks.slack.com/services/T0V9/r84Hf7XtxUL5IjlnGf3XtsjY>
            color: '{{`{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}`}}'
            title: '{{`[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Prometheus Event Notification`}}'
            title_link: '{{`{{ template "slack.default.titlelink" . }}`}}'
            pretext: '{{`{{ .CommonAnnotations.summary }}`}}'
            text: |-
              {{"{{"}} range .Alerts {{"}}"}}
                {{"{{"}}- if .Annotations.summary {{"}}"}}*Alert:* {{"{{"}} .Annotations.summary {{"}}"}} - `{{"{{"}} .Labels.severity {{"}}"}}`{{"{{"}}- end {{"}}"}}
                *Description:* {{"{{"}} .Annotations.description {{"}}"}}{{"{{"}} .Annotations.message {{"}}"}}
                *Graph:* <{{"{{"}} .GeneratorURL {{"}}"}}|:chart_with_upwards_trend:>{{"{{"}} if or .Annotations.runbook .Annotations.runbook_url {{"}}"}} *Runbook:* <{{"{{"}} .Annotations.runbook {{"}}"}}{{"{{"}} .Annotations.runbook_url {{"}}"}}|:spiral_note_pad:>{{"{{"}} end {{"}}"}}
                *Details:*
                {{"{{"}} range .Labels.SortedPairs {{"}}"}} • *{{"{{"}} .Name {{"}}"}}:* `{{"{{"}} .Value {{"}}"}}`
                {{"{{"}} end {{"}}"}}
              {{"{{"}} end {{"}}"}}
            fallback: '{{`{{ template "slack.default.fallback" . }}`}}'
            icon_emoji: '{{`{{ template "slack.default.iconemoji" . }}`}}'
            icon_url: '{{`{{ template "slack.default.iconurl" . }}`}}'
            send_resolved: true
      - name: critical
        slack_configs:
          - api_url: <https://hooks.slack.com/services/T017>\bOvVstWLCCqG2FTTvNmdGq4
            color: '{{`{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}`}}'
            title: '{{`[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Prometheus Event Notification`}}'
            title_link: '{{`{{ template "slack.default.titlelink" . }}`}}'
            pretext: '{{`{{ .CommonAnnotations.summary }}`}}'
            text: |-
              {{"{{"}} range .Alerts {{"}}"}}
                {{"{{"}}- if .Annotations.summary {{"}}"}}*Alert:* {{"{{"}} .Annotations.summary {{"}}"}} - `{{"{{"}} .Labels.severity {{"}}"}}`{{"{{"}}- end {{"}}"}}
                *Description:* {{"{{"}} .Annotations.description {{"}}"}}{{"{{"}} .Annotations.message {{"}}"}}
                *Graph:* <{{"{{"}} .GeneratorURL {{"}}"}}|:chart_with_upwards_trend:>{{"{{"}} if or .Annotations.runbook .Annotations.runbook_url {{"}}"}} *Runbook:* <{{"{{"}} .Annotations.runbook {{"}}"}}{{"{{"}} .Annotations.runbook_url {{"}}"}}|:spiral_note_pad:>{{"{{"}} end {{"}}"}}
                *Details:*
                {{"{{"}} range .Labels.SortedPairs {{"}}"}} • *{{"{{"}} .Name {{"}}"}}:* `{{"{{"}} .Value {{"}}"}}`
                {{"{{"}} end {{"}}"}}
              {{"{{"}} end {{"}}"}}
            fallback: '{{`{{ template "slack.default.fallback" . }}`}}'
            icon_emoji: '{{`{{ template "slack.default.iconemoji" . }}`}}'
            icon_url: '{{`{{ template "slack.default.iconurl" . }}`}}'
            send_resolved: true
coreDns:
  enabled: false
defaultRules:
  rules:
    kubernetesResources: false
grafana:
  enabled: true
kubelet:
  enabled: true
  serviceMonitor:
    https: false
kubeControllerManager:
  enabled: false
kubeDns:
  enabled: true
kubeEtcd:
  enabled: false
kubeProxy:
  enabled: false
kubeScheduler:
  enabled: false
b
Did you look at the helm chart's defaults? some of these might be explicit. You don't need to set every value, just the ones you need.
there's no better way, unfortunately
p
thanks a lot @billowy-army-68599. Sorted by translating yaml to json
r
hmmm I was looking for exactly the same thing…. Sometimes values.yaml can be quite long and manually translating is really cumbersome and a lengthly exercise 😞 I think this would be really useful, is there a way to propose this as a feature request?