component

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package component provides the main rendering pipeline for Component resources.

The pipeline combines Component, ComponentType, Traits, Workload and ReleaseBinding to generate fully resolved Kubernetes resource manifests by:

  • Building CEL evaluation contexts with parameters, overrides, and defaults
  • Rendering base resources from ComponentType
  • Processing traits (creates and patches)
  • Post-processing (validation, labels, annotations)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Pipeline)

Option is a function that configures a Pipeline.

type Pipeline

type Pipeline struct {
	// contains filtered or unexported fields
}

Pipeline orchestrates the complete rendering workflow for Component resources. It combines Component, ComponentType, Traits, Workload and ReleaseBinding to generate fully resolved Kubernetes resource manifests.

func NewPipeline

func NewPipeline(opts ...Option) *Pipeline

NewPipeline creates a new component rendering pipeline.

func (*Pipeline) Render

func (p *Pipeline) Render(input *RenderInput) (*RenderOutput, error)

Render orchestrates the complete rendering workflow for a Component.

Workflow:

  • Validate input
  • Build component context (parameters + overrides + defaults)
  • Render base resources from ComponentType
  • Process traits (creates and patches)
  • Post-process (validate, add labels/annotations, sort)
  • Return output

Returns an error if any step fails.

type RenderInput

type RenderInput struct {
	// ComponentType is the component type containing resource templates.
	// Required.
	ComponentType *v1alpha1.ComponentType `validate:"required"`

	// Component is the component specification with parameters.
	// Required.
	Component *v1alpha1.Component `validate:"required"`

	// Traits is the list of trait definitions used by the component.
	// Optional - if nil or empty, no traits are processed.
	Traits []v1alpha1.Trait

	// Workload contains the workload spec with build information.
	// Required.
	Workload *v1alpha1.Workload `validate:"required"`

	// Environment to which the component is being deployed.
	// Required.
	Environment *v1alpha1.Environment `validate:"required"`

	// ReleaseBinding contains release reference and environment-specific overrides for the component.
	ReleaseBinding *v1alpha1.ReleaseBinding

	// DataPlane contains the data plane configuration.
	// Required
	DataPlane *v1alpha1.DataPlane `validate:"required"`

	// SecretReferences is a map of SecretReference objects needed for rendering.
	// Keyed by SecretReference name.
	// Optional - can be nil if no secret references need to be resolved.
	SecretReferences map[string]*v1alpha1.SecretReference

	// Metadata provides structured naming information.
	// Required - controller must compute and provide this.
	Metadata pipelinecontext.MetadataContext `validate:"required"`

	// DefaultNotificationChannel is the default notification channel name for the environment.
	// Optional - if not provided, traits won't have access to a default notification channel.
	DefaultNotificationChannel string

	// DependencyItems contains endpoint dependency metadata and pre-computed env vars
	// per connection. Optional - if nil, dependencies.items will be empty.
	DependencyItems []pipelinecontext.ConnectionItem

	// ResourceDependencyItems contains resource dependency metadata and pre-computed env
	// vars, volume mounts, and volumes per resource. Optional - if nil, dependencies.resources
	// (and the merged volumeMounts/volumes lists) will be empty.
	ResourceDependencyItems []pipelinecontext.ResourceDependencyItem
}

RenderInput contains all inputs needed to render a component's resources.

func (*RenderInput) ApplyTargetPlaneDefaults deprecated added in v0.8.0

func (input *RenderInput) ApplyTargetPlaneDefaults()

ApplyTargetPlaneDefaults normalizes empty targetPlane fields to "dataplane". This handles backward compatibility with resources created before the targetPlane field existed.

Deprecated: This method exists for backward compatibility during development and should be removed when reaching 1.0.

type RenderMetadata

type RenderMetadata struct {
	// ResourceCount is the total number of resources rendered.
	ResourceCount int

	// BaseResourceCount is the number of resources from the ComponentType.
	BaseResourceCount int

	// TraitCount is the number of traits processed.
	TraitCount int

	// TraitResourceCount is the number of resources created by traits.
	TraitResourceCount int

	// Warnings contains non-fatal issues encountered during rendering.
	Warnings []string
}

RenderMetadata contains information about the rendering process.

type RenderOutput

type RenderOutput struct {
	// Resources is the list of fully rendered Kubernetes resource manifests with their target planes.
	Resources []renderer.RenderedResource

	// Metadata contains information about the rendering process.
	Metadata *RenderMetadata
}

RenderOutput contains the results of the rendering process.

Directories

Path Synopsis
Package renderer handles ResourceTemplate orchestration for ComponentTypes.
Package renderer handles ResourceTemplate orchestration for ComponentTypes.
Package schemaextract parses an endpoint's API schema (OpenAPI for HTTP, protobuf for gRPC) into a flat list of renderable routes.
Package schemaextract parses an endpoint's API schema (OpenAPI for HTTP, protobuf for gRPC) into a flat list of renderable routes.
Package trait handles trait processing for component rendering.
Package trait handles trait processing for component rendering.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL