chilly-morning-1179606/13/2023, 7:40 AM
echoing-dinner-1953106/13/2023, 8:26 AM
chilly-morning-1179606/13/2023, 8:40 AM
echoing-dinner-1953106/13/2023, 8:44 AM
chilly-morning-1179606/13/2023, 8:47 AM
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 tree
u.applyFeatures(timescale, [ u.mountConfigToFileMixin(...), u.injectSecretsAsEnv(...), u.injectConfigAsEnvMixin(n...), u.requestAndMountPersistentVolume(....) ])
chilly-morning-1179606/13/2023, 8:49 AM
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 verbose
mainContainer = ContainerArgs( name="timescale", image=..., env_from=[ #EnvFromSourceArgs(secret_ref=SecretEnvSourceArgs(name=name)), secrets.to_container_env() ] ...
echoing-dinner-1953106/14/2023, 8:36 AM
do 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).