stefanprodan / timoni

Timoni is a package manager for Kubernetes, powered by CUE and inspired by Helm.
https://timoni.sh
Apache License 2.0
1.53k stars 68 forks source link

Is there a way for a module to use values from a ConfigMap? Or for a bundle to use a Values file? #381

Open nlongton opened 5 months ago

nlongton commented 5 months ago

We have a module that needs some per-cluster values that we have stored in a ConfigMap under a defined name in a defined namespace. Currently we have a python wrapper that fetches this and structures it for use in the module. However we really dont want the extra code and looked at the Bundle Runtime - which whilst it can get the cluster data does not seem to support being given a values file like a module does.

Is there a way to achieve this using timoni?

stefanprodan commented 5 months ago

With the Bundle Runtime you map fields from cluster objects to the module values of an instance.

Ironflash commented 5 months ago

Hi @stefanprodan, I am working on the same project as @nlongton. We are trying to use Timoni as an app abstraction for the internal users of our platform. We have created a collection of Timoni modules which lets the users supply just a values.yaml with a few inputs and we can apply the module using CICD. Our top goal is to not require our users to write anything more than a simple yaml with their app requirements.

Our issue now is that we have some values that are unique depending on the cluster being deployed to and we have put those values in a configmap. I understand that with the use of bundles we can package concept of runtime with a module which would work great, except that bundles do not seem to allow passing in values from the cli which we must have in order to support reusing the same module/bundle across many teams. Having teams create their own bundles exposes too much implementation detail to them. Ideally they don't need to care we are using Timoni.

What would work for us is if we could take our existing modules and wrap them in a bundle which specifies how to map the values from configmap using a runtime to the module. Then in our CICD we can run timoni bundle apply my-app oci://url/to/bundle -n user-namespace --values user-values.yml . Open to other suggestions if we are thinking about this wrong.

Thank you in advance 😄

jmgilman commented 2 months ago

If you want to hide implementation details, the next logical step might be to dynamically generate the bundles yourself. It is CUE, after all, which tends to be very good with transformations.