generators

package
v2.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 29 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ArgoCDSecretTypeLabel   = "argocd.argoproj.io/secret-type"
	ArgoCDSecretTypeCluster = "cluster"
)
View Source
const (
	DefaultPullRequestRequeueAfterSeconds = 30 * time.Minute
)
View Source
const (
	DefaultRequeueAfterSeconds = 3 * time.Minute
)

DefaultRequeueAfterSeconds is used when GetRequeueAfter is not specified, it is the default time to wait before the next reconcile loop

View Source
const (
	DefaultSCMProviderRequeueAfterSeconds = 30 * time.Minute
)

Variables

View Source
var (
	ErrMoreThanTwoGenerators      = fmt.Errorf("found more than two generators, Matrix support only two")
	ErrLessThanTwoGenerators      = fmt.Errorf("found less than two generators, Matrix support only two")
	ErrMoreThenOneInnerGenerators = fmt.Errorf("found more than one generator in matrix.Generators")
)
View Source
var (
	ErrLessThanTwoGeneratorsInMerge = fmt.Errorf("found less than two generators, Merge requires two or more")
	ErrNoMergeKeys                  = fmt.Errorf("no merge keys were specified, Merge requires at least one")
	ErrNonUniqueParamSets           = fmt.Errorf("the parameters from a generator were not unique by the given mergeKeys, Merge requires all param sets to be unique")
)
View Source
var EmptyAppSetGeneratorError = fmt.Errorf("ApplicationSet is empty")
View Source
var NoRequeueAfter time.Duration

Functions

func InterpolateGenerator added in v2.5.0

func InterpolateGenerator(requestedGenerator *argoprojiov1alpha1.ApplicationSetGenerator, params map[string]interface{}, useGoTemplate bool) (argoprojiov1alpha1.ApplicationSetGenerator, error)

Currently for Matrix Generator. Allows interpolating the matrix's 2nd child generator with values from the 1st child generator "params" parameter is an array, where each index corresponds to a generator. Each index contains a map w/ that generator's parameters.

Types

type ClusterGenerator

type ClusterGenerator struct {
	client.Client
	// contains filtered or unexported fields
}

ClusterGenerator generates Applications for some or all clusters registered with ArgoCD.

func (*ClusterGenerator) GenerateParams

func (g *ClusterGenerator) GenerateParams(
	appSetGenerator *argoappsetv1alpha1.ApplicationSetGenerator, appSet *argoappsetv1alpha1.ApplicationSet) ([]map[string]interface{}, error)

func (*ClusterGenerator) GetRequeueAfter

func (g *ClusterGenerator) GetRequeueAfter(appSetGenerator *argoappsetv1alpha1.ApplicationSetGenerator) time.Duration

GetRequeueAfter never requeue the cluster generator because the `clusterSecretEventHandler` will requeue the appsets when the cluster secrets change

func (*ClusterGenerator) GetTemplate

type DuckTypeGenerator

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

DuckTypeGenerator generates Applications for some or all clusters registered with ArgoCD.

func (*DuckTypeGenerator) GenerateParams

func (g *DuckTypeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet) ([]map[string]interface{}, error)

func (*DuckTypeGenerator) GetRequeueAfter

func (g *DuckTypeGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration

func (*DuckTypeGenerator) GetTemplate

type Generator

type Generator interface {
	// GenerateParams interprets the ApplicationSet and generates all relevant parameters for the application 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.
	GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet) ([]map[string]interface{}, error)

	// GetRequeueAfter is 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 NoRequeueAfter is empty, it will be ignored
	GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration

	// GetTemplate returns the inline template from the spec if there is any, or an empty object otherwise
	GetTemplate(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) *argoprojiov1alpha1.ApplicationSetTemplate
}

Generator defines the interface implemented by all ApplicationSet generators.

func GetRelevantGenerators

func GetRelevantGenerators(requestedGenerator *argoprojiov1alpha1.ApplicationSetGenerator, generators map[string]Generator) []Generator

