stefanprodan / timoni

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

CUE tool fails to validate a fresh module #403

Open eshubin opened 5 months ago

eshubin commented 5 months ago

I initialize a new module with timoni mod init test, and then run cue export in the test directory. Output contains a number of errors: timoni.apply.app.0.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.0.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.0.metadata.name: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.0.metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.1.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.1.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.1.metadata.name: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.1.metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.1.spec.selector."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.2.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.2.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.2.metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.3.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.3.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.3.metadata.name: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.3.metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.3.spec.selector.matchLabels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.3.spec.template.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.apply.app.3.spec.template.spec.containers.0.name: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.3.spec.template.spec.serviceAccountName: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.apply.app.3.spec.template.spec.volumes.0.configMap: 2 errors in empty disjunction: timoni.apply.app.3.spec.template.spec.volumes.0.configMap: conflicting values null and {name:#cmName,items:[{key:"nginx.default.conf",path:key}]} (mismatched types null and struct): ./cue.mod/gen/k8s.io/api/core/v1/types_go_gen.cue:135:14 ./templates/config.cue:104:11 ./templates/deployment.cue:67:18 ./timoni.cue:41:44 timoni.apply.app.3.spec.template.spec.volumes.1.configMap: 2 errors in empty disjunction: timoni.apply.app.3.spec.template.spec.volumes.1.configMap: conflicting values null and {name:#cmName,items:[{key:"index.html",path:key}]} (mismatched types null and struct): ./cue.mod/gen/k8s.io/api/core/v1/types_go_gen.cue:135:14 ./templates/config.cue:104:11 ./templates/deployment.cue:77:18 ./timoni.cue:41:44 timoni.instance.config.kubeVersion: incomplete value string: ./templates/config.cue:12:16 timoni.instance.config.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.config.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.config.metadata.name: incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.config.metadata.namespace: incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.config.moduleVersion: incomplete value string: ./templates/config.cue:19:18 timoni.instance.config.selector.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.cm.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.cm.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.cm.metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.deploy.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.deploy.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.deploy.metadata.name: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.deploy.metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.deploy.spec.selector.matchLabels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.deploy.spec.template.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.deploy.spec.template.spec.containers.0.name: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.deploy.spec.template.spec.serviceAccountName: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.deploy.spec.template.spec.volumes.0.configMap: 2 errors in empty disjunction: timoni.instance.objects.deploy.spec.template.spec.volumes.0.configMap: conflicting values null and {name:#cmName,items:[{key:"nginx.default.conf",path:key}]} (mismatched types null and struct): ./cue.mod/gen/k8s.io/api/core/v1/types_go_gen.cue:135:14 ./templates/config.cue:104:11 ./templates/deployment.cue:67:18 ./timoni.cue:24:12 timoni.instance.objects.deploy.spec.template.spec.volumes.1.configMap: 2 errors in empty disjunction: timoni.instance.objects.deploy.spec.template.spec.volumes.1.configMap: conflicting values null and {name:#cmName,items:[{key:"index.html",path:key}]} (mismatched types null and struct): ./cue.mod/gen/k8s.io/api/core/v1/types_go_gen.cue:135:14 ./templates/config.cue:104:11 ./templates/deployment.cue:77:18 ./timoni.cue:24:12 timoni.instance.objects.sa.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.sa.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.sa.metadata.name: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.sa.metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.svc.metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.svc.metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.objects.svc.metadata.name: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.svc.metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) timoni.instance.objects.svc.spec.selector."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.tests."test-svc".metadata.labels."app.kubernetes.io/name": incomplete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.tests."test-svc".metadata.labels."app.kubernetes.io/version": incomplete value strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" timoni.instance.tests."test-svc".metadata.namespace: incomplete value =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" & strings.MinRunes(1) & strings.MaxRunes(63) values.kubeVersion: field is required but not present: ./templates/config.cue:12:2 ./timoni.cue:14:9 values.metadata.name: field is required but not present: ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:29:2 ./templates/config.cue:24:12 values.metadata.namespace: field is required but not present: ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:33:2 ./templates/config.cue:24:12 values.moduleVersion: field is required but not present: ./templates/config.cue:19:2 ./timoni.cue:14:9 timoni.apply.app.2.metadata.name: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" in operand to +: ./cue.mod/pkg/timoni.sh/core/v1alpha1/immutable.cue:35:14 ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:29:9 ./timoni.cue:31:16 timoni.apply.app.3.spec.template.spec.volumes.0.configMap.name: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" in operand to +: ./cue.mod/pkg/timoni.sh/core/v1alpha1/immutable.cue:35:14 ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:29:9 ./timoni.cue:31:16 timoni.apply.app.3.spec.template.spec.volumes.1.configMap.name: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" in operand to +: ./cue.mod/pkg/timoni.sh/core/v1alpha1/immutable.cue:35:14 ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:29:9 ./timoni.cue:31:16 timoni.instance.objects.cm.metadata.name: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" in operand to +: ./cue.mod/pkg/timoni.sh/core/v1alpha1/immutable.cue:35:14 ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:29:9 ./timoni.cue:31:16 timoni.instance.objects.deploy.spec.template.spec.volumes.0.configMap.name: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" in operand to +: ./cue.mod/pkg/timoni.sh/core/v1alpha1/immutable.cue:35:14 ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:29:9 ./timoni.cue:31:16 timoni.instance.objects.deploy.spec.template.spec.volumes.1.configMap.name: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" in operand to +: ./cue.mod/pkg/timoni.sh/core/v1alpha1/immutable.cue:35:14 ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:29:9 ./timoni.cue:31:16 values.metadata.labels."app.kubernetes.io/name": cannot reference optional field: name: ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:46:25 timoni.instance.tests."test-svc".metadata.name: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" in operand to +: ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:73:13 ./cue.mod/pkg/timoni.sh/core/v1alpha1/metadata.cue:29:9 ./timoni.cue:31:16 timoni.instance.config.clusterVersion.major: error in call to strings.Split: non-concrete value string: ./cue.mod/pkg/timoni.sh/core/v1alpha1/semver.cue:25:22 ./cue.mod/pkg/timoni.sh/core/v1alpha1/semver.cue:16:22 timoni.instance.config.clusterVersion.minor: error in call to strings.Split: non-concrete value string: ./cue.mod/pkg/timoni.sh/core/v1alpha1/semver.cue:28:22 ./cue.mod/pkg/timoni.sh/core/v1alpha1/semver.cue:16:22 values.clusterVersion.#Version: cannot reference optional field: kubeVersion: ./templates/config.cue:15:48 values.metadata.labels."app.kubernetes.io/version": cannot reference optional field: moduleVersion: ./templates/config.cue:24:44 values.selector.labels."app.kubernetes.io/name": cannot reference optional field: name: ./templates/config.cue:37:50 timoni.apply.app.2.data."nginx.default.conf": invalid interpolation: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" (type string): ./templates/configmap.cue:12:25 timoni.instance.objects.cm.data."nginx.default.conf": invalid interpolation: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" (type string): ./templates/configmap.cue:12:25 timoni.apply.app.2.data."index.html": invalid interpolation: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" (type string): ./templates/configmap.cue:35:25 timoni.instance.objects.cm.data."index.html": invalid interpolation: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" (type string): ./templates/configmap.cue:35:25 timoni.instance.tests."test-svc".spec.template.spec.containers.0.command.4: invalid interpolation: non-concrete value strings.MinRunes(1) & strings.MaxRunes(63) & =~"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" (type string): ./templates/job.cue:35:7 Although timoni build test . passes just fine. Am I doing it wrong?

stefanprodan commented 5 months ago

You need to pass in the Timoni required tags, please see https://github.com/stefanprodan/timoni/blob/d1fdbac627003cd47a9363c1427127adffaddea3/blueprints/starter/debug_values.cue#L6