Are there any examples of using helm chart with pu...
# general
d
Are there any examples of using helm chart with pulumi but with quite a complex list of custom values need to be added to the chart ? @microscopic-florist-22719 @white-balloon-205 @gentle-diamond-70147
c
not really
there are a couple examples of “simple” usages
d
I'm looking to add tolerations and pod affinities and mount paths which I'm not sure how it's going to treat it
It would be really nice to have a tool to convert helm values.yaml into values as needed for pulumi as input
c
@damp-book-35965 Pulumi will do whatever Helm does, right?
I’m not sure I understand the question.
d
No I meant converting the yaml formatted values into the pulumi code as a utility
c
You can use
JSON.parse(fs.readFileSync("values.yml"))
and just pass that into
new helm.v2.Chart
, right?
d
So as of now, I'm confused about how to add blocks like this:
Copy code
affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
            - key: key
              operator: NotIn
              values:
              - value
Ohh..
c
just a normal language, no?
d
I see what you are saying but I thought pulumi supports adding values right into the code right ?
c
yes?
d
For example:
Copy code
const prometheusAdapter = new k8s.helm.v2.Chart("prometheus-adapter", {
    version: "0.2.171",
    namespace: "kube-system",
    chart: "prometheus-adapter",
    values: {
        prometheus: {
            url: "<http://prometheus-operator-prometheus.kube-system.svc>"
        },
    },
}, { providers: { kubernetes: cluster.provider } });
c
Copy code
const prometheusAdapter = new k8s.helm.v2.Chart("prometheus-adapter", {
    version: "0.2.171",
    namespace: "kube-system",
    chart: "prometheus-adapter",
    values: JSON.parse(fs.readFileSync("values.yml")),
}, { providers: { kubernetes: cluster.provider } });
👍 1
right?
d
Yes..
I'm going to give this a shot
c
No need for a special tool, just read the file
that’s all I’m saying.
d
Yup makes sense
Thanks @creamy-potato-29402 works well
b
@creamy-potato-29402 Is that
JSON
a special one that also parses yaml?!
c
@busy-pizza-73563 it's just a built in JavaScript function
no yaml support though
d
@busy-pizza-73563 I had to basically run a yaml to json converter first and then this worked
w
Note that you can also use an NPM package to parse YAML - like https://www.npmjs.com/package/js-yaml.
b
I guess I was a bit confused about that
JSON.parse(fs.readFileSync('values.yml'))
. 🙂