Documentation ¶
Index ¶
- func DescribeClusterNodes(client *kubernetes.Clientset, instanceNodes []types.ClusterNode) ([]types.ClusterNode, error)
- func GetClusterConfig(name, kubeconfig string) (*kubernetes.Clientset, error)
- func GetClusterStatus(c *kubernetes.Clientset) string
- func GetClusterVersion(c *kubernetes.Clientset) string
- func ListClusters(providerName string) ([]*types.ClusterInfo, error)
- func SSHK3sNode(ip string, cluster *types.Cluster, ssh *types.SSH) error
- func SaveCfg(cfg, ip, context string) error
- type ProviderBase
- func (p *ProviderBase) CheckCreateArgs(checkClusterExist func() (bool, []string, error)) error
- func (p *ProviderBase) CheckJoinArgs(checkClusterExist func() (bool, []string, error)) error
- func (p *ProviderBase) Connect(ip string, ssh *types.SSH, c *types.Cluster, ...) error
- func (p *ProviderBase) DeleteCluster(force bool, delete func(f bool) (string, error)) error
- func (p *ProviderBase) DeployExtraManifest(cluster *types.Cluster, cmds []string) error
- func (p *ProviderBase) Describe(kubeCfg string, c *types.ClusterInfo, ...) *types.ClusterInfo
- func (p *ProviderBase) GetClusterOptions() []types.Flag
- func (p *ProviderBase) GetClusterStatus(kubeCfg string, c *types.ClusterInfo, ...) *types.ClusterInfo
- func (p *ProviderBase) GetCommonConfig(sshFunc func() *types.SSH) (map[string]schemas.Field, error)
- func (p *ProviderBase) GetCreateOptions() []types.Flag
- func (p *ProviderBase) GetCustomManifests() ([]string, error)
- func (p *ProviderBase) GetSSHOptions() []types.Flag
- func (p *ProviderBase) InitCluster(options interface{}, deployCCM func() []string, ...) (er error)
- func (p *ProviderBase) InitK3sCluster(cluster *types.Cluster, deployCCM func() []string) error
- func (p *ProviderBase) Join(merged, added *types.Cluster) error
- func (p *ProviderBase) JoinNodes(cloudInstanceFunc func(ssh *types.SSH) (*types.Cluster, error), ...) (er error)
- func (p *ProviderBase) MergeConfig() ([]byte, error)
- func (p *ProviderBase) RegisterCallbacks(name, event string, fn func(interface{}))
- func (p *ProviderBase) ReleaseManifests() error
- func (p *ProviderBase) RollbackCluster(rollbackInstance func(ids []string) error) error
- func (p *ProviderBase) SaveCredential(secrets map[string]string) error
- func (p *ProviderBase) SetClusterConfig(config []byte) (*types.Cluster, error)
- func (p *ProviderBase) SetMetadata(config *types.Metadata)
- func (p *ProviderBase) UninstallK3sNodes(nodes []types.Node) (warnMsg []string)
- func (p *ProviderBase) Upgrade(cluster *types.Cluster) error
- func (p *ProviderBase) UpgradeK3sCluster(clusterName, installScript, channel, version, packageName, packagePath string) error
- func (p *ProviderBase) ValidateRequireSSHPrivateKey() error
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 ¶
SSHK3sNode ssh to K3S node.
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
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
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