render

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuiltInCustomFunctions

func BuiltInCustomFunctions(c *templateRenderWrapper, component *component.SynthesizedComponent, localObjs []client.Object) *gotemplate.BuiltInObjectsFunc

BuiltInCustomFunctions builds a map of customized functions for KubeBlocks

Types

type ReconcileCtx

type ReconcileCtx struct {
	*ResourceCtx

	Cluster              *appsv1.Cluster
	Component            *appsv1.Component
	SynthesizedComponent *component.SynthesizedComponent
	PodSpec              *corev1.PodSpec

	Cache []client.Object
}

type RenderedValidator

type RenderedValidator = func(map[string]string) error

type ResourceCtx

type ResourceCtx struct {
	context.Context

	Err    error
	Client client.Client

	Namespace     string
	ClusterName   string
	ComponentName string
}

type ResourceDefinition

type ResourceDefinition struct {
	MemorySize int64 `json:"memorySize,omitempty"`
	CoreNum    int64 `json:"coreNum,omitempty"`
}

type TemplateRender

type TemplateRender interface {
	// RenderConfigMapTemplate renders a ConfigMap template based on the provided specification.
	//
	// Parameters:
	// - templateSpec: The specification for the component template.
	//
	// Returns:
	// - A map containing the rendered template data.
	// - An error if the rendering fails.
	RenderConfigMapTemplate(templateSpec appsv1.ComponentFileTemplate) (map[string]string, error)

	// RenderComponentTemplate renders a component template and validates the rendered data.
	//
	// Parameters:
	// - templateSpec: The specification for the component template.
	// - cmName: The name of the ConfigMap.
	// - dataValidator: A function to validate the rendered data.
	//
	// Returns:
	// - A pointer to the rendered ConfigMap.
	// - An error if the rendering or validation fails.
	RenderComponentTemplate(templateSpec appsv1.ComponentFileTemplate,
		cmName string,
		dataValidator RenderedValidator) (*corev1.ConfigMap, error)
}

func NewTemplateBuilder

func NewTemplateBuilder(reconcileCtx *ReconcileCtx) TemplateRender

Jump to

Keyboard shortcuts

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