tinkerbell

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExternalEtcdUnsupported = errors.New("external etcd configuration is unsupported")

ErrExternalEtcdUnsupported is returned from create or update when the user attempts to create or upgrade a cluster with an external etcd configuration.

Functions

func AnyImmutableFieldChanged added in v0.9.0

func AnyImmutableFieldChanged(oldVdc, newVdc *v1alpha1.TinkerbellDatacenterConfig, oldTmc, newTmc *v1alpha1.TinkerbellMachineConfig) bool

func AssertControlPlaneMachineRefExists added in v0.9.1

func AssertControlPlaneMachineRefExists(spec *ClusterSpec) error

AssertControlPlaneMachineRefExists ensures the control plane machine ref is referencing a known machine config.

func AssertDatacenterConfigValid added in v0.9.1

func AssertDatacenterConfigValid(spec *ClusterSpec) error

AssertDatacenterConfigValid asserts the DatacenterConfig in spec is valid.

func AssertEtcdMachineRefExists added in v0.9.1

func AssertEtcdMachineRefExists(spec *ClusterSpec) error

AssertEtcdMachineRefExists ensures that, if the etcd configuration is specified, it references a known machine config.

func AssertK8SVersionNot120 added in v0.11.0

func AssertK8SVersionNot120(spec *ClusterSpec) error

AssertK8SVersionNot120 ensures Kubernetes version is not set to v1.20

func AssertMachineConfigNamespaceMatchesDatacenterConfig added in v0.9.1

func AssertMachineConfigNamespaceMatchesDatacenterConfig(spec *ClusterSpec) error

AssertMachineConfigNamespaceMatchesDatacenterConfig ensures all machine configuration instances are configured with the same namespace as the provider specific data center configuration namespace.

func AssertMachineConfigsValid added in v0.9.1

func AssertMachineConfigsValid(spec *ClusterSpec) error

AssertMachineConfigsValid iterates over all machine configs in calling validateMachineConfig.

func AssertOsFamilyValid added in v0.11.0

func AssertOsFamilyValid(spec *ClusterSpec) error

func AssertWorkerNodeGroupMachineRefsExists added in v0.9.1

func AssertWorkerNodeGroupMachineRefsExists(spec *ClusterSpec) error

AssertWorkerNodeGroupMachineRefsExists ensures all worker node group machine refs are referencing a known machine config.

func NeedsNewControlPlaneTemplate added in v0.9.0

func NeedsNewControlPlaneTemplate(oldSpec, newSpec *cluster.Spec, oldVdc, newVdc *v1alpha1.TinkerbellDatacenterConfig, oldTmc, newTmc *v1alpha1.TinkerbellMachineConfig) bool

func NeedsNewEtcdTemplate added in v0.9.0

func NeedsNewEtcdTemplate(oldSpec, newSpec *cluster.Spec, oldVdc, newVdc *v1alpha1.TinkerbellDatacenterConfig, oldTmc, newTmc *v1alpha1.TinkerbellMachineConfig) bool

func NeedsNewKubeadmConfigTemplate added in v0.9.0

func NeedsNewKubeadmConfigTemplate(newWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration, oldWorkerNodeGroup *v1alpha1.WorkerNodeGroupConfiguration) bool

func NeedsNewWorkloadTemplate added in v0.9.0

func NeedsNewWorkloadTemplate(oldSpec, newSpec *cluster.Spec, oldVdc, newVdc *v1alpha1.TinkerbellDatacenterConfig, oldTmc, newTmc *v1alpha1.TinkerbellMachineConfig) bool

func NewTemplateBuilder added in v0.9.2

func NewTemplateBuilder(datacenterSpec *v1alpha1.TinkerbellDatacenterConfigSpec, controlPlaneMachineSpec, etcdMachineSpec *v1alpha1.TinkerbellMachineConfigSpec, diskExtractor *hardware.DiskExtractor, workerNodeGroupMachineSpecs map[string]v1alpha1.TinkerbellMachineConfigSpec, tinkerbellIp string, now types.NowFunc) providers.TemplateBuilder

Types

type ClusterSpec added in v0.9.1

type ClusterSpec struct {
	*cluster.Spec

	// DatacenterConfig configured in the cluster configuration YAML.
	DatacenterConfig *v1alpha1.TinkerbellDatacenterConfig

	// MachineConfigs configured in the cluster configuration YAML whether they're used or not.
	MachineConfigs map[string]*v1alpha1.TinkerbellMachineConfig
}

ClusterSpec represents a cluster configuration for Tinkerbell provisioning.

func NewClusterSpec added in v0.9.1

func NewClusterSpec(
	clusterSpec *cluster.Spec,
	machineConfigs map[string]*v1alpha1.TinkerbellMachineConfig,
	datacenterConfig *v1alpha1.TinkerbellDatacenterConfig,
) *ClusterSpec

