I´m qite new at pulumi (I´m more a terraform guy). I´m working in a legacy code which deploys helm charts into kubernetes. (splunk, Datadog, etc). They are using python for this. In code I see that they have a pulumi.[env].chart_name to pass some values I believe. Like follows:
config:
kubernetes:context: my-aks-cluster
toolbase:baseStack: dev.sandbox
toolbase:cluster-name: aks-foo-123
toolbase:cluster-tags: aks-foo-123
toolbase:datadog-logLevel: DEBUG
tooling:some other value.....
in some other python file I see they use a values option to override parameters using for example: ""logLevel": config.require('datadog-logLevel')," and they override that with the yaml file that I previous showed.
values={
"nameOverride": "",
"fullnameOverride": "",
"targetSystem": "linux",
"datadog": {
"apiKey": datadog_creds.data.get('api-key'),
"logLevel": config.require('datadog-logLevel'),
"securityContext": {},
My question is How this actually works? I want to now use the yaml file to pass some key:value pairs for some pod labels in the values.yaml file but I´m not sure how to do this with an object type. for exxample:
toolbase:podlabels: {label1:foo, label2:bar, labelx:some othervalue}
is this possible?
thank you
Yep -- take a look at the docs on structured configuration. You're most likely looking for either
get_object()
orrequire_object()
.The following Python program, for example, fetches an object from the selected stack's configuration file and uses it to apply some tags to an S3 bucket:
To set the object's data, you have a couple of options. With the CLI, you can use
pulumi config set
with the--path
option to define the object's structure and data:This'll give you a
Pulumi.<stack-name>.yaml
file that looks something like this:Alternatively, you could write these values directly into the YAML file yourself. This is fine, too, so long as what you write is valid YAML object syntax.
The result, after
pulumi up
:Hope that helps!