func NewClusterGenerator

func NewClusterGenerator(c client.Client, ctx context.Context, clientset kubernetes.Interface, namespace string) Generator

func NewDuckTypeGenerator

func NewDuckTypeGenerator(ctx context.Context, dynClient dynamic.Interface, clientset kubernetes.Interface, namespace string) Generator

func NewGitGenerator

func NewGitGenerator(repos services.Repos) Generator

func NewListGenerator

func NewListGenerator() Generator

func NewMatrixGenerator

func NewMatrixGenerator(supportedGenerators map[string]Generator) Generator

func NewMergeGenerator

func NewMergeGenerator(supportedGenerators map[string]Generator) Generator

NewMergeGenerator returns a MergeGenerator which allows the given supportedGenerators as child generators.

func NewPullRequestGenerator

func NewPullRequestGenerator(client client.Client, auth SCMAuthProviders) Generator

func NewSCMProviderGenerator

func NewSCMProviderGenerator(client client.Client, providers SCMAuthProviders) Generator

func NewTestSCMProviderGenerator added in v2.5.0

func NewTestSCMProviderGenerator(overrideProvider scm_provider.SCMProviderService) Generator

Testing generator

type GitGenerator

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

func (*GitGenerator) GenerateParams

func (g *GitGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet) ([]map[string]interface{}, error)

func (*GitGenerator) GetRequeueAfter

func (g *GitGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration

type ListGenerator

type ListGenerator struct {
}

func (*ListGenerator) GenerateParams

func (g *ListGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet) ([]map[string]interface{}, error)

func (*ListGenerator) GetRequeueAfter

func (g *ListGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration

type MatrixGenerator

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

func (*MatrixGenerator) GenerateParams

func (m *MatrixGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet) ([]map[string]interface{}, error)

func (*MatrixGenerator) GetRequeueAfter

func (m *MatrixGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration

func (*MatrixGenerator) GetTemplate

type MergeGenerator

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

func (*MergeGenerator) GenerateParams

func (m *MergeGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, appSet *argoprojiov1alpha1.ApplicationSet) ([]map[string]interface{}, error)

GenerateParams gets the params produced by the MergeGenerator.

func (*MergeGenerator) GetRequeueAfter

func (m *MergeGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration

func (*MergeGenerator) GetTemplate

GetTemplate gets the Template field for the MergeGenerator.

type PullRequestGenerator

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

func (*PullRequestGenerator) GenerateParams

func (g *PullRequestGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet) ([]map[string]interface{}, error)

func (*PullRequestGenerator) GetRequeueAfter

func (g *PullRequestGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration

func (*PullRequestGenerator) GetTemplate

type SCMAuthProviders added in v2.5.0

type SCMAuthProviders struct {
	GitHubApps github_app_auth.Credentials
}

type SCMProviderGenerator

type SCMProviderGenerator struct {
	SCMAuthProviders
	// contains filtered or unexported fields
}

func (*SCMProviderGenerator) GenerateParams

func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator, applicationSetInfo *argoprojiov1alpha1.ApplicationSet) ([]map[string]interface{}, error)

func (*SCMProviderGenerator) GetRequeueAfter

func (g *SCMProviderGenerator) GetRequeueAfter(appSetGenerator *argoprojiov1alpha1.ApplicationSetGenerator) time.Duration

func (*SCMProviderGenerator) GetTemplate

type TransformResult

type TransformResult struct {
	Params   []map[string]interface{}
	Template argoprojiov1alpha1.ApplicationSetTemplate
}

func Transform

func Transform(requestedGenerator argoprojiov1alpha1.ApplicationSetGenerator, allGenerators map[string]Generator, baseTemplate argoprojiov1alpha1.ApplicationSetTemplate, appSet *argoprojiov1alpha1.ApplicationSet, genParams map[string]interface{}) ([]TransformResult, error)

Transform a spec generator to list of paramSets and a template

Jump to

Keyboard shortcuts

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