stefanprodan / timoni

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

Incorrect CRD spec generation #386

Open holycheater opened 2 months ago

holycheater commented 2 months ago

When spec is generated from object with no properties, it creates a closed struct inside a "definition" which doesn't allow to extend objects

Example CRD: https://github.com/Altinity/clickhouse-operator/blob/master/deploy/operatorhub/0.23.5/clickhouseinstallations.clickhouse.altinity.com.crd.yaml#L1112-L1118

example result:

#ClickHouseInstallationSpec: {
  // ... skip ...
  spec: podTemplates?: [...{
    // ... skip ...
   metadata?: {}
}

obj: #ClickHouseInstallationSpec
obj: templates: podTemplates: [{
    metadata: labels: foo: "bar"
}]

Error:

obj.spec.templates.podTemplates.0.metadata.labels: field not allowed:
    ../cue.mod/gen/clickhouse.altinity.com/clickhouseinstallation/v1/types_gen.cue:45:9
    ../cue.mod/gen/clickhouse.altinity.com/clickhouseinstallation/v1/types_gen.cue:1210:19
    ../cue.mod/gen/clickhouse.altinity.com/clickhouseinstallation/v1/types_gen.cue:1223:15