Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateJSON(p string, s string) error
- func ValidateURL(location string) error
- type ACS
- func (a *ACS) Data(_ context.Context, _ *runcontext.RunContext, _ *config.Config) (map[string][]byte, error)
- func (a *ACS) LoggerWith(logger *slog.Logger) *slog.Logger
- func (a *ACS) PersistentFlags(c *cobra.Command)
- func (a *ACS) SetArgument(_, _ string) error
- func (a *ACS) Type() corev1.SecretType
- func (a *ACS) Validate() error
- type Azure
- func (a *Azure) Data(context.Context, *runcontext.RunContext, *config.Config) (map[string][]byte, error)
- func (a *Azure) LoggerWith(logger *slog.Logger) *slog.Logger
- func (a *Azure) PersistentFlags(c *cobra.Command)
- func (a *Azure) SetArgument(string, string) error
- func (a *Azure) Type() corev1.SecretType
- func (a *Azure) Validate() error
- type BitBucket
- func (b *BitBucket) Data(_ context.Context, _ *runcontext.RunContext, _ *config.Config) (map[string][]byte, error)
- func (b *BitBucket) LoggerWith(logger *slog.Logger) *slog.Logger
- func (b *BitBucket) PersistentFlags(c *cobra.Command)
- func (b *BitBucket) SetArgument(_, _ string) error
- func (b *BitBucket) Type() corev1.SecretType
- func (b *BitBucket) Validate() error
- type GitHub
- func (g *GitHub) Data(ctx context.Context, runCtx *runcontext.RunContext, cfg *config.Config) (map[string][]byte, error)
- func (g *GitHub) LoggerWith(logger *slog.Logger) *slog.Logger
- func (g *GitHub) PersistentFlags(c *cobra.Command)
- func (g *GitHub) SetArgument(k, v string) error
- func (g *GitHub) SetURLProvider(provider integrations.URLProvider)
- func (g *GitHub) Type() corev1.SecretType
- func (g *GitHub) Validate() error
- type GitLab
- func (g *GitLab) Data(_ context.Context, _ *runcontext.RunContext, _ *config.Config) (map[string][]byte, error)
- func (g *GitLab) LoggerWith(logger *slog.Logger) *slog.Logger
- func (g *GitLab) PersistentFlags(c *cobra.Command)
- func (g *GitLab) SetArgument(string, string) error
- func (g *GitLab) Type() corev1.SecretType
- func (g *GitLab) Validate() error
- type ImageRegistry
- func (i *ImageRegistry) Data(_ context.Context, _ *runcontext.RunContext, _ *config.Config) (map[string][]byte, error)
- func (i *ImageRegistry) LoggerWith(logger *slog.Logger) *slog.Logger
- func (i *ImageRegistry) PersistentFlags(cmd *cobra.Command)
- func (i *ImageRegistry) SetArgument(_, _ string) error
- func (i *ImageRegistry) Type() corev1.SecretType
- func (i *ImageRegistry) Validate() error
- type Integration
- func (i *Integration) Create(ctx context.Context, runCtx *runcontext.RunContext, cfg *config.Config) error
- func (i *Integration) Delete(ctx context.Context, cfg *config.Config) error
- func (i *Integration) Exists(ctx context.Context, cfg *config.Config) (bool, error)
- func (i *Integration) PersistentFlags(cmd *cobra.Command)
- func (i *Integration) SetArgument(k, v string) error
- func (i *Integration) Validate() error
- type Interface
- type Jenkins
- func (j *Jenkins) Data(_ context.Context, _ *runcontext.RunContext, _ *config.Config) (map[string][]byte, error)
- func (j *Jenkins) LoggerWith(logger *slog.Logger) *slog.Logger
- func (j *Jenkins) PersistentFlags(c *cobra.Command)
- func (j *Jenkins) SetArgument(string, string) error
- func (j *Jenkins) Type() corev1.SecretType
- func (j *Jenkins) Validate() error
- type TrustedArtifactSigner
- func (t *TrustedArtifactSigner) Data(_ context.Context, _ *runcontext.RunContext, _ *config.Config) (map[string][]byte, error)
- func (t *TrustedArtifactSigner) LoggerWith(logger *slog.Logger) *slog.Logger
- func (t *TrustedArtifactSigner) PersistentFlags(c *cobra.Command)
- func (t *TrustedArtifactSigner) SetArgument(string, string) error
- func (t *TrustedArtifactSigner) Type() corev1.SecretType
- func (t *TrustedArtifactSigner) Validate() error
- type Trustification
- func (t *Trustification) Data(_ context.Context, _ *runcontext.RunContext, _ *config.Config) (map[string][]byte, error)
- func (t *Trustification) LoggerWith(logger *slog.Logger) *slog.Logger
- func (t *Trustification) PersistentFlags(c *cobra.Command)
- func (t *Trustification) SetArgument(string, string) error
- func (t *Trustification) Type() corev1.SecretType
- func (t *Trustification) Validate() error
- type TrustificationAuth
- func (t *TrustificationAuth) Data(_ context.Context, _ *runcontext.RunContext, _ *config.Config) (map[string][]byte, error)
- func (t *TrustificationAuth) LoggerWith(logger *slog.Logger) *slog.Logger
- func (t *TrustificationAuth) PersistentFlags(c *cobra.Command)
- func (t *TrustificationAuth) SetArgument(string, string) error
- func (t *TrustificationAuth) Type() corev1.SecretType
- func (t *TrustificationAuth) Validate() error
- type URLProvider
Constants ¶
const GitHubAppName = "name"
GitHubAppName key to identify the GitHubApp name.
const (
// QuayURL is the default URL for public Quay.
QuayURL = "https://quay.io"
)
Variables ¶
var ErrInvalidJSON = errors.New("invalid JSON")
ErrInvalidJSON is an error returned when a string is not a valid JSON.
var ErrInvalidURL = errors.New("invalid URL")
ErrInvalidURL is an error returned when a URL is invalid, malformed.
var ErrJSONContainsSpaces = errors.New("contains unexpected spaces")
ErrJSONContainsSpaces is an error returned when a JSON key or value contains spaces.
var ErrSecretAlreadyExists = fmt.Errorf("secret already exists")
ErrSecretAlreadyExists integration secret already exists.
Functions ¶
func ValidateJSON ¶
ValidateJSON checks if the given string is a valid JSON and that there is no space character in any of the keys and values of a JSON object.
func ValidateURL ¶
ValidateURL check if the informed URL is valid.
Types ¶
type ACS ¶
type ACS struct {
// contains filtered or unexported fields
}
ACS represents the ACS, Advanced Cluster Security, integration. The coordinates to connect the installer with an external instance of ACS.
func (*ACS) Data ¶
func (a *ACS) Data( _ context.Context, _ *runcontext.RunContext, _ *config.Config, ) (map[string][]byte, error)
Data returns the ACS integration data.
func (*ACS) LoggerWith ¶
LoggerWith decorates the logger with the integration flags.
func (*ACS) PersistentFlags ¶
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*ACS) SetArgument ¶
SetArgument sets additional arguments to the integration.
func (*ACS) Type ¶
func (a *ACS) Type() corev1.SecretType
Type shares the Kubernetes secret type for this integration.
type Azure ¶
type Azure struct {
// contains filtered or unexported fields
}
Azure represents the Azure integration coordinates.
func NewAzure ¶
func NewAzure() *Azure
NewAzure creates a new Azure integration instance with default public host.
func (*Azure) Data ¶
func (a *Azure) Data(context.Context, *runcontext.RunContext, *config.Config) (map[string][]byte, error)
Data returns the data for the Azure integration secret.
func (*Azure) LoggerWith ¶
LoggerWith decorates the logger with the integration flags.
func (*Azure) PersistentFlags ¶
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*Azure) SetArgument ¶
SetArgument sets additional arguments to the integration.
func (*Azure) Type ¶
func (a *Azure) Type() corev1.SecretType
Type returns the type of the integration.
type BitBucket ¶
type BitBucket struct {
// contains filtered or unexported fields
}
BitBucket represents the BitBucket integration coordinates.
func NewBitBucket ¶
func NewBitBucket() *BitBucket
NewBitBucket creates a new BitBucket integration instance. By default it uses the public BitBucket host.
func (*BitBucket) Data ¶
func (b *BitBucket) Data( _ context.Context, _ *runcontext.RunContext, _ *config.Config, ) (map[string][]byte, error)
Data returns the BitBucket integration data.
func (*BitBucket) LoggerWith ¶
LoggerWith decorates the logger with the integration flags.
func (*BitBucket) PersistentFlags ¶
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*BitBucket) SetArgument ¶
SetArgument sets additional arguments to the integration.
func (*BitBucket) Type ¶
func (b *BitBucket) Type() corev1.SecretType
Type shares the Kubernetes secret type for this integration.
type GitHub ¶
type GitHub struct {
// contains filtered or unexported fields
}
GitHub represents the GitHub App integration attributes. It collects, validates and issues the attributes to the GitHub App API.
func (*GitHub) Data ¶
func (g *GitHub) Data( ctx context.Context, runCtx *runcontext.RunContext, cfg *config.Config, ) (map[string][]byte, error)
Data generates the GitHub App integration data after interacting with the service API to create the application, storing the results of this interaction.
func (*GitHub) LoggerWith ¶
LoggerWith decorates the logger with the integration flags.
func (*GitHub) PersistentFlags ¶
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*GitHub) SetArgument ¶
SetArgument sets the GitHub App name.
func (*GitHub) SetURLProvider ¶
func (g *GitHub) SetURLProvider(provider integrations.URLProvider)
SetURLProvider sets an optional URLProvider (api/integrations). When set, an adapter is built in setClusterURLs from runCtx and cfg so the provider receives only integrations.IntegrationContext. The provider is consulted for any URL not already set by flags.
func (*GitHub) Type ¶
func (g *GitHub) Type() corev1.SecretType
Type returns the type of the integration.
type GitLab ¶
type GitLab struct {
// contains filtered or unexported fields
}
GitLab represents the GitLab integration coordinates.
func NewGitLab ¶
NewGitLab instantiate a new GitLab integration. By default it uses the public GitLab host.
func (*GitLab) Data ¶
func (g *GitLab) Data( _ context.Context, _ *runcontext.RunContext, _ *config.Config, ) (map[string][]byte, error)
Data returns the GitLab integration data, using the local configuration and username obtained on the fly.
func (*GitLab) LoggerWith ¶
LoggerWith decorates the logger with the integration flags.
func (*GitLab) PersistentFlags ¶
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*GitLab) SetArgument ¶
SetArgument sets additional arguments to the integration.
func (*GitLab) Type ¶
func (g *GitLab) Type() corev1.SecretType
Type returns the type of the integration.
type ImageRegistry ¶
type ImageRegistry struct {
// contains filtered or unexported fields
}
ImageRegistry represents the image registry integration coordinates. Works with different installer integrations managing image registry configuration.
func NewContainerRegistry ¶
func NewContainerRegistry(defaultURL string) *ImageRegistry
NewContainerRegistry creates a new instance with the default URL.
func (*ImageRegistry) Data ¶
func (i *ImageRegistry) Data( _ context.Context, _ *runcontext.RunContext, _ *config.Config, ) (map[string][]byte, error)
Data returns the integration data.
func (*ImageRegistry) LoggerWith ¶
func (i *ImageRegistry) LoggerWith(logger *slog.Logger) *slog.Logger
LoggerWith decorates the logger with the integration flags.
func (*ImageRegistry) PersistentFlags ¶
func (i *ImageRegistry) PersistentFlags(cmd *cobra.Command)
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*ImageRegistry) SetArgument ¶
func (i *ImageRegistry) SetArgument(_, _ string) error
SetArgument sets additional arguments to the integration.
func (*ImageRegistry) Type ¶
func (i *ImageRegistry) Type() corev1.SecretType
Type returns the type of the integration.
func (*ImageRegistry) Validate ¶
func (i *ImageRegistry) Validate() error
Validate validates the integration configuration.
type Integration ¶
type Integration struct {
// contains filtered or unexported fields
}
Integration represents a generic Kubernetes Secret manager for integrations, it holds the common actions integrations will perform against secrets.
func NewSecret ¶
func NewSecret( logger *slog.Logger, kube k8s.Interface, name string, data Interface, ) *Integration
NewSecret instantiates a new secret manager, it uses the integration data provider to generate the Kubernetes Secret payload.
func (*Integration) Create ¶
func (i *Integration) Create(ctx context.Context, runCtx *runcontext.RunContext, cfg *config.Config) error
Create creates the integration secret in the cluster. It uses the integration data provider to obtain the secret payload.
func (*Integration) PersistentFlags ¶
func (i *Integration) PersistentFlags(cmd *cobra.Command)
PersistentFlags decorates the cobra instance with persistent flags.
func (*Integration) SetArgument ¶
func (i *Integration) SetArgument(k, v string) error
SetArgument exposes the data provider method.
func (*Integration) Validate ¶
func (i *Integration) Validate() error
Validate validates the secret payload, using the data interface.
type Interface ¶
type Interface interface {
// PersistentFlags decorates the cobra command with integration flags.
PersistentFlags(*cobra.Command)
// LoggerWith decorates the logger with the integration attributes.
LoggerWith(*slog.Logger) *slog.Logger
// Validate checks if all required fields are set and valid.
Validate() error
// Type shares the Kubernetes secret type for the integration.
Type() corev1.SecretType
// SetArgument sets an optional key-value argument to be used in the
// generation of the Kubernetes secret data.
SetArgument(string, string) error
// Data generates the data for the Kubernetes secret, provides the payload
// that will become the integration secret stored in the cluster.
Data(context.Context, *runcontext.RunContext, *config.Config) (map[string][]byte, error)
}
type Jenkins ¶
type Jenkins struct {
// contains filtered or unexported fields
}
Jenkins represents the Jenkins integration coordinates.
func (*Jenkins) Data ¶
func (j *Jenkins) Data( _ context.Context, _ *runcontext.RunContext, _ *config.Config, ) (map[string][]byte, error)
Data returns the integration data for Jenkins.
func (*Jenkins) LoggerWith ¶
LoggerWith decorates the logger with the integration flags.
func (*Jenkins) PersistentFlags ¶
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*Jenkins) SetArgument ¶
SetArgument sets additional arguments to the integration.
func (*Jenkins) Type ¶
func (j *Jenkins) Type() corev1.SecretType
Type returns the type of the integration.
type TrustedArtifactSigner ¶
type TrustedArtifactSigner struct {
// contains filtered or unexported fields
}
TrustedArtifactSigner represents the coordinates to connect to the TrustedArtifactSigner services.
func NewTrustedArtifactSigner ¶
func NewTrustedArtifactSigner() *TrustedArtifactSigner
NewTrustedArtifactSigner creates a new instance of the TrustedArtifactSigner integration.
func (*TrustedArtifactSigner) Data ¶
func (t *TrustedArtifactSigner) Data( _ context.Context, _ *runcontext.RunContext, _ *config.Config, ) (map[string][]byte, error)
Data returns the Kubernetes secret data for this integration.
func (*TrustedArtifactSigner) LoggerWith ¶
func (t *TrustedArtifactSigner) LoggerWith(logger *slog.Logger) *slog.Logger
LoggerWith decorates the logger with the integration flags.
func (*TrustedArtifactSigner) PersistentFlags ¶
func (t *TrustedArtifactSigner) PersistentFlags(c *cobra.Command)
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*TrustedArtifactSigner) SetArgument ¶
func (t *TrustedArtifactSigner) SetArgument(string, string) error
SetArgument sets additional arguments to the integration.
func (*TrustedArtifactSigner) Type ¶
func (t *TrustedArtifactSigner) Type() corev1.SecretType
Type shares the Kubernetes secret type for this integration.
func (*TrustedArtifactSigner) Validate ¶
func (t *TrustedArtifactSigner) Validate() error
Validate checks the informed URLs ensure valid inputs.
type Trustification ¶
type Trustification struct {
// contains filtered or unexported fields
}
Trustification represents the coordinates to connect the cluster with remote Trustification services.
func NewTrustification ¶
func NewTrustification() *Trustification
NewTrustification creates a new instance of the Trustification integration.
func (*Trustification) Data ¶
func (t *Trustification) Data( _ context.Context, _ *runcontext.RunContext, _ *config.Config, ) (map[string][]byte, error)
Data returns the Kubernetes secret data for this integration.
func (*Trustification) LoggerWith ¶
func (t *Trustification) LoggerWith(logger *slog.Logger) *slog.Logger
LoggerWith decorates the logger with the integration flags.
func (*Trustification) PersistentFlags ¶
func (t *Trustification) PersistentFlags(c *cobra.Command)
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*Trustification) SetArgument ¶
func (t *Trustification) SetArgument(string, string) error
SetArgument sets additional arguments to the integration.
func (*Trustification) Type ¶
func (t *Trustification) Type() corev1.SecretType
Type shares the Kubernetes secret type for this integration.
func (*Trustification) Validate ¶
func (t *Trustification) Validate() error
Validate checks the informed URLs ensure valid inputs.
type TrustificationAuth ¶
type TrustificationAuth struct {
// contains filtered or unexported fields
}
TrustificationAuth represents the authentication to connect the cluster with remote Trustification services.
func NewTrustificationAuth ¶
func NewTrustificationAuth() *TrustificationAuth
NewTrustificationAuth creates a new instance of the TrustificationAuth integration.
func (*TrustificationAuth) Data ¶
func (t *TrustificationAuth) Data( _ context.Context, _ *runcontext.RunContext, _ *config.Config, ) (map[string][]byte, error)
Data returns the Kubernetes secret data for this integration.
func (*TrustificationAuth) LoggerWith ¶
func (t *TrustificationAuth) LoggerWith(logger *slog.Logger) *slog.Logger
LoggerWith decorates the logger with the integration flags.
func (*TrustificationAuth) PersistentFlags ¶
func (t *TrustificationAuth) PersistentFlags(c *cobra.Command)
PersistentFlags adds the persistent flags to the informed Cobra command.
func (*TrustificationAuth) SetArgument ¶
func (t *TrustificationAuth) SetArgument(string, string) error
SetArgument sets additional arguments to the integration.
func (*TrustificationAuth) Type ¶
func (t *TrustificationAuth) Type() corev1.SecretType
Type shares the Kubernetes secret type for this integration.
func (*TrustificationAuth) Validate ¶
func (t *TrustificationAuth) Validate() error
Validate checks the informed URLs ensure valid inputs.
type URLProvider ¶
type URLProvider interface {
// GetCallbackURL returns the GitHub App callback URL.
GetCallbackURL(ctx context.Context, runCtx *runcontext.RunContext, cfg *config.Config) (string, error)
// GetHomepageURL returns the GitHub App homepage URL.
GetHomepageURL(ctx context.Context, runCtx *runcontext.RunContext, cfg *config.Config) (string, error)
// GetWebhookURL returns the GitHub App webhook URL.
GetWebhookURL(ctx context.Context, runCtx *runcontext.RunContext, cfg *config.Config) (string, error)
}
URLProvider defines an interface for providing GitHub App URLs. Implementations can use the RunContext, config.Config and context to derive URLs from cluster configuration or other sources.