Documentation
¶
Index ¶
- Constants
- Variables
- func GetGenerators(ctx context.Context, c client.Client, k8sClient kubernetes.Interface, ...) map[string]Generator
- func InterpolateGenerator(requestedGenerator *v1alpha1.ApplicationSetGenerator, params map[string]any, ...) (v1alpha1.ApplicationSetGenerator, error)
- func ScmProviderAllowed(applicationSetInfo *v1alpha1.ApplicationSet, ...) error
- type ClusterGenerator
- func (g *ClusterGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (g *ClusterGenerator) GetRequeueAfter(_ *v1alpha1.ApplicationSetGenerator) time.Duration
- func (g *ClusterGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type DuckTypeGenerator
- func (g *DuckTypeGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (g *DuckTypeGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
- func (g *DuckTypeGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type ErrDisallowedSCMProvider
- type Generator
- func GetRelevantGenerators(requestedGenerator *v1alpha1.ApplicationSetGenerator, ...) []Generator
- func NewClusterGenerator(c client.Client, namespace string) Generator
- func NewDuckTypeGenerator(ctx context.Context, dynClient dynamic.Interface, ...) Generator
- func NewGitGenerator(repos services.Repos, controllerNamespace string) Generator
- func NewListGenerator() Generator
- func NewMatrixGenerator(supportedGenerators map[string]Generator) Generator
- func NewMergeGenerator(supportedGenerators map[string]Generator) Generator
- func NewPluginGenerator(client client.Client, namespace string) Generator
- func NewPullRequestGenerator(client client.Client, scmConfig SCMConfig) Generator
- func NewSCMProviderGenerator(client client.Client, scmConfig SCMConfig) Generator
- func NewTestSCMProviderGenerator(overrideProvider scm_provider.SCMProviderService) Generator
- type GitGenerator
- func (g *GitGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (g *GitGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
- func (g *GitGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type ListGenerator
- func (g *ListGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (g *ListGenerator) GetRequeueAfter(_ *v1alpha1.ApplicationSetGenerator) time.Duration
- func (g *ListGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type MatrixGenerator
- func (m *MatrixGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (m *MatrixGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
- func (m *MatrixGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type MergeGenerator
- func (m *MergeGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (m *MergeGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
- func (m *MergeGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type PluginGenerator
- func (g *PluginGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (g *PluginGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
- func (g *PluginGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type PullRequestGenerator
- func (g *PullRequestGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (g *PullRequestGenerator) GetContinueOnRepoNotFoundError(appSetGenerator *v1alpha1.ApplicationSetGenerator) bool
- func (g *PullRequestGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
- func (g *PullRequestGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type SCMConfig
- type SCMConfigOpts
- type SCMGeneratorWithCustomApiUrl
- type SCMProviderGenerator
- func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, ...) ([]map[string]any, error)
- func (g *SCMProviderGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
- func (g *SCMProviderGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
- type TransformResult
Constants ¶
const (
DefaultPluginRequeueAfter = 30 * time.Minute
)
const (
DefaultPullRequestRequeueAfter = 30 * time.Minute
)
const (
DefaultRequeueAfter = 3 * time.Minute
)
const (
DefaultSCMProviderRequeueAfter = 30 * time.Minute
)
Variables ¶
var ( ErrEmptyAppSetGenerator = errors.New("ApplicationSet is empty") NoRequeueAfter time.Duration )
var ( ErrMoreThanTwoGenerators = errors.New("found more than two generators, Matrix support only two") ErrLessThanTwoGenerators = errors.New("found less than two generators, Matrix support only two") ErrMoreThenOneInnerGenerators = errors.New("found more than one generator in matrix.Generators") )
var ( ErrLessThanTwoGeneratorsInMerge = errors.New("found less than two generators, Merge requires two or more") ErrNoMergeKeys = errors.New("no merge keys were specified, Merge requires at least one") ErrNonUniqueParamSets = errors.New("the parameters from a generator were not unique by the given mergeKeys, Merge requires all param sets to be unique") )
var ErrSCMProvidersDisabled = errors.New("scm providers are disabled")
Functions ¶
func GetGenerators ¶
func InterpolateGenerator ¶
func InterpolateGenerator(requestedGenerator *v1alpha1.ApplicationSetGenerator, params map[string]any, useGoTemplate bool, goTemplateOptions []string) (v1alpha1.ApplicationSetGenerator, error)
InterpolateGenerator 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.
func ScmProviderAllowed ¶
func ScmProviderAllowed(applicationSetInfo *v1alpha1.ApplicationSet, generator SCMGeneratorWithCustomApiUrl, allowedScmProviders []string) error
Types ¶
type ClusterGenerator ¶
ClusterGenerator generates Applications for some or all clusters registered with Hanzo CD.
func (*ClusterGenerator) GenerateParams ¶
func (g *ClusterGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error)
func (*ClusterGenerator) GetRequeueAfter ¶
func (g *ClusterGenerator) GetRequeueAfter(_ *v1alpha1.ApplicationSetGenerator) time.Duration
GetRequeueAfter never requeue the cluster generator because the `clusterSecretEventHandler` will requeue the appsets when the cluster secrets change
func (*ClusterGenerator) GetTemplate ¶
func (g *ClusterGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
type DuckTypeGenerator ¶
type DuckTypeGenerator struct {
// contains filtered or unexported fields
}
DuckTypeGenerator generates Applications for some or all clusters registered with Hanzo CD.
func (*DuckTypeGenerator) GenerateParams ¶
func (g *DuckTypeGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error)
func (*DuckTypeGenerator) GetRequeueAfter ¶
func (g *DuckTypeGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
func (*DuckTypeGenerator) GetTemplate ¶
func (g *DuckTypeGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
type ErrDisallowedSCMProvider ¶
func NewErrDisallowedSCMProvider ¶
func NewErrDisallowedSCMProvider(provider string, allowed []string) ErrDisallowedSCMProvider
func (ErrDisallowedSCMProvider) Error ¶
func (e ErrDisallowedSCMProvider) Error() string
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 *v1alpha1.ApplicationSetGenerator, applicationSetInfo *v1alpha1.ApplicationSet, client client.Client) ([]map[string]any, 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 *v1alpha1.ApplicationSetGenerator) time.Duration
// GetTemplate returns the inline template from the spec if there is any, or an empty object otherwise
GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
}
Generator defines the interface implemented by all ApplicationSet generators.
func GetRelevantGenerators ¶
func GetRelevantGenerators(requestedGenerator *v1alpha1.ApplicationSetGenerator, generators map[string]Generator) []Generator
func NewDuckTypeGenerator ¶
func NewDuckTypeGenerator(ctx context.Context, dynClient dynamic.Interface, clientset kubernetes.Interface, namespace string, clusterInformer *settings.ClusterInformer) Generator
func NewGitGenerator ¶
NewGitGenerator creates a new instance of Git Generator
func NewListGenerator ¶
func NewListGenerator() Generator
func NewMatrixGenerator ¶
func NewMergeGenerator ¶
NewMergeGenerator returns a MergeGenerator which allows the given supportedGenerators as child generators.
func NewPullRequestGenerator ¶
func NewSCMProviderGenerator ¶
func NewTestSCMProviderGenerator ¶
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 *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error)
GenerateParams generates a list of parameter maps for the ApplicationSet by evaluating the Git generator's configuration. It supports both directory-based and file-based Git generators.
func (*GitGenerator) GetRequeueAfter ¶
func (g *GitGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
GetRequeueAfter returns the duration after which the Git generator should be requeued for reconciliation. If RequeueAfterSeconds is set in the generator spec, it uses that value. Otherwise, it falls back to a default requeue interval (3 minutes).
func (*GitGenerator) GetTemplate ¶
func (g *GitGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
GetTemplate returns the ApplicationSetTemplate associated with the Git generator from the provided ApplicationSetGenerator. This template defines how each generated Hanzo CD Application should be rendered.
type ListGenerator ¶
type ListGenerator struct{}
func (*ListGenerator) GenerateParams ¶
func (g *ListGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error)
func (*ListGenerator) GetRequeueAfter ¶
func (g *ListGenerator) GetRequeueAfter(_ *v1alpha1.ApplicationSetGenerator) time.Duration
func (*ListGenerator) GetTemplate ¶
func (g *ListGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
type MatrixGenerator ¶
type MatrixGenerator struct {
// contains filtered or unexported fields
}
func (*MatrixGenerator) GenerateParams ¶
func (m *MatrixGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error)
func (*MatrixGenerator) GetRequeueAfter ¶
func (m *MatrixGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
func (*MatrixGenerator) GetTemplate ¶
func (m *MatrixGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
type MergeGenerator ¶
type MergeGenerator struct {
// contains filtered or unexported fields
}
func (*MergeGenerator) GenerateParams ¶
func (m *MergeGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, client client.Client) ([]map[string]any, error)
GenerateParams gets the params produced by the MergeGenerator.
func (*MergeGenerator) GetRequeueAfter ¶
func (m *MergeGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
func (*MergeGenerator) GetTemplate ¶
func (m *MergeGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
GetTemplate gets the Template field for the MergeGenerator.
type PluginGenerator ¶
type PluginGenerator struct {
// contains filtered or unexported fields
}
func (*PluginGenerator) GenerateParams ¶
func (g *PluginGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, applicationSetInfo *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error)
func (*PluginGenerator) GetRequeueAfter ¶
func (g *PluginGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
func (*PluginGenerator) GetTemplate ¶
func (g *PluginGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
type PullRequestGenerator ¶
type PullRequestGenerator struct {
SCMConfig
// contains filtered or unexported fields
}
func (*PullRequestGenerator) GenerateParams ¶
func (g *PullRequestGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, applicationSetInfo *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error)
func (*PullRequestGenerator) GetContinueOnRepoNotFoundError ¶
func (g *PullRequestGenerator) GetContinueOnRepoNotFoundError(appSetGenerator *v1alpha1.ApplicationSetGenerator) bool
func (*PullRequestGenerator) GetRequeueAfter ¶
func (g *PullRequestGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
func (*PullRequestGenerator) GetTemplate ¶
func (g *PullRequestGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
type SCMConfig ¶
type SCMConfig struct {
GitHubApps github_app_auth.Credentials
// contains filtered or unexported fields
}
func NewSCMConfig ¶
func NewSCMConfig(scmRootCAPath string, allowedSCMProviders []string, enableSCMProviders bool, enableGitHubAPIMetrics bool, gitHubApps github_app_auth.Credentials, tokenRefStrictMode bool, opts ...SCMConfigOpts) SCMConfig
type SCMConfigOpts ¶
type SCMConfigOpts func(c *SCMConfig)
func WithNoProxyList ¶
func WithNoProxyList(noProxyList string) SCMConfigOpts
func WithProxyURL ¶
func WithProxyURL(scmProxyURL string) SCMConfigOpts
type SCMGeneratorWithCustomApiUrl ¶
type SCMGeneratorWithCustomApiUrl interface {
CustomApiUrl() string
}
type SCMProviderGenerator ¶
type SCMProviderGenerator struct {
SCMConfig
// contains filtered or unexported fields
}
func (*SCMProviderGenerator) GenerateParams ¶
func (g *SCMProviderGenerator) GenerateParams(appSetGenerator *v1alpha1.ApplicationSetGenerator, applicationSetInfo *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error)
func (*SCMProviderGenerator) GetRequeueAfter ¶
func (g *SCMProviderGenerator) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSetGenerator) time.Duration
func (*SCMProviderGenerator) GetTemplate ¶
func (g *SCMProviderGenerator) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGenerator) *v1alpha1.ApplicationSetTemplate
type TransformResult ¶
type TransformResult struct {
Params []map[string]any
Template v1alpha1.ApplicationSetTemplate
}
func Transform ¶
func Transform(requestedGenerator v1alpha1.ApplicationSetGenerator, allGenerators map[string]Generator, baseTemplate v1alpha1.ApplicationSetTemplate, appSet *v1alpha1.ApplicationSet, genParams map[string]any, client client.Client) ([]TransformResult, error)
Transform a spec generator to list of paramSets and a template