capi

package
v0.0.0-...-d888b32 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MPL-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package capi manages CAPI installation, provides default client for CAPI CRDs.

Package capi manages CAPI installation, provides default client for CAPI CRDs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetalClient

func GetMetalClient(config *rest.Config) (runtimeclient.Client, error)

GetMetalClient builds k8s client with schemes required to access all the CAPI/Sidero/Talos components.

Types

type Cluster

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

Cluster attaches to the provisioned CAPI cluster and provides talos.Cluster.

func (*Cluster) ControlPlanes

func (cluster *Cluster) ControlPlanes(ctx context.Context) (*unstructured.Unstructured, error)

ControlPlanes gets controlplane object from the management cluster.

func (*Cluster) Health

func (cluster *Cluster) Health(ctx context.Context) error

Health runs the healthcheck for the cluster.

func (*Cluster) Name

func (cluster *Cluster) Name() string

Name of the cluster.

func (*Cluster) Namespace

func (cluster *Cluster) Namespace() string

Namespace of the cluster.

func (*Cluster) Scale

func (cluster *Cluster) Scale(ctx context.Context, replicas int, nodes NodeGroup, setters ...ScaleOption) error

Scale cluster nodes.

func (*Cluster) Sync

func (cluster *Cluster) Sync(ctx context.Context) error

Sync updates nodes pool and recreates talos client.

func (*Cluster) TalosClient

func (cluster *Cluster) TalosClient(ctx context.Context) (*talosclient.Client, error)

TalosClient returns new talos client for the CAPI cluster.

func (*Cluster) TalosConfig

func (cluster *Cluster) TalosConfig(ctx context.Context) (*clientconfig.Config, error)

TalosConfig returns talosconfig for the cluster.

func (*Cluster) Workers

func (cluster *Cluster) Workers(ctx context.Context) (*unstructured.UnstructuredList, error)

Workers gets MachineDeployment list from the management cluster.

type Config

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

Config custom implementation of config reader for clusterctl.

func (*Config) Get

func (c *Config) Get(key string) (string, error)

Get implements config.Reader.

func (*Config) Init

func (c *Config) Init(ctx context.Context, path string) error

Init initializes the config.

func (*Config) Set

func (c *Config) Set(key, value string)

Set implements config.Reader.

func (*Config) UnmarshalKey

func (c *Config) UnmarshalKey(key string, rawval interface{}) error

UnmarshalKey implements config.Reader.

type DeployOption

type DeployOption func(opts *DeployOptions) error

DeployOption defines a single CAPI cluster creation option.

func WithClusterNamespace

func WithClusterNamespace(val string) DeployOption

WithClusterNamespace sets cluster namespace.

func WithControlPlaneNodes

func WithControlPlaneNodes(count int64) DeployOption

WithControlPlaneNodes creates a cluster with N control plane nodes.

func WithDeployOptions

func WithDeployOptions(val *DeployOptions) DeployOption

WithDeployOptions sets deploy options as a struct.

func WithKubernetesVersion

func WithKubernetesVersion(version string) DeployOption

WithKubernetesVersion sets Kubernetes version.

func WithProvider

func WithProvider(name string) DeployOption

WithProvider sets cluster provider.

func WithProviderOptions

func WithProviderOptions(val interface{}) DeployOption

WithProviderOptions sets provider specific deploy options.

func WithProviderVersion

func WithProviderVersion(version string) DeployOption

WithProviderVersion picks provider with a specific version.

func WithTalosVersion

func WithTalosVersion(version string) DeployOption

WithTalosVersion sets Talos version.

func WithTemplate

func WithTemplate(data []byte) DeployOption

WithTemplate loads cluster template from memory.

func WithTemplateFile

func WithTemplateFile(path string) DeployOption

WithTemplateFile load cluster template from the file.

func WithWorkerNodes

func WithWorkerNodes(count int64) DeployOption

WithWorkerNodes creates a cluster with N worker nodes.

type DeployOptions

type DeployOptions struct {
	Provider          string
	ProviderVersion   string
	ClusterName       string
	ClusterNamespace  string
	TalosVersion      string
	KubernetesVersion string
	TemplateFile      string
	Template          []byte
	ControlPlaneNodes int64
	WorkerNodes       int64
	// contains filtered or unexported fields
}

