Feature Description
Problem Statement:
Currently, custom types defined in ResourceGraphDefinition.spec.schema.types cannot reference each other, preventing the division and reuse of types. For example, if BaseCluster attempts to reference KubeconfigRef as shown below, the build of the RGD fails with an error unknown type: KubeconfigRef.
schema:
spec:
baseCluster: BaseCluster
types:
BaseCluster:
kubeconfigRef: KubeconfigRef | required=true
KubeconfigRef:
name: string | required=true
namespace: string | required=true
The current workarounds are to either inline and copy-paste KubeconfigRef or to fall back to the object notation. However, the object notation tends to weaken structured schema/validation. This goes against the intention of defining structures with types and then enhancing safety by applying CEL validation or constraints via markers.
Proposed Solution:
Allowing references to other schema.types within schema.types would be beneficial.
Expected Benefits:
types can be modularized and reused, leading to a more concise schema.
- Structuring using
types makes validation/CEL targets clearer compared to the object notation, making it easier to enhance safety.
Alternatives Considered:
Additional Context:
Current error example (from kubectl describe rgd ...):
conditions:
- lastTransitionTime: "2025-12-17T04:15:40Z"
message: 'failed to build resourcegraphdefinition ''k0smotrondockercluster.cluster.example.com'':
failed to build OpenAPI schema for instance: failed to build OpenAPI schema
for instance: failed to build pre-defined types schema: unknown type: KubeconfigRef'
observedGeneration: 2
reason: InvalidResourceGraph
status: "False"
type: ResourceGraphAccepted
- lastTransitionTime: "2025-12-17T04:15:40Z"
message: 'failed to build resourcegraphdefinition ''k0smotrondockercluster.cluster.example.com'':
failed to build OpenAPI schema for instance: failed to build OpenAPI schema
for instance: failed to build pre-defined types schema: unknown type: KubeconfigRef'
observedGeneration: 2
reason: InvalidResourceGraph
status: "False"
type: Ready
- Please vote on this issue by adding a 👍 reaction to the original issue
- If you are interested in working on this feature, please leave a comment
Feature Description
Problem Statement:
Currently, custom types defined in
ResourceGraphDefinition.spec.schema.typescannot reference each other, preventing the division and reuse of types. For example, ifBaseClusterattempts to referenceKubeconfigRefas shown below, the build of the RGD fails with an errorunknown type: KubeconfigRef.The current workarounds are to either inline and copy-paste
KubeconfigRefor to fall back to theobjectnotation. However, theobjectnotation tends to weaken structured schema/validation. This goes against the intention of defining structures withtypesand then enhancing safety by applying CEL validation or constraints via markers.Proposed Solution:
Allowing references to other
schema.typeswithinschema.typeswould be beneficial.Expected Benefits:
typescan be modularized and reused, leading to a more concise schema.typesmakes validation/CEL targets clearer compared to theobjectnotation, making it easier to enhance safety.Alternatives Considered:
Additional Context:
Current error example (from
kubectl describe rgd ...):