NewClusterSpec creates a ClusterSpec instance.

func (*ClusterSpec) ControlPlaneConfiguration added in v0.9.2

func (s *ClusterSpec) ControlPlaneConfiguration() *v1alpha1.ControlPlaneConfiguration

ControlPlaneConfiguration retrieves the control plane configuration from s.

func (*ClusterSpec) ControlPlaneMachineConfig added in v0.9.1

func (s *ClusterSpec) ControlPlaneMachineConfig() *v1alpha1.TinkerbellMachineConfig

ControlPlaneMachineConfig retrieves the TinkerbellMachineConfig referenced by the cluster control plane machine reference.

func (*ClusterSpec) ExternalEtcdConfiguration added in v0.9.2

func (s *ClusterSpec) ExternalEtcdConfiguration() *v1alpha1.ExternalEtcdConfiguration

ExternalEtcdConfiguration returns the etcd configuration. The configuration may be nil. Consumers should check if external etcd configuration is present using HasExternalEtcd().

func (*ClusterSpec) ExternalEtcdMachineConfig added in v0.9.2

func (s *ClusterSpec) ExternalEtcdMachineConfig() *v1alpha1.TinkerbellMachineConfig

ExternalEtcdMachineConfig retrieves the TinkerbellMachineConfig referenced by the cluster etcd machine reference.

func (*ClusterSpec) HasExternalEtcd added in v0.9.1

func (s *ClusterSpec) HasExternalEtcd() bool

HasExternalEtcd returns true if there is an external etcd configuration.

func (*ClusterSpec) WorkerNodeGroupConfigurations added in v0.9.2

func (s *ClusterSpec) WorkerNodeGroupConfigurations() []v1alpha1.WorkerNodeGroupConfiguration

WorkerNodeGroupConfigurations retrieves all worker node group configurations in s.

func (*ClusterSpec) WorkerNodeGroupMachineConfig added in v0.9.2

func (s *ClusterSpec) WorkerNodeGroupMachineConfig(conf v1alpha1.WorkerNodeGroupConfiguration) *v1alpha1.TinkerbellMachineConfig

WorkerNodeGroupMachineConfig retrieves the machine group associated with conf.

type ClusterSpecAssertion added in v0.9.1

type ClusterSpecAssertion func(spec *ClusterSpec) error

ClusterSpecAssertion makes an assertion on spec.

func AssertionsForScaleUpDown added in v0.11.0

func AssertionsForScaleUpDown(catalogue *hardware.Catalogue, currentSpec *cluster.Spec, rollingUpgrade bool) ClusterSpecAssertion

func ExtraHardwareAvailableAssertion added in v0.11.0

func ExtraHardwareAvailableAssertion(catalogue *hardware.Catalogue, maxSurge int) ClusterSpecAssertion

func ExtraHardwareAvailableAssertionForRollingUpgrade added in v0.11.0

func ExtraHardwareAvailableAssertionForRollingUpgrade(catalogue *hardware.Catalogue, maxSurge int) ClusterSpecAssertion

func HardwareSatisfiesOnlyOneSelectorAssertion added in v0.9.2

func HardwareSatisfiesOnlyOneSelectorAssertion(catalogue *hardware.Catalogue) ClusterSpecAssertion

HardwareSatisfiesOnlyOneSelectorAssertion ensures hardware in catalogue only satisfies 1 of the MachineConfig's HardwareSelector's from the spec.

func MinimumHardwareAvailableAssertionForCreate added in v0.9.2

func MinimumHardwareAvailableAssertionForCreate(catalogue *hardware.Catalogue) ClusterSpecAssertion

MinimumHardwareAvailableAssertionForCreate asserts that catalogue has sufficient hardware to support the ClusterSpec during a create workflow.

It does not protect against intersections or subsets so consumers should ensure a 1-2-1 mapping between catalogue hardware and selectors.

func NewIPNotInUseAssertion added in v0.9.1

func NewIPNotInUseAssertion(client networkutils.NetClient) ClusterSpecAssertion

AssertcontrolPlaneIPNotInUse ensures the endpoint host for the control plane isn't in use. The check may be unreliable due to its implementation.

type ClusterSpecValidator added in v0.9.1

type ClusterSpecValidator []ClusterSpecAssertion

ClusterSpecValidator is composed of a set of ClusterSpecAssertions to be run on a ClusterSpec instance.

func NewClusterSpecValidator added in v0.9.1

func NewClusterSpecValidator(assertions ...ClusterSpecAssertion) *ClusterSpecValidator

NewClusterSpecValidator creates a ClusterSpecValidator instance with a set of default asseritons. Any assertions passed will be registered in addition to the default assertions.

