chilly-morning-11796
06/13/2023, 7:40 AMechoing-dinner-19531
06/13/2023, 8:26 AMchilly-morning-11796
06/13/2023, 8:40 AMechoing-dinner-19531
06/13/2023, 8:44 AMchilly-morning-11796
06/13/2023, 8:47 AMu.applyFeatures(timescale,
[
u.mountConfigToFileMixin(...),
u.injectSecretsAsEnv(...),
u.injectConfigAsEnvMixin(n...),
u.requestAndMountPersistentVolume(....)
])
The functions take the JSON, reconfigure it to add some feature and return the result - so I can chain them as I see fit.
To this end, I do not need to sub class any components, I just operate "on top". This is -imho - quite lean, I was looking for this kind of transformation in Pulumi.
... the important point here is that I am transforming an existing treeechoing-dinner-19531
06/13/2023, 8:49 AMchilly-morning-11796
06/13/2023, 8:49 AMmainContainer = ContainerArgs(
name="timescale", image=...,
env_from=[ #EnvFromSourceArgs(secret_ref=SecretEnvSourceArgs(name=name)), secrets.to_container_env()
]
...
The first line (commented with #) is the Pulumi way I currently know - quite roundabout. The second one is the shortcut I just built.
.... is there a native equivalent for exactly this sort of thing?
Another example of the same problem: I have a PVC which I want to mount into a container. Exactly the same story - doing that "natively" is quite verboseechoing-dinner-19531
06/14/2023, 8:36 AMdo you have some automatic wrappers in place that allow you to inject objects?Nothing built in, but as you've shown given this is just python code it's pretty simple to write functions to do what you want. Might be worth raising an issue at https://github.com/pulumi/pulumi-kubernetes/issues with some more details to see if it makes sense for some of these things to be built in, e.g. maybe env_from should just accept a secret object and automatically turn that into secret_ref under the hood (maybe, I'm not a k8s experts to say).