cluster

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeClusterNodes added in v0.3.0

func DescribeClusterNodes(client *kubernetes.Clientset, instanceNodes []types.ClusterNode) ([]types.ClusterNode, error)

DescribeClusterNodes describe cluster nodes.

func GetClusterConfig added in v0.3.0

func GetClusterConfig(name, kubeconfig string) (*kubernetes.Clientset, error)

GetClusterConfig generate kube config.

func GetClusterStatus added in v0.3.0

func GetClusterStatus(c *kubernetes.Clientset) string

GetClusterStatus get cluster status using cluster's /readyz API.

func GetClusterVersion added in v0.3.0

func GetClusterVersion(c *kubernetes.Clientset) string

GetClusterVersion get kube cluster version.

func ListClusters added in v0.4.0

func ListClusters(providerName string) ([]*types.ClusterInfo, error)

ListClusters list clusters.

func SSHK3sNode

func SSHK3sNode(ip string, cluster *types.Cluster, ssh *types.SSH) error

SSHK3sNode ssh to K3S node.

func SaveCfg

func SaveCfg(cfg, ip, context string) error

SaveCfg save kube config file.

Types

type ProviderBase added in v0.4.0

type ProviderBase struct {
	types.Metadata `json:",inline"`
	types.Status   `json:"status"`
	types.SSH      `json:",inline"`
	M              *sync.Map
	ErrM           map[string]string
	Logger         *logrus.Logger
	Callbacks      map[string]*providerProcess
}

ProviderBase provider base struct.

func NewBaseProvider added in v0.4.0

func NewBaseProvider() *ProviderBase

NewBaseProvider new base provider.

func (*ProviderBase) CheckCreateArgs added in v0.7.0

func (p *ProviderBase) CheckCreateArgs(checkClusterExist func() (bool, []string, error)) error

func (*ProviderBase) CheckJoinArgs added in v0.7.0

func (p *ProviderBase) CheckJoinArgs(checkClusterExist func() (bool, []string, error)) error

func (*ProviderBase) Connect added in v0.4.0

func (p *ProviderBase) Connect(ip string, ssh *types.SSH, c *types.Cluster, getStatus func() ([]types.Node, error),
	isRunning func(status string) bool, customConnect func(id string, cluster *types.Cluster) error) error

Connect ssh & connect to the K3S node.

func (*ProviderBase) DeleteCluster added in v0.4.0

func (p *ProviderBase) DeleteCluster(force bool, delete func(f bool) (string, error)) error

DeleteCluster delete cluster.

func (*ProviderBase) DeployExtraManifest added in v0.4.2

func (p *ProviderBase) DeployExtraManifest(cluster *types.Cluster, cmds []string) error

DeployExtraManifest deploy extra K3S manifest.

func (*ProviderBase) Describe added in v0.4.0

func (p *ProviderBase) Describe(kubeCfg string, c *types.ClusterInfo, describeInstance func() ([]types.Node, error)) *types.ClusterInfo

Describe describe cluster info.

func (*ProviderBase) GetClusterOptions added in v0.4.0

func (p *ProviderBase) GetClusterOptions() []types.Flag

GetClusterOptions get cluster flag options.

func (*ProviderBase) GetClusterStatus added in v0.4.0

func (p *ProviderBase) GetClusterStatus(kubeCfg string, c *types.ClusterInfo, describeFunc func() ([]types.Node, error)) *types.ClusterInfo

GetClusterStatus get cluster status.

func (*ProviderBase) GetCommonConfig added in v0.4.0

func (p *ProviderBase) GetCommonConfig(sshFunc func() *types.SSH) (map[string]schemas.Field, error)

GetCommonConfig get common config.

func (*ProviderBase) GetCreateOptions added in v0.4.0

func (p *ProviderBase) GetCreateOptions() []types.Flag

GetCreateOptions get create command flag options.

func (*ProviderBase) GetCustomManifests added in v0.4.4

func (p *ProviderBase) GetCustomManifests() ([]string, error)

GetCustomManifests get custom manifests.

func (*ProviderBase) GetSSHOptions added in v0.4.0

func (p *ProviderBase) GetSSHOptions() []types.Flag

GetSSHOptions get ssh flag options.

func (*ProviderBase) InitCluster added in v0.4.0

func (p *ProviderBase) InitCluster(options interface{}, deployCCM func() []string,
	cloudInstanceFunc func(ssh *types.SSH) (*types.Cluster, error), customInstallK3s func() (string, string, error), rollbackInstance func(ids []string) error) (er error)

InitCluster init K3S cluster.

func (*ProviderBase) InitK3sCluster added in v0.4.2

func (p *ProviderBase) InitK3sCluster(cluster *types.Cluster, deployCCM func() []string) error

InitK3sCluster initial K3S cluster.

func (*ProviderBase) Join added in v0.4.2

func (p *ProviderBase) Join(merged, added *types.Cluster) error

Join join K3S nodes to exist K3S cluster.

func (*ProviderBase) JoinNodes added in v0.4.0

func (p *ProviderBase) JoinNodes(cloudInstanceFunc func(ssh *types.SSH) (*types.Cluster, error),
	syncExistInstance func() error, isAutoJoined bool, rollbackInstance func(ids []string) error) (er error)

JoinNodes join K3S nodes. nolint: gocyclo

func (*ProviderBase) MergeConfig added in v0.4.0

func (p *ProviderBase) MergeConfig() ([]byte, error)

MergeConfig merge cluster config.

func (*ProviderBase) RegisterCallbacks added in v0.4.3

func (p *ProviderBase) RegisterCallbacks(name, event string, fn func(interface{}))

RegisterCallbacks register callbacks.

func (*ProviderBase) ReleaseManifests added in v0.4.2

func (p *ProviderBase) ReleaseManifests() error

ReleaseManifests release manifests.

func (*ProviderBase) RollbackCluster added in v0.4.2

func (p *ProviderBase) RollbackCluster(rollbackInstance func(ids []string) error) error

RollbackCluster rollback when error occur.

func (*ProviderBase) SaveCredential added in v0.4.0

func (p *ProviderBase) SaveCredential(secrets map[string]string) error

SaveCredential save credential to database.

func (*ProviderBase) SetClusterConfig added in v0.4.0

func (p *ProviderBase) SetClusterConfig(config []byte) (*types.Cluster, error)

SetClusterConfig set cluster config.

func (*ProviderBase) SetMetadata added in v0.4.0

func (p *ProviderBase) SetMetadata(config *types.Metadata)

SetMetadata set metadata.

func (*ProviderBase) UninstallK3sNodes added in v0.4.2

func (p *ProviderBase) UninstallK3sNodes(nodes []types.Node) (warnMsg []string)

UninstallK3sNodes uninstall K3S on the given nodes.

func (*ProviderBase) Upgrade added in v0.5.0

func (p *ProviderBase) Upgrade(cluster *types.Cluster) error

func (*ProviderBase) UpgradeK3sCluster added in v0.5.0

func (p *ProviderBase) UpgradeK3sCluster(clusterName, installScript, channel, version, packageName, packagePath string) error

func (*ProviderBase) ValidateRequireSSHPrivateKey added in v0.8.0

func (p *ProviderBase) ValidateRequireSSHPrivateKey() error

Jump to

Keyboard shortcuts

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