DeployOptions cluster deployment options.

func DefaultDeployOptions

func DefaultDeployOptions() *DeployOptions

DefaultDeployOptions default deployment settings.

type Manager

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

Manager installs and controls cluster API installation.

func NewManager

func NewManager(ctx context.Context, options Options) (*Manager, error)

NewManager creates new Manager object.

func (*Manager) CheckClusterReady

func (clusterAPI *Manager) CheckClusterReady(ctx context.Context, cluster *Cluster) error

CheckClusterReady verifies that cluster ready from the CAPI point of view.

func (*Manager) DeployCluster

func (clusterAPI *Manager) DeployCluster(ctx context.Context, clusterName string, setters ...DeployOption) (*Cluster, error)

DeployCluster creates a new cluster.

func (*Manager) DestroyCluster

func (clusterAPI *Manager) DestroyCluster(ctx context.Context, name, namespace string) error

DestroyCluster deletes cluster.

func (*Manager) FetchState

func (clusterAPI *Manager) FetchState(ctx context.Context) error

FetchState fetches infra providers and installed CAPI version if any.

func (*Manager) GetClient

func (clusterAPI *Manager) GetClient(context.Context) (client runtimeclient.Client, err error)

GetClient returns k8s client stuffed with CAPI CRDs.

func (*Manager) GetClientSet

func (clusterAPI *Manager) GetClientSet() *kubernetes.Clientset

GetClientSet returns a kubernetes clientset to use.

func (*Manager) GetKubeconfig

func (clusterAPI *Manager) GetKubeconfig(context.Context) (client.Kubeconfig, error)

GetKubeconfig returns kubeconfig in clusterctl expected format.

func (*Manager) GetManagerClient

func (clusterAPI *Manager) GetManagerClient() client.Client

GetManagerClient client returns instance of cluster API client.

func (*Manager) Install

func (clusterAPI *Manager) Install(ctx context.Context) error

Install the Manager components and wait for them to be ready.

func (*Manager) InstallCore

func (clusterAPI *Manager) InstallCore(ctx context.Context, kubeconfig client.Kubeconfig) error

InstallCore installs only core, global watched components (capi, cabpt, cacppt).

func (*Manager) InstallProvider

func (clusterAPI *Manager) InstallProvider(ctx context.Context, kubeconfig client.Kubeconfig, provider infrastructure.Provider) error

InstallProvider installs a specific infrastructure provider and allows namespacing of the provider itself and its "watches".

func (*Manager) NewCluster

func (clusterAPI *Manager) NewCluster(ctx context.Context, name, namespace string) (*Cluster, error)

NewCluster fetches cluster info from the CAPI state.

func (*Manager) Version

func (clusterAPI *Manager) Version() string

Version returns installed CAPI version.

type NodeGroup

type NodeGroup int

NodeGroup defines CAPI cluster node type group.

const (
	// ControlPlaneNodes control plane nodes group.
	ControlPlaneNodes NodeGroup = iota
	// WorkerNodes worker nodes group.
	WorkerNodes
)

type Options

type Options struct {
	Proxy                   cluster.Proxy
	Kubeconfig              client.Kubeconfig
	ClusterctlConfigPath    string
	CoreProvider            string
	ContextName             string
	InfrastructureProviders []infrastructure.Provider
	BootstrapProviders      []string
	ControlPlaneProviders   []string
	WaitProviderTimeout     time.Duration
}

Options for the CAPI installer.

type ScaleOption

type ScaleOption func(*ScaleOptions)

ScaleOption optional scale parameter setter.

func MachineDeploymentName

func MachineDeploymentName(name string) ScaleOption

MachineDeploymentName allows setting machine deployment name for scaling clusters that have more than one machine group.

type ScaleOptions

type ScaleOptions struct {
	MachineDeploymentName string
}

ScaleOptions defines additional optional parameters for scale method.

Directories

Path Synopsis
Package infrastructure contains infrastructure providers setup hooks and ready conditions.
Package infrastructure contains infrastructure providers setup hooks and ready conditions.

Jump to

Keyboard shortcuts

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