generators

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRequeueAfterSeconds = 3 * time.Minute

DefaultInterval is used when Interval is not specified, it is the default time to wait before the next reconcile loop.

Variables

View Source
var ErrEmptyGitOpsSet = errors.New("GitOpsSet is empty")

ErrEmptyGitOpsSetGenerator is returned when GitOpsSet is empty.

View Source
var NoRequeueInterval time.Duration

Functions

func ArtifactError

func ArtifactError(kind string, name client.ObjectKey) error

ArtifactError creates and returns a new Artifact error.

Types

type Generator

type Generator interface {
	// Generate interprets the GitOpsSet and generates all relevant
	// parameters for the GitOpsSet template.
	// The expected / desired list of parameters is returned, it then will be render and reconciled
	// against the current state of the Applications in the cluster.
	Generate(context.Context, *templatesv1.GitOpsSetGenerator, *templatesv1.GitOpsSet) ([]map[string]any, error)

	// Interval is the the generator can controller the next reconciled loop
	//
	// In case there is more then one generator the time will be the minimum of the times.
	// In case NoRequeueInterval is empty, it will be ignored
	Interval(*templatesv1.GitOpsSetGenerator) time.Duration
}

Generator defines the interface implemented by all GitOpsSet generators.

func FindRelevantGenerators

func FindRelevantGenerators(setGenerator any, enabledGenerators map[string]Generator) ([]Generator, error)

FindRelevantGenerators takes a struct with keys of the same type as Generators in the map and finds relevant generators.

type GeneratorFactory

type GeneratorFactory func(logr.Logger, client.Reader) Generator

GeneratorFactory is a way to create a per-reconciliation generator.

type GeneratorNotEnabledError

type GeneratorNotEnabledError struct {
	Name string
}

GeneratorNotEnabledError is returned when a generator is not enabled in the controller but a GitOpsSet tries to use it. If you want to handle this error you can either use errors.As(err, &GeneratorNotEnabledError{}) to check for any generator, or use errors.Is(err, GeneratorNotEnabledError{Name: Matrix}) for a specific generator.

func (GeneratorNotEnabledError) Error

func (g GeneratorNotEnabledError) Error() string

type NoArtifactError

type NoArtifactError struct {
	Kind string
	Name client.ObjectKey
}

NoArtifactError indicates that a Repository's artifact is not available.

func (NoArtifactError) Error

func (e NoArtifactError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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