Documentation
¶
Index ¶
- func BuildTestXRSchema(rg *v1beta1.ResourceGraph) *spec.Schema
- func NewResourceGraphDefinition(name string, opts ...ResourceGraphDefinitionOption) *v1beta1.ResourceGraph
- type ResourceGraphDefinitionOption
- func WithExternalRef(id string, externalRef *v1beta1.ExternalRef, readyWhen []string, ...) ResourceGraphDefinitionOption
- func WithExternalRefAndForEach(id string, externalRef *v1beta1.ExternalRef, ...) ResourceGraphDefinitionOption
- func WithResource(id string, template map[string]interface{}, readyWhen []string, ...) ResourceGraphDefinitionOption
- func WithResourceCollection(id string, template map[string]interface{}, forEach []v1beta1.ForEachDimension, ...) ResourceGraphDefinitionOption
- func WithSchema(kind, version string, spec, status map[string]interface{}, ...) ResourceGraphDefinitionOption
- type SchemaOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTestXRSchema ¶
func BuildTestXRSchema(rg *v1beta1.ResourceGraph) *spec.Schema
BuildTestXRSchema constructs a *spec.Schema suitable for passing as the xrSchema parameter to Builder.NewResourceGraphDefinition. It reads the spec definition stored in the ResourceGraph's annotations by WithSchema and converts SimpleSchema type strings ("string", "integer", "boolean", "[]string", etc.) into OpenAPI schemas.
The returned schema has the standard Kubernetes object shape: apiVersion, kind, metadata, spec (from the annotation), and status (empty object).
func NewResourceGraphDefinition ¶
func NewResourceGraphDefinition(name string, opts ...ResourceGraphDefinitionOption) *v1beta1.ResourceGraph
NewResourceGraphDefinition creates a new ResourceGraph with the given name and options. This is adapted from upstream KRO's generator to work with function-kro's v1beta1.ResourceGraph type instead of v1alpha1.ResourceGraphDefinition.
Types ¶
type ResourceGraphDefinitionOption ¶
type ResourceGraphDefinitionOption func(*v1beta1.ResourceGraph)
ResourceGraphDefinitionOption is a functional option for ResourceGraph
func WithExternalRef ¶
func WithExternalRef( id string, externalRef *v1beta1.ExternalRef, readyWhen []string, includeWhen []string, ) ResourceGraphDefinitionOption
WithExternalRef adds an external reference to the ResourceGraph.
func WithExternalRefAndForEach ¶
func WithExternalRefAndForEach( id string, externalRef *v1beta1.ExternalRef, forEach []v1beta1.ForEachDimension, ) ResourceGraphDefinitionOption
WithExternalRefAndForEach adds an external reference with forEach iterators. This is an invalid combination and should fail validation - used for testing.
func WithResource ¶
func WithResource( id string, template map[string]interface{}, readyWhen []string, includeWhen []string, ) ResourceGraphDefinitionOption
WithResource adds a resource to the ResourceGraph with the given name and definition.
func WithResourceCollection ¶
func WithResourceCollection( id string, template map[string]interface{}, forEach []v1beta1.ForEachDimension, readyWhen []string, includeWhen []string, ) ResourceGraphDefinitionOption
WithResourceCollection adds a collection resource with forEach iterators.
func WithSchema ¶
func WithSchema(kind, version string, spec, status map[string]interface{}, opts ...SchemaOption) ResourceGraphDefinitionOption
WithSchema sets the status schema of the ResourceGraph. In function-kro, the XR schema is resolved externally (from Crossplane), so this only sets the status expressions. The spec/status maps from upstream are adapted: status becomes the ResourceGraph.Status field, and spec information is stored as annotations for test extraction.
type SchemaOption ¶
type SchemaOption func(map[string]interface{})
SchemaOption is a functional option for Schema configuration. In function-kro, schema is handled externally, so this is kept for test compatibility but the schema data is stored on the ResourceGraph as annotations or status for the test to extract.
func WithScope ¶
func WithScope(scope string) SchemaOption
WithScope returns a SchemaOption that stores scope metadata. In function-kro, scope is always namespace-scoped from our perspective.
func WithTypes ¶
func WithTypes(types map[string]interface{}) SchemaOption
WithTypes returns a SchemaOption that stores types metadata in annotations. The types map custom type names to their field definitions, which are used by BuildTestXRSchema to resolve type references in spec fields.