providers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProvider

func RegisterProvider(name string, p Factory)

RegisterProvider registers a provider.Factory by name.

Types

type Factory

type Factory func() (Provider, error)

Factory is a function that returns a Provider.Interface.

type Provider

type Provider interface {
	GetProviderName() string
	// Create command flags.
	GetCreateFlags(cmd *cobra.Command) *pflag.FlagSet
	// Join command flags.
	GetJoinFlags(cmd *cobra.Command) *pflag.FlagSet
	// Stop command flags.
	GetStopFlags(cmd *cobra.Command) *pflag.FlagSet
	// Start command flags.
	GetStartFlags(cmd *cobra.Command) *pflag.FlagSet
	// Delete command flags.
	GetDeleteFlags(cmd *cobra.Command) *pflag.FlagSet
	// SSH command flags.
	GetSSHFlags(cmd *cobra.Command) *pflag.FlagSet
	// Credential flags.
	GetCredentialFlags(cmd *cobra.Command) *pflag.FlagSet
	// Use this method to bind Viper, although it is somewhat repetitive.
	BindCredentialFlags() *pflag.FlagSet
	// Generate cluster name.
	GenerateClusterName()
	// Generate create/join extra args for master nodes
	GenerateMasterExtraArgs(cluster *types.Cluster, master types.Node) string
	// Generate create/join extra args for worker nodes
	GenerateWorkerExtraArgs(cluster *types.Cluster, worker types.Node) string
	// K3s create cluster interface.
	CreateK3sCluster(ssh *types.SSH) error
	// K3s join node interface.
	JoinK3sNode(ssh *types.SSH) error
	// K3s delete cluster interface.
	DeleteK3sCluster(f bool) error
	// K3s start cluster interface.
	StartK3sCluster() error
	// K3s stop cluster interface.
	StopK3sCluster(f bool) error
	// K3s ssh node interface.
	SSHK3sNode(ssh *types.SSH) error
	// K3s check cluster exist.
	IsClusterExist() (bool, []string, error)
	// Rollback when error occurs.
	Rollback() error
}

Provider is an abstract, pluggable interface for k3s provider

func GetProvider

func GetProvider(name string) (Provider, error)

GetProvider creates an instance of the named provider, or nil if the name is unknown. The error return is only used if the named provider was known but failed to initialize.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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