func (*ClusterSpecValidator) Register added in v0.9.1

func (v *ClusterSpecValidator) Register(assertions ...ClusterSpecAssertion)

Register registers assertions with v.

func (*ClusterSpecValidator) Validate added in v0.9.1

func (v *ClusterSpecValidator) Validate(spec *ClusterSpec) error

Validate validates spec with all assertions registered on v.

type Provider added in v0.9.0

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

func NewProvider

func NewProvider(
	datacenterConfig *v1alpha1.TinkerbellDatacenterConfig,
	machineConfigs map[string]*v1alpha1.TinkerbellMachineConfig,
	clusterConfig *v1alpha1.Cluster,
	hardwareCSVPath string,
	writer filewriter.FileWriter,
	docker stack.Docker,
	helm stack.Helm,
	providerKubectlClient ProviderKubectlClient,
	tinkerbellIp string,
	now types.NowFunc,
	forceCleanup bool,
	skipIpCheck bool,
) (*Provider, error)

func (*Provider) BootstrapClusterOpts added in v0.9.0

func (p *Provider) BootstrapClusterOpts(_ *cluster.Spec) ([]bootstrapper.BootstrapClusterOption, error)

func (*Provider) ChangeDiff added in v0.9.0

func (p *Provider) ChangeDiff(currentSpec, newSpec *cluster.Spec) *types.ComponentChangeDiff

func (*Provider) DatacenterConfig added in v0.9.0

func (p *Provider) DatacenterConfig(_ *cluster.Spec) providers.DatacenterConfig

func (*Provider) DatacenterResourceType added in v0.9.0

func (p *Provider) DatacenterResourceType() string

func (*Provider) DeleteResources added in v0.9.0

func (p *Provider) DeleteResources(ctx context.Context, clusterSpec *cluster.Spec) error

func (*Provider) EnvMap added in v0.9.0

func (p *Provider) EnvMap(spec *cluster.Spec) (map[string]string, error)

func (*Provider) GenerateCAPISpecForCreate added in v0.9.0

func (p *Provider) GenerateCAPISpecForCreate(ctx context.Context, _ *types.Cluster, clusterSpec *cluster.Spec) (controlPlaneSpec, workersSpec []byte, err error)

func (*Provider) GenerateCAPISpecForUpgrade added in v0.9.0

func (p *Provider) GenerateCAPISpecForUpgrade(ctx context.Context, bootstrapCluster, workloadCluster *types.Cluster, currentSpec, clusterSpec *cluster.Spec) (controlPlaneSpec, workersSpec []byte, err error)

func (*Provider) GenerateStorageClass added in v0.9.0

func (p *Provider) GenerateStorageClass() []byte

func (*Provider) GetDeployments added in v0.9.0

func (p *Provider) GetDeployments() map[string][]string

func (*Provider) GetInfrastructureBundle added in v0.9.0

func (p *Provider) GetInfrastructureBundle(clusterSpec *cluster.Spec) *types.InfrastructureBundle

func (*Provider) InstallCustomProviderComponents added in v0.9.0

func (p *Provider) InstallCustomProviderComponents(ctx context.Context, kubeconfigFile string) error

func (*Provider) MachineConfigs added in v0.9.0

func (p *Provider) MachineConfigs(_ *cluster.Spec) []providers.MachineConfig

func (*Provider) MachineResourceType added in v0.9.0

func (p *Provider) MachineResourceType() string

func (*Provider) Name added in v0.9.0

func (p *Provider) Name() string

func (*Provider) PostBootstrapDeleteForUpgrade added in v0.11.0

func (p *Provider) PostBootstrapDeleteForUpgrade(ctx context.Context) error

func (*Provider) PostBootstrapSetup added in v0.9.0

func (p *Provider) PostBootstrapSetup(ctx context.Context, clusterConfig *v1alpha1.Cluster, cluster *types.Cluster) error

func (*Provider) PostBootstrapSetupUpgrade added in v0.9.2

func (p *Provider) PostBootstrapSetupUpgrade(ctx context.Context, clusterConfig *v1alpha1.Cluster, cluster *types.Cluster) error

func (*Provider) PostClusterDeleteValidate added in v0.9.0

func (p *Provider) PostClusterDeleteValidate(ctx context.Context, managementCluster *types.Cluster) error

func (*Provider) PostWorkloadInit added in v0.9.2

