embeddedcluster

package
v1.104.5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_CONTROLLER_ROLE_NAME = "controller"

Variables

This section is empty.

Functions

func ClusterConfig added in v1.104.2

func ClusterConfig(ctx context.Context) (*embeddedclusterv1beta1.ConfigSpec, error)

ClusterConfig will extract the current cluster configuration from the latest installation object found in the cluster.

func ClusterID

func ClusterID(client kubernetes.Interface) (string, error)

func ControllerRoleName added in v1.104.2

func ControllerRoleName(ctx context.Context) (string, error)

ControllerRoleName determines the name for the 'controller' role this might be part of the config, or it might be the default

func DeleteNode

func DeleteNode(ctx context.Context, client kubernetes.Interface, restconfig *rest.Config, node *corev1.Node) error

func DrainNode

func DrainNode(ctx context.Context, client kubernetes.Interface, node *corev1.Node) error

func GenerateAddNodeCommand

func GenerateAddNodeCommand(ctx context.Context, client kubernetes.Interface, token string) (string, error)

GenerateAddNodeCommand returns the command a user should run to add a node with the provided token the command will be of the form 'embeddedcluster node join ip:port UUID'

func GenerateAddNodeToken

func GenerateAddNodeToken(ctx context.Context, client kubernetes.Interface, nodeRole string) (string, error)

GenerateAddNodeToken will generate the embedded cluster node add command for a node with the specified roles join commands will last for 24 hours, and will be cached for 1 hour after first generation

func GenerateK0sJoinCommand

func GenerateK0sJoinCommand(ctx context.Context, client kubernetes.Interface, roles []string) (string, error)

GenerateK0sJoinCommand returns the k0s node join command, without the token but with all other required flags (including node labels generated from the roles etc)

func GetCurrentInstallation added in v1.104.5

func GetCurrentInstallation(ctx context.Context) (*embeddedclusterv1beta1.Installation, error)

GetCurrentInstallation returns the most recent installation object from the cluster.

func GetNode

func GetNode(ctx context.Context, client kubernetes.Interface, nodeName string) (*types.Node, error)

GetNode will get a node with stats and podlist

func GetNodes

GetNodes will get a list of nodes with stats

func GetRoles added in v1.104.2

func GetRoles(ctx context.Context) ([]string, error)

GetRoles will get a list of role names

func InitClusterState added in v1.104.5

func InitClusterState(ctx context.Context, client kubernetes.Interface, store store.Store) error

InitClusterState initializes the cluster state in the database. This should be called when the server launches.

func IsEmbeddedCluster

func IsEmbeddedCluster(clientset kubernetes.Interface) (bool, error)

func IsHA

func IsHA(clientset kubernetes.Interface) (bool, error)

func MaybeStartClusterUpgrade added in v1.104.5

func MaybeStartClusterUpgrade(ctx context.Context, client kubernetes.Interface, store store.Store, conf *v1beta1.Config) error

MaybeStartClusterUpgrade checks if the embedded cluster is in a state that requires an upgrade. If so, it starts the upgrade process. We only start an upgrade if the following conditions are met: - The app has an embedded cluster configuration. - The app embedded cluster configuration differs from the current embedded cluster config.

func ReadConfigMap

func ReadConfigMap(client kubernetes.Interface) (*corev1.ConfigMap, error)

ReadConfigMap will read the Kurl config from a configmap

func RequiresUpgrade added in v1.104.5

func RequiresUpgrade(ctx context.Context, newcfg embeddedclusterv1beta1.ConfigSpec) (bool, error)

RequiresUpgrade returns true if the provided configuration differs from the latest active configuration.

func SortRoles added in v1.104.2

func SortRoles(controllerRole string, inputRoles []string) []string

sort roles by name, but put controller first

func SyncExec

func SyncExec(coreClient corev1client.CoreV1Interface, clientConfig *rest.Config, ns, pod, container string, command ...string) (int, string, string, error)

SyncExec returns exitcode, stdout, stderr. A non-zero exit code from the command is not considered an error.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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