testenv

package module
v0.0.0-...-cd0bf57 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

README

This repository is no longer maintained.

testenv

Library for creating Kubernetes environments

Average Convergence Times

Cluster Type Creation Destruction
GKE ~ 7m ~ 9m58s
EKS ~ ~
AKS ~ 4m58s ~ 5m41s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AKSConfig

type AKSConfig struct {
	// Location in Azure where cluster will be created.
	Location string
	// KubernetesVersion supported by AKS.
	KubernetesVersion string
}

AKSConfig is used to create AKS test environments.

func (AKSConfig) ResourcePath

func (c AKSConfig) ResourcePath() string

ResourcePath to Terraform module.

func (AKSConfig) Validate

func (c AKSConfig) Validate() (err error)

Validate ensures required variables are provided.

func (AKSConfig) Vars

func (c AKSConfig) Vars() []byte

Vars derived from struct fields.

type CloudConfig

type CloudConfig interface {
	Vars() []byte
	Validate() error
	ResourcePath() string
}

CloudConfig represents a type that contains the information required to build cloud-based Kubernetes cluster from one of the templates defined in the project resources/ directory.

type CloudEnvManager

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

CloudEnvManager is a Terraform-based Manager used to create Kubernetes clusters in the cloud.

func NewCloudEnvManager

func NewCloudEnvManager(ctx context.Context, config CloudConfig, verbose bool) (*CloudEnvManager, error)

NewCloudEnvManager creates a CloudEnvManager with the resources necessary to invoke Terraform.

The CloudConfig implementation will determine which cloud-provided cluster is created, such as GKEConfig. All Terraform operations will be streamed to stdout when verbose is set to true.

func (*CloudEnvManager) Create

func (m *CloudEnvManager) Create(ctx context.Context) error

func (*CloudEnvManager) Destroy

func (m *CloudEnvManager) Destroy(ctx context.Context) error

func (*CloudEnvManager) HelmfileApply

func (m *CloudEnvManager) HelmfileApply(ctx context.Context, helmfilePath string, values []string) error

func (*CloudEnvManager) HelmfileDestroy

func (m *CloudEnvManager) HelmfileDestroy(ctx context.Context) error

func (*CloudEnvManager) KubeconfigBytes

func (m *CloudEnvManager) KubeconfigBytes(ctx context.Context) ([]byte, error)

func (*CloudEnvManager) OutputVar

func (m *CloudEnvManager) OutputVar(ctx context.Context, key string) ([]byte, error)

type EKSConfig

type EKSConfig struct {
	Region            string
	KubernetesVersion string
}

EKSConfig is used to create EKS test environments.

func (EKSConfig) ResourcePath

func (e EKSConfig) ResourcePath() string

func (EKSConfig) Validate

func (e EKSConfig) Validate() (err error)

func (EKSConfig) Vars

func (e EKSConfig) Vars() []byte

type GKEConfig

type GKEConfig struct {
	// Region in GCP where cluster will be created.
	Region string
	// ProjectID in GCP where cluster will be created.
	ProjectID string
	// KubernetesVersion supported by GKE.
	KubernetesVersion string
	// KubernetesServiceAccount that should be granted access to the test Google Artifact Registry.
	KubernetesServiceAccount string
}

GKEConfig is used to create GKE test environments.

func (GKEConfig) ResourcePath

func (c GKEConfig) ResourcePath() string

ResourcePath to Terraform module.

func (GKEConfig) Validate

func (c GKEConfig) Validate() (err error)

Validate ensures required variables are provided.

func (GKEConfig) Vars

func (c GKEConfig) Vars() []byte

Vars derived from struct fields.

type Manager

type Manager interface {
	// Create a new environment.
	Create(ctx context.Context) error
	// Destroy an existing environment.
	Destroy(ctx context.Context) error
	// OutputVar read from test environment provisioner.
	OutputVar(ctx context.Context, key string) ([]byte, error)
	// HelmfileApply all resources from helmfile only when there are changes.
	HelmfileApply(ctx context.Context, helmfilePath string, values []string) error
	// HelmfileDestroy all releases that have been installed.
	HelmfileDestroy(ctx context.Context) error
	// KubeconfigBytes can be written to disk or used to initialize a Kubernetes client.
	KubeconfigBytes(ctx context.Context) ([]byte, error)
}

Manager is responsible for governing the lifecycle of Kubernetes test environments including creation, destruction, application installation via Helmfile, and providing access to a kubeconfig file.

Jump to

Keyboard shortcuts

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