bootstrapper

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootstrapClusterClientOption

type BootstrapClusterClientOption func() error

type BootstrapClusterOption

type BootstrapClusterOption func(b *Bootstrapper) BootstrapClusterClientOption

func WithEnv

func WithEnv(env map[string]string) BootstrapClusterOption

func WithExtraDockerMounts

func WithExtraDockerMounts() BootstrapClusterOption

func WithExtraPortMappings added in v0.9.0

func WithExtraPortMappings(ports []int) BootstrapClusterOption

type Bootstrapper

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

func New

func New(clusterClient ClusterClient) *Bootstrapper

New constructs a new bootstrapper.

func (*Bootstrapper) CreateBootstrapCluster

func (b *Bootstrapper) CreateBootstrapCluster(ctx context.Context, clusterSpec *cluster.Spec, opts ...BootstrapClusterOption) (*types.Cluster, error)

func (*Bootstrapper) DeleteBootstrapCluster

func (b *Bootstrapper) DeleteBootstrapCluster(ctx context.Context, cluster *types.Cluster, operationType constants.Operation, isForceCleanup bool) error

type ClusterClient

type ClusterClient interface {
	Apply(ctx context.Context, cluster *types.Cluster, data []byte) error
	CreateNamespace(ctx context.Context, kubeconfig, namespace string) error
	GetCAPIClusterCRD(ctx context.Context, cluster *types.Cluster) error
	GetCAPIClusters(ctx context.Context, cluster *types.Cluster) ([]types.CAPICluster, error)
	KindClusterExists(ctx context.Context, clusterName string) (bool, error)
	GetKindClusterKubeconfig(ctx context.Context, clusterName string) (string, error)
	CreateBootstrapCluster(ctx context.Context, clusterSpec *cluster.Spec, opts ...BootstrapClusterClientOption) (string, error)
	DeleteKindCluster(ctx context.Context, cluster *types.Cluster) error
	WithExtraDockerMounts() BootstrapClusterClientOption
	WithExtraPortMappings([]int) BootstrapClusterClientOption
	WithEnv(env map[string]string) BootstrapClusterClientOption
}

type KindClient added in v0.15.2

type KindClient interface {
	CreateBootstrapCluster(ctx context.Context, clusterSpec *cluster.Spec, opts ...BootstrapClusterClientOption) (kubeconfig string, err error)
	DeleteBootstrapCluster(ctx context.Context, cluster *types.Cluster) error
	WithExtraDockerMounts() BootstrapClusterClientOption
	WithExtraPortMappings([]int) BootstrapClusterClientOption
	WithEnv(env map[string]string) BootstrapClusterClientOption
	GetKubeconfig(ctx context.Context, clusterName string) (string, error)
	ClusterExists(ctx context.Context, clusterName string) (bool, error)
}

KindClient is a Kind client.

type KubernetesClient added in v0.15.2

type KubernetesClient interface {
	ApplyKubeSpecFromBytes(ctx context.Context, cluster *types.Cluster, data []byte) error
	GetClusters(ctx context.Context, cluster *types.Cluster) ([]types.CAPICluster, error)
	ValidateClustersCRD(ctx context.Context, cluster *types.Cluster) error
	CreateNamespaceIfNotPresent(ctx context.Context, kubeconfig string, namespace string) error
}

KubernetesClient is a Kubernetes client.

type RetrierClient added in v0.15.2

type RetrierClient struct {
	KindClient
	// contains filtered or unexported fields
}

RetrierClient wraps kind and kubernetes APIs around a retrier.

func NewRetrierClient added in v0.11.2

func NewRetrierClient(kind KindClient, k8s KubernetesClient, opts ...RetrierClientOpt) RetrierClient

NewRetrierClient constructs a new RetrierClient.

func (RetrierClient) Apply added in v0.15.2

func (c RetrierClient) Apply(ctx context.Context, cluster *types.Cluster, data []byte) error

Apply creates/updates the data objects for a cluster.

func (RetrierClient) CreateNamespace added in v0.15.2

func (c RetrierClient) CreateNamespace(ctx context.Context, kubeconfig, namespace string) error

CreateNamespace creates a namespace if the namespace does not exist.

func (RetrierClient) DeleteKindCluster added in v0.15.2

func (c RetrierClient) DeleteKindCluster(ctx context.Context, cluster *types.Cluster) error

DeleteKindCluster deletes a kind cluster by cluster name.

func (RetrierClient) GetCAPIClusterCRD added in v0.15.2

func (c RetrierClient) GetCAPIClusterCRD(ctx context.Context, cluster *types.Cluster) error

GetCAPIClusterCRD gets the capi cluster crd in a K8s cluster.

func (RetrierClient) GetCAPIClusters added in v0.15.2

func (c RetrierClient) GetCAPIClusters(ctx context.Context, cluster *types.Cluster) ([]types.CAPICluster, error)

GetCAPIClusters gets all the capi clusters in a K8s cluster.

func (RetrierClient) GetKindClusterKubeconfig added in v0.15.2

func (c RetrierClient) GetKindClusterKubeconfig(ctx context.Context, clusterName string) (string, error)

GetKindClusterKubeconfig gets the kubeconfig for a kind cluster by cluster name.

func (RetrierClient) KindClusterExists added in v0.15.2

func (c RetrierClient) KindClusterExists(ctx context.Context, clusterName string) (bool, error)

KindClusterExists checks whether a kind cluster exists by a cluster name.

type RetrierClientOpt added in v0.15.2

type RetrierClientOpt func(*RetrierClient)

RetrierClientOpt allows to customize a RetrierClient on construction.

func WithRetrierClientRetrier added in v0.15.2

func WithRetrierClientRetrier(retrier retrier.Retrier) RetrierClientOpt

WithRetrierClientRetrier allows to use a custom retrier.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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