build

package
v0.0.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KnownCompositeAnnotations are annotations that will be registered by
	// default
	KnownCompositeAnnotations = []string{}

	// KnownCompositeLabels are labels that will be registered by default.
	KnownCompositeLabels = []string{
		labelKeyClaimName,
		labelKeyClaimNamespace,
	}
	// KnownResourceAnnotations are annotations that will be registered by
	// default
	KnownResourceAnnotations = []string{
		meta.AnnotationKeyExternalName,
		meta.AnnotationKeyExternalCreatePending,
		meta.AnnotationKeyExternalCreateSucceeded,
		meta.AnnotationKeyExternalCreateFailed,
	}
	// KnownResourceLabels are labels that will be registered by default.
	KnownResourceLabels = []string{}
)
View Source
var TemplateBasePath string

Functions

func AddTemplate

func AddTemplate(path string)

func LoadTemplate

func LoadTemplate(path string) (string, error)

func SetBasePath

func SetBasePath(path string)

func ValidateFieldPath

func ValidateFieldPath(obj interface{}, path string, knownPaths []fieldpath.Segments) error

ValidateFieldPath checks if the JSON path exists for the given object.

Types

type ComposedTemplateSkeleton

type ComposedTemplateSkeleton interface {
	// WithName sets the name of this composeTemplateSkeleton.
	WithName(name string) ComposedTemplateSkeleton

	// WithPatches adds the following patches to this composeTemplateSkeleton.
	WithPatches(patches ...xapiextv1.Patch) ComposedTemplateSkeleton

	// WithUnsafePatches is similar to WithPatches but the field paths of the
	// composeTemplateSkeletons will not be validated.
	WithUnsafePatches(patches ...xapiextv1.Patch) ComposedTemplateSkeleton

	// WithConnectionDetails adds the following connection details to this
	// composeTemplateSkeleton.
	WithConnectionDetails(connectionDetails ...xapiextv1.ConnectionDetail) ComposedTemplateSkeleton

	// WithReadinessChecks adds the following readiness checks to this
	// composeTemplateSkeleton.
	WithReadinessChecks(checks ...xapiextv1.ReadinessCheck) ComposedTemplateSkeleton

	// RegisterAnnotations marks the given resource annotations as safe
	// so they will be treated as a valid field in patch paths.
	RegisterAnnotations(annotationKeys ...string) ComposedTemplateSkeleton

	// RegisterLabels marks the given resource label as safe
	// so they will be treated as a valid field in patch paths.
	RegisterLabels(labelsKeys ...string) ComposedTemplateSkeleton

	// RegisterFieldPaths marks the given resource paths as safe so ti will
	// be treated a valid in patch paths.
	RegisterFieldPaths(paths ...string) ComposedTemplateSkeleton
}

ComposedTemplateSkeleton represents the draft for a compositionSkeleton composeTemplateSkeleton.

type CompositionBuildRunner

type CompositionBuildRunner interface {
	// Build generates all compositions from the builder delegates and sends
	// them to the output writer.
	Build() error
}

CompositionBuildRunner specifies the interface for a composition builder.

func NewRunner

func NewRunner(config RunnerConfig) CompositionBuildRunner

NewRunner creates a new CompositionBuildRunner instance.

type CompositionBuilder

type CompositionBuilder interface {
	// GetCompositeTypeRef returns the CompositeTypeReference for the
	// composition to be build.
	GetCompositeTypeRef() ObjectKindReference

	// Build builds a composition using the type.
	Build(composition CompositionSkeleton)
}

CompositionBuilder specifies the interface for user defined type that is able to build a composition.

type CompositionSkeleton

type CompositionSkeleton interface {
	// WithName sets the metadata.name of the composition to be built.
	WithName(name string) CompositionSkeleton

	// WithLabels sets the metadata.labels of the composition to be built.
	WithLabels(labels map[string]string) CompositionSkeleton

	// WithAnnotations sets the metadata.annotations of the composition to be built.
	WithAnnotations(annotations map[string]string) CompositionSkeleton

	// WithMode sets the mode of this compositionSkeleton.
	WithMode(mode xapiextv1.CompositionMode) CompositionSkeleton

	// NewResource creates a new ComposedTemplateSkeleton with the given base.
	NewResource(base ObjectKindReference) ComposedTemplateSkeleton

	// WithPipeline adds the following pipeline to this compositionSkeleton.
	NewPipelineStep(step string) PipelineStepSkeleton

	// WithPublishConnectionDetailsWithStoreConfig sets the
	// PublishConnectionDetailsWithStoreConfig of this CompositionSkeleton.
	WithPublishConnectionDetailsWithStoreConfig(ref *xapiextv1.StoreConfigReference) CompositionSkeleton

	// WithWriteConnectionSecretsToNamespace sets the
	// WriteConnectionSecretsToNamespace of this compositionSkeleton.
	WithWriteConnectionSecretsToNamespace(namespace *string) CompositionSkeleton

	// RegisterCompositeAnnotations marks the given composite annotations as safe
	// so it will be treated as a valid field in patch paths.
	RegisterCompositeAnnotations(annotationKeys ...string) CompositionSkeleton

	// RegisterCompositeLabels marks the given composite labels as safe
	// so it will be treated as a valid field in patch paths.
	RegisterCompositeLabels(labelKeys ...string) CompositionSkeleton

	// RegisterCompositeFieldPaths marks the given composite paths as safe so
	// they will be treated a valid in patch paths.
	RegisterCompositeFieldPaths(paths ...string) CompositionSkeleton
}

CompositionSkeleton represents the build time state of a composition.

type CompositionWriter

type CompositionWriter interface {
	// Write writes the given composition to the destintation output.
	Write(c xapiextv1.Composition) error
}

CompositionWriter specifies the interface for a delegate that writes the generated composition to the target destination.

func NewDirectoryWriter

func NewDirectoryWriter(dir string) CompositionWriter

NewDirectoryWriter creates a new CompositionWriter that writes each composition to the given directory using the objects name as filename.

func NewWriterWriter

func NewWriterWriter(w io.Writer) CompositionWriter

NewWriterWriter creates a CompositionWriter that writes to the given io.Writer.

type Object

type Object interface {
	runtime.Object
	SetGroupVersionKind(gvk schema.GroupVersionKind)
}

Object is an extension of the k8s runtime.Object with additional functions that are required by Crossbuildec.

type ObjectKindReference

type ObjectKindReference struct {
	// GroupVersionKind is the GroupVersionKind for the composite type.
	GroupVersionKind schema.GroupVersionKind

	// Object is an instance of the composite type.
	Object Object
}

ObjectKindReference contains the group version kind and instance of a runtime.Object.

type PipelineStepSkeleton

type PipelineStepSkeleton interface {

	// WithSteps adds the following steps to this pipeline.
	WithFunctionRef(ref xapiextv1.FunctionReference) PipelineStepSkeleton

	// WithInput sets the input of this pipeline step.
	WithInput(input ObjectKindReference) PipelineStepSkeleton

	// WithPatches adds the following patches to this pipeline step.
	//
	// Will automatically register the `patch-and-transform` function if not
	// already registered.
	WithPatches(name string, patches ...xpt.ComposedPatch) PipelineStepSkeleton

	// WithPatch adds the following patch to this pipeline step.
	WithPatch(name string, patch xpt.ComposedPatch) PipelineStepSkeleton
}

PipelineStepSkeleton represents the build time state of a pipeline step.

type RunnerConfig

type RunnerConfig struct {
	Builder []CompositionBuilder
	Writer  CompositionWriter
}

RunnerConfig specifies a new composition runner config.

Jump to

Keyboard shortcuts

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