components

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 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 ConfigureBaseValidator added in v0.0.3

func ConfigureBaseValidator(vc *ValidatorConfig, kubeconfig string)

ConfigureBaseValidator configures the base validator configuration

func ConfigureNetworkPlugin added in v0.0.3

func ConfigureNetworkPlugin(vc *ValidatorConfig, config NetworkConfig)

ConfigureNetworkPlugin configures the network plugin.

func ConfigureOciPlugin added in v0.0.3

func ConfigureOciPlugin(vc *ValidatorConfig, config OciConfig)

ConfigureOciPlugin configures the OCI plugin.

func ConfigureVspherePlugin added in v0.0.3

func ConfigureVspherePlugin(vc *ValidatorConfig, config VsphereConfig)

ConfigureVspherePlugin configures the vSphere plugin.

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"`
	ReleaseSecret      *Secret                `yaml:"helmReleaseSecret"`
	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"`
	ReleaseSecret          *Secret                              `yaml:"helmReleaseSecret"`
	ServiceAccountName     string                               `yaml:"serviceAccountName,omitempty"`
	TenantID               string                               `yaml:"tenantId"`
	ClientID               string                               `yaml:"clientId"`
	ClientSecret           string                               `yaml:"clientSecret"`
	RuleTypes              map[int]string                       `yaml:"ruleTypes"`
	PlacementTypes         map[int]string                       `yaml:"placementTypes"`
	StaticDeploymentTypes  map[int]string                       `yaml:"staticDeploymentTypes"`
	StaticDeploymentValues map[int]*AzureStaticDeploymentValues `yaml:"staticDeploymentValues"`
	Validator              *azure.AzureValidatorSpec            `yaml:"validator"`
}

AzurePluginConfig represents the Azure plugin configuration.

type AzureStaticDeploymentValues

type AzureStaticDeploymentValues struct {
	Subscription   string `yaml:"subscriptionUuid"`
	ResourceGroup  string `yaml:"resourceGroupUuid"`
	VirtualNetwork string `yaml:"virtualNetworkUuid"`
	Subnet         string `yaml:"subnetUuid"`
	ComputeGallery string `yaml:"computeGalleryUuid"`
}

AzureStaticDeploymentValues represents the static deployment values for Azure.

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 NetworkConfig added in v0.0.3

type NetworkConfig struct {
	VcenterServer string
	IPRangeRules  []network_api.IPRangeRule
	TCPConnRules  []network_api.TCPConnRule
}

NetworkConfig represents the network plugin configuration.

type NetworkPluginConfig

type NetworkPluginConfig struct {
	Enabled       bool                          `yaml:"enabled"`
	Release       *validator.HelmRelease        `yaml:"helmRelease"`
	ReleaseSecret *Secret                       `yaml:"helmReleaseSecret"`
	Validator     *network.NetworkValidatorSpec `yaml:"validator"`
}

NetworkPluginConfig represents the network plugin configuration.

type OCIPluginConfig

type OCIPluginConfig struct {
	Enabled          bool                   `yaml:"enabled"`
	Release          *validator.HelmRelease `yaml:"helmRelease"`
	ReleaseSecret    *Secret                `yaml:"helmReleaseSecret"`
	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 OciConfig added in v0.0.3

type OciConfig struct {
	// HostRefs is a map of hostnames to a list of artifact references
	HostRefs map[string][]string
}

OciConfig 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.

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 {
	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"`
	NetworkPlugin *NetworkPluginConfig `yaml:"networkPlugin,omitempty"`
	OCIPlugin     *OCIPluginConfig     `yaml:"ociPlugin,omitempty"`
	VspherePlugin *VspherePluginConfig `yaml:"vspherePlugin,omitempty"`
	AzurePlugin   *AzurePluginConfig   `yaml:"azurePlugin,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.

type VsphereConfig added in v0.0.3

type VsphereConfig struct {
	Username                     string
	Password                     string
	VcenterServer                string
	Datacenter                   string
	ClusterName                  string
	ImageTemplateFolder          string
	NodePoolResourceRequirements []vsphereapi.NodepoolResourceRequirement
	TagValidationRules           []vsphereapi.TagValidationRule
	Privileges                   []string
}

VsphereConfig represents the vSphere plugin configuration.

type VsphereEntityPrivilegeRule

type VsphereEntityPrivilegeRule struct {
	vsphereapi.EntityPrivilegeValidationRule `yaml:",inline"`
	ClusterScoped                            bool `yaml:"clusterScoped"`
}

VsphereEntityPrivilegeRule represents a vSphere entity privilege rule.

type VspherePluginConfig

type VspherePluginConfig struct {
	Enabled                     bool                             `yaml:"enabled"`
	Release                     *validator.HelmRelease           `yaml:"helmRelease"`
	ReleaseSecret               *Secret                          `yaml:"helmReleaseSecret"`
	Account                     *vsphere.CloudAccount            `yaml:"account"`
	Validator                   *vsphereapi.VsphereValidatorSpec `yaml:"validator"`
	VsphereEntityPrivilegeRules []VsphereEntityPrivilegeRule     `yaml:"vsphereEntityPrivilegeRules"`
	VsphereRolePrivilegeRules   []VsphereRolePrivilegeRule       `yaml:"vsphereRolePrivilegeRules"`
	VsphereTagRules             []VsphereTagRule                 `yaml:"vsphereTagRules"`
}

VspherePluginConfig represents the vSphere plugin configuration.

type VsphereRolePrivilegeRule

type VsphereRolePrivilegeRule struct {
	vsphereapi.GenericRolePrivilegeValidationRule `yaml:",inline"`
	Name                                          string `yaml:"name"`
}

VsphereRolePrivilegeRule represents a vSphere role privilege rule.

type VsphereTagRule

type VsphereTagRule struct {
	vsphereapi.TagValidationRule `yaml:",inline"`
}

VsphereTagRule represents a vSphere tag rule.

Jump to

Keyboard shortcuts

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