node

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// K3dClusterNameLabel is the label that holds cluster name in k3d node.
	K3dClusterNameLabel = "k3d.cluster"
)

Variables

This section is empty.

Functions

func FilteredNodes

func FilteredNodes(ctx context.Context, runtime runtimes.Runtime, nodes []string) ([]*K3D.Node, error)

FilteredNodes fetches details of specified list of nodes.

Types

type Config

type Config struct {
	Name                 []string               `json:"name,omitempty" mapstructure:"name"`
	Role                 string                 `json:"role,omitempty" mapstructure:"role"`
	ClusterAssociated    string                 `json:"cluster,omitempty" mapstructure:"cluster"`
	State                string                 `json:"state,omitempty" mapstructure:"state"`
	Created              string                 `json:"created,omitempty" mapstructure:"created"`
	Memory               string                 `json:"memory,omitempty" mapstructure:"memory"`
	Volumes              []string               `json:"volumes,omitempty" mapstructure:"volumes"`
	Networks             []string               `json:"networks,omitempty" mapstructure:"networks"`
	EnvironmentVariables []string               `json:"env,omitempty" mapstructure:"env"`
	Count                int                    `json:"count,omitempty" mapstructure:"count"`
	Image                string                 `json:"image,omitempty" mapstructure:"image"`
	PortMapping          map[string]interface{} `json:"port_mappings,omitempty" mapstructure:"port_mappings"`
	Timeout              time.Duration          `json:"timeout,omitempty" mapstructure:"timeout"`
	Wait                 bool                   `json:"wait,omitempty" mapstructure:"wait"`
	All                  bool                   `json:"all,omitempty" mapstructure:"all"`
	Labels               map[string]string      `json:"labels,omitempty" mapstructure:"labels"`
	Action               string                 `json:"action,omitempty" mapstructure:"action"`
}

Config stores filtered node data of k3d cluster.

func (*Config) CreateNodeWithTimeout

func (cfg *Config) CreateNodeWithTimeout(ctx context.Context, runtime runtimes.Runtime, nodes []*Config) error

CreateNodeWithTimeout creates node by setting timeouts as per input.

func (*Config) CreateNodes

func (cfg *Config) CreateNodes(ctx context.Context, runtime runtimes.Runtime, startFrom int) error

CreateNodes creates number nodes specified in 'replicas', making this startFrom if in case we support update nodes on it.

func (*Config) DeleteNodesFromCluster

func (cfg *Config) DeleteNodesFromCluster(ctx context.Context, runtime runtimes.Runtime) error

DeleteNodesFromCluster deletes the specified node.

func (*Config) GetFilteredNodes

func (cfg *Config) GetFilteredNodes(ctx context.Context, runtime runtimes.Runtime) ([]*Config, error)

GetFilteredNodes returns the fetched list of specified nodes from specified cluster with list of *Config type.

func (*Config) GetFilteredNodesFromCluster

func (cfg *Config) GetFilteredNodesFromCluster(ctx context.Context, runtime runtimes.Runtime) ([]*Config, error)

GetFilteredNodesFromCluster returns the fetched all nodes from a specified cluster with list of *Config type.

func (*Config) GetNodeFromConfig

func (cfg *Config) GetNodeFromConfig() *K3D.Node

GetNodeFromConfig returns K3D.Node equivalent for an stance of Config.

func (*Config) GetNodeStatus

func (cfg *Config) GetNodeStatus(ctx context.Context, runtime runtimes.Runtime) ([]*Status, error)

GetNodeStatus retrieves the latest state of the nodes.

func (*Config) GetNodesByLabels

func (cfg *Config) GetNodesByLabels(ctx context.Context, runtime runtimes.Runtime) ([]*Config, error)

GetNodesByLabels gets the nodes that matches with the specified label.

func (*Config) StartStopNode

func (cfg *Config) StartStopNode(ctx context.Context, runtime runtimes.Runtime) error

type K3DNode

type K3DNode interface {
	CreateNodeWithTimeout(context.Context, runtimes.Runtime, []*Config) error
	CreateNodes(context.Context, runtimes.Runtime, int) error
	DeleteNodesFromCluster(context.Context, runtimes.Runtime) error
	GetFilteredNodesFromCluster(context.Context, runtimes.Runtime) ([]*Config, error)
	GetFilteredNodes(context.Context, runtimes.Runtime) ([]*Config, error)
	GetNodesByLabels(context.Context, runtimes.Runtime) ([]*Config, error)
	GetNodeStatus(context.Context, runtimes.Runtime) ([]*Status, error)
	GetNodeFromConfig() *K3D.Node
	StartStopNode(context.Context, runtimes.Runtime) error
}

type Status

type Status struct {
	Node    string `json:"node,omitempty"`
	Cluster string `json:"cluster,omitempty"`
	Role    string `json:"role,omitempty"`
	State   string `json:"state,omitempty"`
	Running bool   `json:"running,omitempty"`
}

Status helps to store filtered node status of k3d cluster.

Jump to

Keyboard shortcuts

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