timoni icon indicating copy to clipboard operation
timoni copied to clipboard

[Proposal] Module should allow to export some values

Open yyvess opened this issue 5 months ago • 2 comments

A module can declare a list of exported value.

On timoni.cue we should able to declare exported value like

// Define how Timoni should build, validate and
// apply the Kubernetes resources.
timoni: {
	apiVersion: "v1alpha1"

	export: [ {url: "redis://\(instance.config.metadata.name).\(instance.config.metadata.namespace).svc.cluster.local:\(instance.config.port)"}]

Then we should able to re-use these variables on bundle file as =>

bundle: {
    apiVersion: "v1alpha1"
    name:       "podinfo"
    instances: {
        redis: {
            module: {
                url:     "oci://ghcr.io/stefanprodan/modules/redis"
                version: "7.2.3"
            }
            namespace: "podinfo"
            values: maxmemory: 256
        }
        podinfo: {
            module: url:     "oci://ghcr.io/stefanprodan/modules/podinfo"
            module: version: "6.5.4"
            namespace: "podinfo"
            values: caching: {
                enabled:  true
                redisURL: redis.url
            }
        }
    }
}

yyvess avatar Feb 01 '24 15:02 yyvess