nodepools

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSSHPort is the standard SSH port used by existing/legacy nodepools.
	DefaultSSHPort = int32(22)
)

Variables

This section is empty.

Functions

func All added in v0.10.0

func All(nodepools []*spec.NodePool) iter.Seq[*spec.NodePool]

func AppendDynamicNodes added in v0.10.0

func AppendDynamicNodes(dst *spec.NodePool, nodes []*spec.Node)

Adds the passed in `nodes` into `dst` by also correctly increasing the count of the nodes within the nodepool. The nodes are not cloned but simply shallow copied into the nodepool. If the nodepool is not dynamic this is a noop function.

func Autoscaled added in v0.10.0

func Autoscaled(nodepools []*spec.NodePool) []*spec.NodePool

Autoscaled returns all autoscaled nodepools.

func ByProviderDynamic added in v0.9.3

func ByProviderDynamic(nps []*spec.NodePool) iter.Seq2[ProviderTemplateGroup, []*spec.NodePool]

ByProviderDynamic returns an iterator that groups dynamic nodepools only by provider.

func ByProviderRegion

func ByProviderRegion(nodepools []*spec.NodePool) iter.Seq2[string, []*spec.NodePool]

ByProviderRegion returns an iterator that groups nodepools by provider region.

func ByProviderSpecName

func ByProviderSpecName(nodepools []*spec.NodePool) iter.Seq2[string, []*spec.NodePool]

ByProviderSpecName returns an iterator that groups nodepools by provider SpecName.

func ByTemplatesPath added in v0.10.0

func ByTemplatesPath(nps []*spec.NodePool) iter.Seq2[string, []*spec.NodePool]

ByTemplates returns an iterator that groups nodepools by provider templates path.

func CloneTargetNodes added in v0.10.0

func CloneTargetNodes(n *spec.NodePool, nodes []string) []*spec.Node

Clones all of the nodes from spec.NodePool which have a matching name in the passed in nodes slice.

func Compute added in v0.10.0

func Compute(nodepools []*spec.NodePool) iter.Seq[*spec.NodePool]

func ContainsNode added in v0.10.0

func ContainsNode(nodepools []*spec.NodePool, nodeName string) bool

Returns true if the node is within one of the provided nodepools.

func Control

func Control(nodepools []*spec.NodePool) iter.Seq[*spec.NodePool]

func CopyNodes added in v0.10.0

func CopyNodes(dst, src *spec.NodePool, nodes []string)

Copies the nodes from `src` into `dst` cloning the invidivual nodes, such that they do not keep any pointers or shared memory with the original. The type of the nodepool of the `src` and `dst` must be the same, otherwise no copying is done.

The affected src [NodePool] is modified with adjusted counts from the newly copied over nodes.

func DeleteByName added in v0.9.7

func DeleteByName(nodepools []*spec.NodePool, name string) []*spec.NodePool

func DeleteNodeByName added in v0.9.7

func DeleteNodeByName(
	nodepools []*spec.NodePool,
	nodeName string,
	keepNodePools map[string]struct{},
) []*spec.NodePool

DeleteNodeByName goes through each nodepool until it finds the node with the specified name. If the nodepool reaches 0 nodes the keepNodePools map is checked whether the nodepool should be removed or not.

func DeleteNodes added in v0.10.0

func DeleteNodes(nodepool *spec.NodePool, nodes []string)

Deletes any matching `nodes` in the passed in `nodepool` If the passed in `nodes` contain all of the nodes of the `nodepool` then the nodepool will be modified to contain no nodes at all.

func Dynamic

func Dynamic(nodepools []*spec.NodePool) []*spec.NodePool

Dynamic returns every dynamic nodepool.

func DynamicGenerateKeys

func DynamicGenerateKeys(nodepools []*spec.NodePool, outputDir string) error

DynamicGenerateKeys creates private keys files for all nodes in the provided dynamic node pools in form of <node name>.pem.

func ExtractDynamic

func ExtractDynamic(nodepools []*spec.NodePool) []*spec.DynamicNodePool

ExtractDynamic returns slice of dynamic node pools.

func ExtractRegions

func ExtractRegions(nodepools []*spec.DynamicNodePool) []string

ExtractRegions will return a list of all regions used in list of nodepools

func FindApiEndpoint

func FindApiEndpoint(nodepools []*spec.NodePool) (*spec.NodePool, *spec.Node)

FindApiEndpoint searches for a nodepool that has the control node representing the Api endpoint of the cluster.

func FindByName

func FindByName(nodePoolName string, nodePools []*spec.NodePool) *spec.NodePool

FindByName returns the first Nodepool that will have same name as specified in parameters, nil otherwise.

func FindNode added in v0.9.7

func FindNode(nodepools []*spec.NodePool, nodeName string) (nodepool *spec.NodePool, node *spec.Node)

func FindReferences added in v0.10.0

func FindReferences(name string, nodePools []*spec.NodePool) []*spec.NodePool

FindReferences return all nodepools that share the given name.

func FirstControlNode

func FirstControlNode(nodepools []*spec.NodePool) *spec.Node

FirstControlNode returns the first control node encountered.

func HasNodePoolTypeOf added in v0.10.0

func HasNodePoolTypeOf(nodepoolType, nodepoolName string) bool

func IndexByName added in v0.10.0

func IndexByName(nodePoolName string, nodepools []*spec.NodePool) int

IndexByName returns the position of the nodepool within the slice, if not found -1 is returned.

func IsAutoscaled added in v0.10.0

func IsAutoscaled(np *spec.NodePool) bool

Returns true if the nodepool is autoscaled.

func MatchNameAndHashWithTemplate

func MatchNameAndHashWithTemplate(nodepoolType, nodepoolName string) (t, h string)

func MustExtractNameAndHash

func MustExtractNameAndHash(pool string) (name, hash string)

func NodeCount added in v0.10.0

func NodeCount(nodepools []*spec.NodePool) int

func PartialCopyWithNodeExclusion added in v0.10.0

func PartialCopyWithNodeExclusion(np *spec.NodePool, nodes []string) *spec.NodePool

Behaves exactly the same as PartialCopyWithNodeFilter just that the passed in nodes are excluded from ones in the nodepool if present.

func PartialCopyWithNodeFilter added in v0.10.0

func PartialCopyWithNodeFilter(np *spec.NodePool, nodes []string) *spec.NodePool

For each node in the nodepool that is found inside the passed in nodes slice, returns a shallow copy of the nodepool, meaning that all of the memory is still shared among the original and returned nodepool, but will only have the filtered nodes.

**Caution** the Node Type itself is deep cloned as the node counts need to change to reflect the filered nodes.

func PartialCopyWithReplacedNodes added in v0.10.0

func PartialCopyWithReplacedNodes(np *spec.NodePool, nodes []*spec.Node, nodeKeys map[string]string) *spec.NodePool

All of the nodes in the nodepool are replaced with the passed in nodes slice. The function will create a shallow copy of the nodepool, meaning that all of the memory is still shared among the original and returned nodepool, but will only have the replaced nodes. If the nodes are static nodes it is expected that the passed in nodeKeys map will be filled with the required data.

**Caution** the node Type itself is deep cloned as the node counts need to change to reflect the filtered nodes.

func PublicEndpoints added in v0.10.0

func PublicEndpoints(nodepools []*spec.NodePool) []string

Returns all Public Endpoints, for all of the nodes for the passed in nodepools.

func RandomDynamicNode added in v0.10.0

func RandomDynamicNode(nodepools iter.Seq[*spec.NodePool]) *spec.Node

Returns a random dynamic node. Nil if there is none.

func RandomNodePublicEndpoint added in v0.10.0

func RandomNodePublicEndpoint(nps []*spec.NodePool) (username, endpoint, key, sshPort string)

Returns a random node public Endpoint, SSH key, and SSH port to connect to it. Empty strings if there is none.

func SSHPort added in v0.11.2

func SSHPort(np *spec.NodePool) int32

SSHPort returns the effective SSH port for a nodepool and normalizes the stored value in-place, replacing 0 with DefaultSSHPort.

func Static

func Static(nodepools []*spec.NodePool) []*spec.NodePool

Static returns every static nodepool.

func StaticGenerateKeys

func StaticGenerateKeys(nodepools []*spec.NodePool, outputDir string) error

StaticGenerateKeys creates private keys files for all nodes in the provided static node pools in form of <node name>.pem.

Types

type ProviderTemplateGroup

type ProviderTemplateGroup struct {
	CloudProvider string
	SpecName      string
	Creds         string
}

type RegionNetwork added in v0.9.14

type RegionNetwork struct {
	Region          string
	ExternalNetwork string
}

func ExtractRegionNetwork added in v0.9.14

func ExtractRegionNetwork(nodepools []*spec.DynamicNodePool) []RegionNetwork

ExtractRegionNetwork will return a unique list of all regions with networks used in list of nodepools

Jump to

Keyboard shortcuts

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