resources

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudFactory

type CloudFactory interface {
	// NewVM create VirtualMachine with index for storing its state
	NewVM(StorageFactory, int) error

	// DelVM delete VirtualMachine with index for storing its state
	DelVM(StorageFactory, int) error

	// NewFirewall create Firewall
	NewFirewall(StorageFactory) error

	// DelFirewall delete Firewall
	DelFirewall(StorageFactory) error

	// NewNetwork create Network
	NewNetwork(StorageFactory) error

	// DelNetwork delete Network
	DelNetwork(StorageFactory) error

	// InitState is used to initalize the state of that partular cloud provider
	// its internal state and cloud provider's client
	// NOTE: multiple mode of OPERATIONS
	InitState(StorageFactory, consts.KsctlOperation) error

	// CreateUploadSSHKeyPair create SSH keypair in the host machine and then upload pub key
	// and store the path of private key, username, etc.. wrt to specific cloud provider
	CreateUploadSSHKeyPair(StorageFactory) error

	// DelSSHKeyPair delete SSH keypair from the Cloud provider
	DelSSHKeyPair(StorageFactory) error

	// GetStateForHACluster used to get the state info for transfer it to kubernetes distro
	// for further configurations
	GetStateForHACluster(StorageFactory) (cloud.CloudResourceState, error)

	// NewManagedCluster creates managed kubernetes from cloud offering
	// it requires the no of nodes to be created
	NewManagedCluster(StorageFactory, int) error

	// DelManagedCluster deletes managed kubernetes from cloud offering
	DelManagedCluster(StorageFactory) error

	// Name sets the name for the resource you want to operate
	Name(string) CloudFactory

	// Role specify what is its role. Ex. Controlplane or WorkerPlane or DataStore...
	Role(consts.KsctlRole) CloudFactory

	// VMType specifiy what is the VirtualMachine size to be used
	VMType(string) CloudFactory

	// Visibility whether to make the VM public or private
	Visibility(bool) CloudFactory

	// Application for the comma seperated apps names (Managed cluster)
	Application(string) bool

	// CNI for the CNI name (Managed cluster)
	CNI(string) (willBeInstalled bool)

	// Version for the Kubernetes Version (Managed cluster)
	Version(string) CloudFactory

	// NoOfWorkerPlane if setter is enabled it writes the new no of workerplane to be used
	// if getter is enabled it returns the current no of workerplane
	// its imp function for (shrinking, scaling)
	NoOfWorkerPlane(StorageFactory, int, bool) (int, error)

	// NoOfControlPlane Getter and setter
	// setter to store no of controlplane nodes
	// NOTE: it is meant to be used only for first time
	// it has no functionalit as (shrinking, scaling) if tried it will erase existing data
	NoOfControlPlane(int, bool) (int, error)

	// NoOfDataStore Getter and setter
	// setter to store no of datastore nodes
	// NOTE: it is meant to be used only for first time
	// it has no functionalit as (shrinking, scaling) if tried it will erase existing data
	NoOfDataStore(int, bool) (int, error)

	// GetHostNameAllWorkerNode it returns all the hostnames of workerplane nodes
	// it's used for the universal kubernetes for deletion of nodes which have to scale down
	GetHostNameAllWorkerNode() []string

	IsPresent(StorageFactory) error

	GetSecretTokens(StorageFactory) (map[string][]byte, error)
}

type KsctlClient

type KsctlClient struct {
	Cloud CloudFactory

	PreBootstrap PreKubernetesBootstrap

	Bootstrap KubernetesBootstrap

	Storage StorageFactory

	Metadata Metadata
}

type KubernetesBootstrap added in v1.1.4

type KubernetesBootstrap interface {
	Setup(storage StorageFactory, operation consts.KsctlOperation) error

	ConfigureControlPlane(int, StorageFactory) error

	JoinWorkerplane(int, StorageFactory) error

	Version(string) KubernetesBootstrap

	CNI(string) (externalCNI bool)
}

type LoggerFactory

type LoggerFactory interface {
	Print(msg string, v ...any)

	Success(msg string, v ...any)

	Note(msg string, v ...any)

	Warn(msg string, v ...any)

	Error(msg string, v ...any)

	Debug(msg string, v ...any)

	SetPackageName(name string)

	NewError(format string, v ...any) error

	Table(data []cloudController.AllClusterData)

	Box(title string, lines string)
}

type Metadata

type Metadata struct {
	ClusterName string `json:"cluster_name"`
	Region      string `json:"region"`

	Provider      consts.KsctlCloud      `json:"cloud_provider"`
	K8sDistro     consts.KsctlKubernetes `json:"kubernetes_distro"`
	StateLocation consts.KsctlStore      `json:"storage_type"`

	IsHA bool `json:"ha_cluster"`

	K8sVersion string `json:"kubernetes_version"`

	ManagedNodeType      string `json:"node_type_managed"`
	WorkerPlaneNodeType  string `json:"node_type_workerplane"`
	ControlPlaneNodeType string `json:"node_type_controlplane"`
	DataStoreNodeType    string `json:"node_type_datastore"`
	LoadBalancerNodeType string `json:"node_type_loadbalancer"`

	NoMP int `json:"desired_no_of_managed_nodes"`      // No of managed Nodes
	NoWP int `json:"desired_no_of_workerplane_nodes"`  // No of woerkplane VMs
	NoCP int `json:"desired_no_of_controlplane_nodes"` // No of Controlplane VMs
	NoDS int `json:"desired_no_of_datastore_nodes"`    // No of DataStore VMs

	Applications string `json:"preinstalled_apps"`
	CNIPlugin    string `json:"cni_plugin"`

	LogVerbosity int       `json:"log_verbosity"`
	LogWritter   io.Writer `json:"log_writter"`
}

type PreKubernetesBootstrap added in v1.1.4

type PreKubernetesBootstrap interface {
	Setup(cloud.CloudResourceState, StorageFactory, consts.KsctlOperation) error

	ConfigureDataStore(int, StorageFactory) error

	ConfigureLoadbalancer(StorageFactory) error
}

type Script added in v1.1.4

type Script struct {
	Name           string
	ShellScript    string
	CanRetry       bool
	MaxRetries     uint8
	ScriptExecutor consts.KsctlSupportedScriptRunners
}

type ScriptCollection added in v1.1.4

type ScriptCollection interface {
	NextScript() *Script
	String() string
	Append(Script)
	IsCompleted() bool
}

type StorageFactory

type StorageFactory interface {
	// Kill to achieve graceful termination we can store a boolean flag in the
	// storagedriver that whether there was any write operation if yes and a reference
	//always present in the storagedriver we can make the driver write the struct once termination is triggered
	Kill() error

	// Connect TODO: transfer the Logverbosity and LogWriter and all other stuff
	Connect(ctx context.Context) error

	Setup(cloud consts.KsctlCloud, region, clusterName string, clusterType consts.KsctlClusterType) error

	Write(*types.StorageDocument) error

	WriteCredentials(consts.KsctlCloud, *types.CredentialsDocument) error

	Read() (*types.StorageDocument, error)

	ReadCredentials(consts.KsctlCloud) (*types.CredentialsDocument, error)

	DeleteCluster() error

	AlreadyCreated(cloud consts.KsctlCloud, region, clusterName string, clusterType consts.KsctlClusterType) error

	GetOneOrMoreClusters(filters map[string]string) (map[consts.KsctlClusterType][]*types.StorageDocument, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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