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

Local module reference fails when applying multi-clusters #364

Open b4nst opened 6 months ago

b4nst commented 6 months ago

When applying a bundle containing a local module reference with a multi cluster runtime, only the first cluster passes. The second one always fails with this kind of error:

11:55AM ERR module not found at path /var/folders/vl/j712bqm55gd754rr5tdm8bxm0000gn/T/timoni3063563812/gcp-eu/examples/redis

A simple test can be run in this repository by creating this bundle and runtime at the root of the repo:

// bundle.cue
bundle: {
    apiVersion: "v1alpha1"
    name:       "debug"
    instances: {
        redis: {
            module: url: "file://./examples/redis/"
            namespace: "default"
            values: maxmemory: 256
        }
    }
}
// runtime.cue
runtime: {
    apiVersion: "v1alpha1"
    name:       "production"
    clusters: {
        "first": {
            kubeContext: "local"
            group:       "test1"
        }
        "second": {
            kubeContext: "local"
            group:       "test2"
        }
    }
}
timoni bundle apply -f bundle.cue --runtime runtime.cue --diff
huguesalary commented 1 day ago

Looked into this and created Draft PR https://github.com/stefanprodan/timoni/pull/429

I'm not super familiar with Timoni's codebase, so while this fix works, I don't know if it actually makes sense.

edit: Also, I just realized that if timoni bundle apply -f - --runtime runtime.cue --diff is used instead of timoni bundle apply -f bundle.cue --runtime runtime.cue --diff (note the use of -f -), the fix doesn't work.