components

package
v0.2.6 Latest Latest
Warning

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

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

Documentation

Overview

Package components provides functions for managing the validator components.

Index

Constants

View Source
const UnspecifiedPort = -1

UnspecifiedPort is the value given to a Registry.Port when it is not specified.

Variables

This section is empty.

Functions

func SaveValidatorConfig

func SaveValidatorConfig(c *ValidatorConfig, tc *cfg.TaskConfig) error

SaveValidatorConfig saves a validator configuration file to disk

Types

type AWSPluginConfig

type AWSPluginConfig struct {
	Enabled            bool                   `yaml:"enabled"`
	Release            *validator.HelmRelease `yaml:"helmRelease"`
	AccessKeyID        string                 `yaml:"accessKeyId,omitempty"`
	SecretAccessKey    string                 `yaml:"secretAccessKey,omitempty"`
	SessionToken       string                 `yaml:"sessionToken,omitempty"`
	ServiceAccountName string                 `yaml:"serviceAccountName,omitempty"`
	Validator          *aws.AwsValidatorSpec  `yaml:"validator"`
}

AWSPluginConfig represents the AWS plugin configuration.

type AzurePluginConfig

type AzurePluginConfig struct {
	Enabled            bool                      `yaml:"enabled"`
	Release            *validator.HelmRelease    `yaml:"helmRelease"`
	ServiceAccountName string                    `yaml:"serviceAccountName,omitempty"`
	Cloud              string                    `yaml:"cloud"`
	TenantID           string                    `yaml:"tenantId"`
	ClientID           string                    `yaml:"clientId"`
	ClientSecret       string                    `yaml:"clientSecret"`
	Validator          *azure.AzureValidatorSpec `yaml:"validator"`
}

AzurePluginConfig represents the Azure plugin configuration.

type BasicAuth added in v0.0.5

type BasicAuth struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

BasicAuth represents basic authentication credentials.

func (*BasicAuth) Configured added in v0.0.5

func (ba *BasicAuth) Configured() bool

Configured returns true if the basic auth is non-empty.

type CACert added in v0.0.5

type CACert struct {
	Data string `yaml:"data"`
	Name string `yaml:"name"`
	Path string `yaml:"path"`
}

CACert represents a CA certificate.

type Env added in v0.0.5

type Env struct {
	HTTPProxy      string  `yaml:"httpProxy,omitempty"`
	HTTPSProxy     string  `yaml:"httpsProxy,omitempty"`
	NoProxy        string  `yaml:"noProxy,omitempty"`
	PodCIDR        *string `yaml:"podCIDR"`
	ProxyCACert    *CACert `yaml:"proxyCaCert,omitempty"`
	ServiceIPRange *string `yaml:"serviceIPRange"`
}

Env represents the environment configuration.

type KindConfig

type KindConfig struct {
	UseKindCluster  bool   `yaml:"useKindCluster"`
	KindClusterName string `yaml:"kindClusterName"`
}

KindConfig represents the kind configuration.

type MaasPluginConfig added in v0.1.2

type MaasPluginConfig struct {
	Enabled   bool                    `yaml:"enabled"`
	Release   *validator.HelmRelease  `yaml:"helmRelease"`
	Validator *maas.MaasValidatorSpec `yaml:"validator"`
}

MaasPluginConfig represents the MAAS plugin configuration.

type NetworkPluginConfig

type NetworkPluginConfig struct {
	Enabled       bool                          `yaml:"enabled"`
	Release       *validator.HelmRelease        `yaml:"helmRelease"`
	HTTPFileAuths [][]string                    `yaml:"httpFileAuths,omitempty"`
	Validator     *network.NetworkValidatorSpec `yaml:"validator"`
}

NetworkPluginConfig represents the network plugin configuration.

func (*NetworkPluginConfig) AddDummyHTTPFileAuth added in v0.1.0

func (c *NetworkPluginConfig) AddDummyHTTPFileAuth()

AddDummyHTTPFileAuth adds a dummy HTTP file auth to the NetworkPluginConfig. This keeps the slice in sync when reconfiguring the plugin.

type OCIPluginConfig

type OCIPluginConfig struct {
	Enabled          bool                   `yaml:"enabled"`
	Release          *validator.HelmRelease `yaml:"helmRelease"`
	Secrets          []*Secret              `yaml:"secrets,omitempty"`
	PublicKeySecrets []*PublicKeySecret     `yaml:"publicKeySecrets,omitempty"`
	CaCertPaths      map[int]string         `yaml:"caCertPaths,omitempty"`
	Validator        *oci.OciValidatorSpec  `yaml:"validator"`
}

OCIPluginConfig represents the OCI plugin configuration.

type ProxyConfig

type ProxyConfig struct {
	Enabled bool `yaml:"enabled"`
	Env     *Env `yaml:"env"`
}

ProxyConfig represents the proxy configuration.

type PublicKeySecret

type PublicKeySecret struct {
	Name string   `yaml:"name"`
	Keys []string `yaml:"keys"`
}

PublicKeySecret represents a public key secret.

type Registry added in v0.0.5

