cluster

package
v0.5.2-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

This file is copied from https://github.com/rancher/wharfie/blob/v0.5.1/pkg/registries/types.go because we don't want all the dependencies from wharfie project.

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 AuthConfig added in v0.5.2

type AuthConfig struct {
	// Username is the username to login the registry.
	Username string `toml:"username" yaml:"username"`
	// Password is the password to login the registry.
	Password string `toml:"password" yaml:"password"`
	// Auth is a base64 encoded string from the concatenation of the username,
	// a colon, and the password.
	Auth string `toml:"auth" yaml:"auth"`
	// IdentityToken is used to authenticate the user and get
	// an access token for the registry.
	IdentityToken string `toml:"identitytoken" yaml:"identity_token"`
}

AuthConfig contains the config related to authentication to a specific registry

type Mirror added in v0.5.2

type Mirror struct {
	// Endpoints are endpoints for a namespace. CRI plugin will try the endpoints
	// one by one until a working one is found. The endpoint must be a valid url
	// with host specified.
	// The scheme, host and path from the endpoint URL will be used.
	Endpoints []string `toml:"endpoint" yaml:"endpoint"`

	// Rewrites are repository rewrite rules for a namespace. When fetching image resources
	// from an endpoint and a key matches the repository via regular expression matching
	// it will be replaced with the corresponding value from the map in the resource request.
	Rewrites map[string]string `toml:"rewrite" yaml:"rewrite"`
}

Mirror contains the config related to the registry mirror

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
	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) 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{}, deployPlugins func() []string,
	cloudInstanceFunc func(ssh *types.SSH) (*types.Cluster, error), customInstallK3s func() (string, string, error), rollbackInstance func(ids []string) error) error

InitCluster init K3S cluster.

func (*ProviderBase) InitK3sCluster added in v0.4.2

func (p *ProviderBase) InitK3sCluster(cluster *types.Cluster) 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) 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 string) error

type Registry added in v0.5.2

type Registry struct {
	// Mirrors are namespace to mirror mapping for all namespaces.
	Mirrors map[string]Mirror `toml:"mirrors" yaml:"mirrors"`
	// Configs are configs for each registry.
	// The key is the FDQN or IP of the registry.
	Configs map[string]RegistryConfig `toml:"configs" yaml:"configs"`

	// Auths are registry endpoint to auth config mapping. The registry endpoint must
	// be a valid url with host specified.
	// DEPRECATED: Use Configs instead. Remove in containerd 1.4.
	Auths map[string]AuthConfig `toml:"auths" yaml:"auths"`
}

Registry is registry settings including mirrors, TLS, and credentials

type RegistryConfig added in v0.5.2

type RegistryConfig struct {
	// Auth contains information to authenticate to the registry.
	Auth *AuthConfig `toml:"auth" yaml:"auth"`
	// TLS is a pair of CA/Cert/Key which then are used when creating the transport
	// that communicates with the registry.
	TLS *TLSConfig `toml:"tls" yaml:"tls"`
}

RegistryConfig contains configuration used to communicate with the registry.

type TLSConfig added in v0.5.2

type TLSConfig struct {
	CAFile             string `toml:"ca_file" yaml:"ca_file"`
	CertFile           string `toml:"cert_file" yaml:"cert_file"`
	KeyFile            string `toml:"key_file" yaml:"key_file"`
	InsecureSkipVerify bool   `toml:"insecure_skip_verify" yaml:"insecure_skip_verify"`
}

TLSConfig contains the CA/Cert/Key used for a registry

Jump to

Keyboard shortcuts

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