registration

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package registration creates a ByoHost CRD in the management cluster This is equivalent to a ByoHost joining a capacity pool

Index

Constants

View Source
const (
	KeySize = 2048
	// ExpirationSeconds defines the expiry time for Certificates
	// which is currently set to 1 year aligned with kubeadm defaults.
	ExpirationSeconds = 86400 * 365
	ByohCSROrg        = "byoh:hosts"
	ByohCSRCNFormat   = "byoh:host:%s"
	ByohCSRNameFormat = "byoh-csr-%s"
	TmpPrivateKey     = "byoh-client.key.tmp"
	DefaultConfigPath = ".byoh/config"
)

Variables

View Source
var (
	ConfigPath string
	// CSRApprovalTimeout defines the time to wait for certificate to
	// be issued. Currently set to 1 hour.
	CSRApprovalTimeout = 3600 * time.Second
)

Functions

func GetBYOHConfigPath added in v0.3.0

func GetBYOHConfigPath() string

GetBYOHConfigPath set the directory for BYOH kubeconfig

func LoadRESTClientConfig added in v0.3.0

func LoadRESTClientConfig(kubeconfigPath string) (*restclient.Config, error)

LoadRESTClientConfig is to create an instance of *restclient.Config from the boostrap kubeconfig path, this then will be used to create bootstrap k8s client

Types

type ByohCSR added in v0.3.0

type ByohCSR struct {
	PrivateKey []byte
	// contains filtered or unexported fields
}

func NewByohCSR added in v0.3.0

func NewByohCSR(bootstrapClientConfig *restclient.Config, logger logr.Logger, expiryDurationInSeconds int64) (*ByohCSR, error)

NewByohCSR returns a ByohCSR instance

func (*ByohCSR) BootstrapKubeconfig added in v0.3.0

func (bcsr *ByohCSR) BootstrapKubeconfig(hostName string) error

BootstrapKubeconfig will create a CertificateSigningRequest for the host its running on and once the CSR is approved it will fetch the Certificate and create a kubeconfig which will be used then by the host reconciler

func (*ByohCSR) RequestBYOHClientCert added in v0.3.0

func (bcsr *ByohCSR) RequestBYOHClientCert(hostname string) (string, types.UID, error)

RequestBYOHClientCert will generate Private Key and then will create a CertificateSigningRequest in K8s

type HostInfo

type HostInfo struct {
	DefaultNetworkInterfaceName string
}

HostInfo contains information about the host network interface.

type HostRegistrar

type HostRegistrar struct {
	K8sClient   client.Client
	ByoHostInfo HostInfo
}

HostRegistrar used to register a host.

var (
	// LocalHostRegistrar is a HostRegistrar that registers the local host.
	LocalHostRegistrar *HostRegistrar
)

func (*HostRegistrar) GetNetworkStatus

func (hr *HostRegistrar) GetNetworkStatus() []infrastructurev1beta1.NetworkStatus

GetNetworkStatus returns the network interface(s) status for the host

func (*HostRegistrar) Register

func (hr *HostRegistrar) Register(hostName, namespace string, hostLabels map[string]string) error

Register is called on agent startup This function registers the byohost as available capacity in the management cluster If the CR is already present, we consider this to be a restart / reboot of the agent process

func (*HostRegistrar) UpdateHost added in v0.3.0

func (hr *HostRegistrar) UpdateHost(ctx context.Context, byoHost *infrastructurev1beta1.ByoHost) error

UpdateHost updates the network interface and host platform details status for the host

Jump to

Keyboard shortcuts

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