func (p *Provider) PostWorkloadInit(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error

func (*Provider) PreCAPIInstallOnBootstrap added in v0.9.0

func (p *Provider) PreCAPIInstallOnBootstrap(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error

func (*Provider) RunPostControlPlaneUpgrade added in v0.9.0

func (p *Provider) RunPostControlPlaneUpgrade(ctx context.Context, oldClusterSpec *cluster.Spec, clusterSpec *cluster.Spec, workloadCluster *types.Cluster, managementCluster *types.Cluster) error

func (*Provider) SetupAndValidateCreateCluster added in v0.9.0

func (p *Provider) SetupAndValidateCreateCluster(ctx context.Context, clusterSpec *cluster.Spec) error

func (*Provider) SetupAndValidateDeleteCluster added in v0.9.0

func (p *Provider) SetupAndValidateDeleteCluster(ctx context.Context, cluster *types.Cluster) error

func (*Provider) SetupAndValidateUpgradeCluster added in v0.9.0

func (p *Provider) SetupAndValidateUpgradeCluster(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec, currentClusterSpec *cluster.Spec) error

func (*Provider) UpdateKubeConfig added in v0.9.0

func (p *Provider) UpdateKubeConfig(content *[]byte, clusterName string) error

func (*Provider) UpdateSecrets added in v0.9.0

func (p *Provider) UpdateSecrets(ctx context.Context, cluster *types.Cluster) error

func (*Provider) UpgradeNeeded added in v0.9.0

func (p *Provider) UpgradeNeeded(_ context.Context, _, _ *cluster.Spec, _ *types.Cluster) (bool, error)

func (*Provider) ValidateNewSpec added in v0.9.0

func (p *Provider) ValidateNewSpec(_ context.Context, _ *types.Cluster, _ *cluster.Spec) error

func (*Provider) Version added in v0.9.0

func (p *Provider) Version(clusterSpec *cluster.Spec) string

type ProviderKubectlClient

type ProviderKubectlClient interface {
	ApplyKubeSpec(ctx context.Context, cluster *types.Cluster, spec string) error
	ApplyKubeSpecFromBytesForce(ctx context.Context, cluster *types.Cluster, data []byte) error
	DeleteEksaDatacenterConfig(ctx context.Context, eksaTinkerbellDatacenterResourceType string, tinkerbellDatacenterConfigName string, kubeconfigFile string, namespace string) error
	DeleteEksaMachineConfig(ctx context.Context, eksaTinkerbellMachineResourceType string, tinkerbellMachineConfigName string, kubeconfigFile string, namespace string) error
	GetMachineDeployment(ctx context.Context, machineDeploymentName string, opts ...executables.KubectlOpt) (*clusterv1.MachineDeployment, error)
	GetEksaCluster(ctx context.Context, cluster *types.Cluster, clusterName string) (*v1alpha1.Cluster, error)
	GetEksaTinkerbellDatacenterConfig(ctx context.Context, tinkerbellDatacenterConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.TinkerbellDatacenterConfig, error)
	GetEksaTinkerbellMachineConfig(ctx context.Context, tinkerbellMachineConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.TinkerbellMachineConfig, error)
	GetKubeadmControlPlane(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*controlplanev1.KubeadmControlPlane, error)
	GetEtcdadmCluster(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*etcdv1.EtcdadmCluster, error)
	GetSecret(ctx context.Context, secretObjectName string, opts ...executables.KubectlOpt) (*corev1.Secret, error)
	UpdateAnnotation(ctx context.Context, resourceType, objectName string, annotations map[string]string, opts ...executables.KubectlOpt) error
	WaitForDeployment(ctx context.Context, cluster *types.Cluster, timeout string, condition string, target string, namespace string) error
	GetUnprovisionedTinkerbellHardware(_ context.Context, kubeconfig, namespace string) ([]tinkv1alpha1.Hardware, error)
	GetProvisionedTinkerbellHardware(_ context.Context, kubeconfig, namespace string) ([]tinkv1alpha1.Hardware, error)
}

type SSHAuthKeyGenerator added in v0.8.0

type SSHAuthKeyGenerator interface {
	GenerateSSHAuthKey(filewriter.FileWriter) (string, error)
}

KeyGenerator generates ssh keys and writes them to a FileWriter.

type TemplateBuilder added in v0.9.2

type TemplateBuilder struct {
	WorkerNodeGroupMachineSpecs map[string]v1alpha1.TinkerbellMachineConfigSpec
	// contains filtered or unexported fields
}

func (*TemplateBuilder) GenerateCAPISpecControlPlane added in v0.9.2

func (tb *TemplateBuilder) GenerateCAPISpecControlPlane(clusterSpec *cluster.Spec, buildOptions ...providers.BuildMapOption) (content []byte, err error)

func (*TemplateBuilder) GenerateCAPISpecWorkers added in v0.9.2

func (tb *TemplateBuilder) GenerateCAPISpecWorkers(clusterSpec *cluster.Spec, workloadTemplateNames, kubeadmconfigTemplateNames map[string]string) (content []byte, err error)

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
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