tinkerbell

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Provisioning = "provisioning"
)

Variables

This section is empty.

Functions

func AnyImmutableFieldChanged added in v0.9.0

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

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 NewTinkerbellTemplateBuilder

func NewTinkerbellTemplateBuilder(datacenterSpec *v1alpha1.TinkerbellDatacenterConfigSpec, controlPlaneMachineSpec, etcdMachineSpec *v1alpha1.TinkerbellMachineConfigSpec, workerNodeGroupMachineSpecs map[string]v1alpha1.TinkerbellMachineConfigSpec, now types.NowFunc) providers.TemplateBuilder

Types

type Provider added in v0.9.0

type Provider struct {
	Retrier *retrier.Retrier
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(
	datacenterConfig *v1alpha1.TinkerbellDatacenterConfig,
	machineConfigs map[string]*v1alpha1.TinkerbellMachineConfig,
	clusterConfig *v1alpha1.Cluster,
	writer filewriter.FileWriter,
	providerKubectlClient ProviderKubectlClient,
	providerTinkbellClient TinkerbellClients,
	now types.NowFunc,
	skipIpCheck bool,
	hardwareManifestPath string,
	skipPowerActions bool,
	setupTinkerbell bool,
	force bool,
) *Provider

func NewProviderCustomDep added in v0.8.0

func NewProviderCustomDep(
	datacenterConfig *v1alpha1.TinkerbellDatacenterConfig,
	machineConfigs map[string]*v1alpha1.TinkerbellMachineConfig,
	clusterConfig *v1alpha1.Cluster,
	writer filewriter.FileWriter,
	providerKubectlClient ProviderKubectlClient,
	providerTinkClient ProviderTinkClient,
	pbnjClient ProviderPbnjClient,
	netClient networkutils.NetClient,
	now types.NowFunc,
	skipIpCheck bool,
	hardwareManifestPath string,
	skipPowerActions bool,
	setupTinkerbell bool,
	force bool,
) *Provider

func (*Provider) BootstrapClusterOpts added in v0.9.0

func (p *Provider) BootstrapClusterOpts() ([]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(_ *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) GenerateMHC added in v0.9.0

func (p *Provider) GenerateMHC() ([]byte, 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) InstallTinkerbellStack added in v0.9.0

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

func (*Provider) MachineConfigs added in v0.9.0

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

func (*Provider) MachineDeploymentsToDelete added in v0.9.0

func (p *Provider) MachineDeploymentsToDelete(workloadCluster *types.Cluster, currentSpec, newSpec *cluster.Spec) []string

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) PostBootstrapSetup added in v0.9.0

func (p *Provider) PostBootstrapSetup(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) 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) 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)
	GetHardwareWithLabel(ctx context.Context, label, kubeconfigFile, namespace string) ([]tinkv1alpha1.Hardware, error)
	GetBmcsPowerState(ctx context.Context, bmcNames []string, kubeconfigFile, namespace string) ([]string, 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
}

TODO: Add necessary kubectl functions here

type ProviderPbnjClient added in v0.8.0

type ProviderPbnjClient interface {
	GetPowerState(ctx context.Context, bmc pbnj.BmcSecretConfig) (pbnj.PowerState, error)
	PowerOff(context.Context, pbnj.BmcSecretConfig) error
	PowerOn(context.Context, pbnj.BmcSecretConfig) error
	SetBootDevice(ctx context.Context, info pbnj.BmcSecretConfig, mode pbnj.BootDevice) error
}

type ProviderTinkClient added in v0.8.0

type ProviderTinkClient interface {
	GetHardware(ctx context.Context) ([]*tinkhardware.Hardware, error)
	GetHardwareByUuid(ctx context.Context, uuid string) (*hardware.Hardware, error)
	PushHardware(ctx context.Context, hardware []byte) error
	GetWorkflow(ctx context.Context) ([]*tinkworkflow.Workflow, error)
	DeleteWorkflow(ctx context.Context, workflowIDs ...string) 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 TinkerbellClients added in v0.8.0

type TinkerbellClients struct {
	ProviderTinkClient ProviderTinkClient
	ProviderPbnjClient ProviderPbnjClient
}

type TinkerbellTemplateBuilder

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

func (*TinkerbellTemplateBuilder) GenerateCAPISpecControlPlane

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

func (*TinkerbellTemplateBuilder) GenerateCAPISpecWorkers

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

type Validator added in v0.8.0

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

func NewValidator added in v0.8.0

func NewValidator(tink ProviderTinkClient, netClient networkutils.NetClient, pbnjClient ProviderPbnjClient) *Validator

func (*Validator) ValidateAndPopulateTemplate added in v0.9.0

func (v *Validator) ValidateAndPopulateTemplate(ctx context.Context, datacenterConfig *v1alpha1.TinkerbellDatacenterConfig, templateConfig *v1alpha1.TinkerbellTemplateConfig) error

func (*Validator) ValidateAndPopulateTemplateForUpgrade added in v0.9.0

func (v *Validator) ValidateAndPopulateTemplateForUpgrade(ctx context.Context, datacenterConfig *v1alpha1.TinkerbellDatacenterConfig, templateConfig *v1alpha1.TinkerbellTemplateConfig, imgUrl string, k8sVersion string) error

func (*Validator) ValidateBMCSecretCreds added in v0.8.0

func (v *Validator) ValidateBMCSecretCreds(ctx context.Context, catalogue *hardware.Catalogue) error

func (*Validator) ValidateClusterMachineConfigs added in v0.8.0

func (v *Validator) ValidateClusterMachineConfigs(ctx context.Context, tinkerbellClusterSpec *spec) error

TODO: dry out machine configs validations

func (*Validator) ValidateHardwareCatalogue added in v0.9.0

func (v *Validator) ValidateHardwareCatalogue(ctx context.Context, catalogue *hardware.Catalogue, hardwares []*tinkhardware.Hardware, skipPowerActions, force bool) error

func (*Validator) ValidateMachinesPoweredOff added in v0.9.0

func (v *Validator) ValidateMachinesPoweredOff(ctx context.Context, catalogue *hardware.Catalogue) error

ValidateMachinesPoweredOff validates the hardware submitted for provisioning is powered off.

func (*Validator) ValidateMinHardwareAvailableForCreate added in v0.9.0

func (v *Validator) ValidateMinHardwareAvailableForCreate(spec v1alpha1.ClusterSpec, catalogue *hardware.Catalogue) error

ValidateMinHardwareAvailableForCreate ensures there is sufficient hardware registered relative to the sum of requested control plane, etcd and worker node counts. The system requires hardware >= to requested provisioning.

func (*Validator) ValidateMinHardwareAvailableForUpgrade added in v0.9.0

func (v *Validator) ValidateMinHardwareAvailableForUpgrade(spec v1alpha1.ClusterSpec, maxSurge int) error

ValidateMinHardwareAvailableForUpgrade ensures there is sufficient hardware registered relative to the sum of requested control plane, etcd and worker node counts. The system requires hardware >= to requested provisioning. ValidateMinHardwareAvailableForUpgrade requires v.ValidateHardwareConfig() to be called first.

func (*Validator) ValidateTinkerbellConfig added in v0.8.0

func (v *Validator) ValidateTinkerbellConfig(ctx context.Context, datacenterConfig *v1alpha1.TinkerbellDatacenterConfig) 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.

Jump to

Keyboard shortcuts

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