type Registry struct {
	Host                  string     `yaml:"host"`
	Port                  int        `yaml:"port"`
	BasicAuth             *BasicAuth `yaml:"basicAuth,omitempty"`
	InsecureSkipTLSVerify bool       `yaml:"insecureSkipTLSVerify"`
	CACert                *CACert    `yaml:"caCert,omitempty"`
	ReuseProxyCACert      bool       `yaml:"reuseProxyCACert,omitempty"`
	BaseContentPath       string     `yaml:"baseContentPath"`
	IsAirgapped           bool       `yaml:"isAirgapped"`
}

Registry represents the generic configuration for a registry. If IsAirgapped is true, a local Hauler registry is used.

func (*Registry) ChartEndpoint added in v0.0.5

func (r *Registry) ChartEndpoint() string

ChartEndpoint returns the chart repository URL.

func (*Registry) Endpoint added in v0.0.5

func (r *Registry) Endpoint() string

Endpoint returns the base registry URL.

func (*Registry) ImageEndpoint added in v0.0.5

func (r *Registry) ImageEndpoint() string

ImageEndpoint returns the image repository URL.

func (*Registry) KindImage added in v0.0.5

func (r *Registry) KindImage(image string) string

KindImage returns the image with the registry endpoint.

type RegistryConfig added in v0.0.5

type RegistryConfig struct {
	Enabled  bool      `yaml:"enabled"`
	Registry *Registry `yaml:"registry"`
}

RegistryConfig represents the artifact registry configuration.

func (*RegistryConfig) BasicAuthEnabled added in v0.1.0

func (c *RegistryConfig) BasicAuthEnabled() bool

BasicAuthEnabled returns true if basic auth is enabled on the RegistryConfig.

func (*RegistryConfig) ToHelmConfig added in v0.1.0

func (c *RegistryConfig) ToHelmConfig() *validator.HelmConfig

ToHelmConfig converts the RegistryConfig to a HelmConfig.

type Secret

type Secret struct {
	Name       string            `yaml:"name"`
	BasicAuth  *BasicAuth        `yaml:"basicAuth,omitempty"`
	Data       map[string]string `yaml:"data,omitempty"`
	CaCertFile string            `yaml:"caCertFile,omitempty"`
	Exists     bool              `yaml:"exists"`
}

Secret represents a k8s secret.

func (*Secret) ShouldCreate

func (s *Secret) ShouldCreate() bool

ShouldCreate returns true if the secret should be created.

type SinkConfig

type SinkConfig struct {
	Enabled      bool              `yaml:"enabled"`
	CreateSecret bool              `yaml:"createSecret"`
	SecretName   string            `yaml:"secretName"`
	Type         string            `yaml:"type"`
	Values       map[string]string `yaml:"values"`
}

SinkConfig represents the sink configuration.

type ValidatorConfig

type ValidatorConfig struct {
	HelmConfig       *validator.HelmConfig  `yaml:"helmConfig"`
	Release          *validator.HelmRelease `yaml:"helmRelease"`
	ReleaseSecret    *Secret                `yaml:"helmReleaseSecret"`
	KindConfig       KindConfig             `yaml:"kindConfig"`
	Kubeconfig       string                 `yaml:"kubeconfig"`
	RegistryConfig   *RegistryConfig        `yaml:"registryConfig"`
	SinkConfig       *SinkConfig            `yaml:"sinkConfig"`
	ProxyConfig      *ProxyConfig           `yaml:"proxyConfig"`
	ImageRegistry    string                 `yaml:"imageRegistry"`
	UseFixedVersions bool                   `yaml:"useFixedVersions"`

	AWSPlugin     *AWSPluginConfig     `yaml:"awsPlugin,omitempty"`
	AzurePlugin   *AzurePluginConfig   `yaml:"azurePlugin,omitempty"`
	MaasPlugin    *MaasPluginConfig    `yaml:"maasPlugin,omitempty"`
	NetworkPlugin *NetworkPluginConfig `yaml:"networkPlugin,omitempty"`
	OCIPlugin     *OCIPluginConfig     `yaml:"ociPlugin,omitempty"`
	VspherePlugin *VspherePluginConfig `yaml:"vspherePlugin,omitempty"`
}

ValidatorConfig represents the validator configuration.

func LoadValidatorConfig

func LoadValidatorConfig(tc *cfg.TaskConfig) (*ValidatorConfig, error)

LoadValidatorConfig loads a validator configuration file from disk

func NewValidatorConfig

func NewValidatorConfig() *ValidatorConfig

NewValidatorConfig creates a new ValidatorConfig object.

func NewValidatorFromConfig

func NewValidatorFromConfig(tc *cfg.TaskConfig) (*ValidatorConfig, error)

NewValidatorFromConfig loads a validator configuration file from disk and decrypts it

func (*ValidatorConfig) AnyPluginEnabled

func (c *ValidatorConfig) AnyPluginEnabled() bool

AnyPluginEnabled returns true if any plugin is enabled.

func (*ValidatorConfig) EnabledPluginsHaveRules added in v0.1.0

func (c *ValidatorConfig) EnabledPluginsHaveRules() (bool, []string)

EnabledPluginsHaveRules returns true if all enabled plugins have at least one rule configured.

type VspherePluginConfig

type VspherePluginConfig struct {
	Enabled   bool                             `yaml:"enabled"`
	Release   *validator.HelmRelease           `yaml:"helmRelease"`
	Validator *vsphereapi.VsphereValidatorSpec `yaml:"validator"`
}

VspherePluginConfig represents the vSphere plugin configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