utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInstanceNotFound = errors.New("instance not found")
)

Functions

func CheapestInstanceType

func CheapestInstanceType(instanceTypes []*cloudprovider.InstanceType) (*cloudprovider.InstanceType, error)

CheapestInstanceType returns the lowest-price instance type from the set.

func DedupeTags

func DedupeTags(tags []string) []string

func FilterInstanceTypes

func FilterInstanceTypes(ctx context.Context, instanceTypes []*cloudprovider.InstanceType, nodeClaim *karpv1.NodeClaim) ([]*cloudprovider.InstanceType, error)

FilterInstanceTypes applies common filters to available instance types.

func GetInstanceTagsForLKE

func GetInstanceTagsForLKE(nodeClaimName string) map[string]string

func GetNodeClassHash

func GetNodeClassHash(nodeClass *v1alpha1.LinodeNodeClass) string

func GetTags

func GetTags(nodeClass *v1alpha1.LinodeNodeClass, nodeClaim *karpv1.NodeClaim, clusterName string) map[string]string

func GetTagsForLKE

func GetTagsForLKE(nodeClass *v1alpha1.LinodeNodeClass, nodeClaim *karpv1.NodeClaim, clusterName string) map[string]string

func IsRetryableError

func IsRetryableError(err error) bool

func LookupInstanceByTag

func LookupInstanceByTag(ctx context.Context, client sdk.LinodeAPI, tag string) (*linodego.Instance, error)

LookupInstanceByTag returns the single Linode instance matching the provided tag.

func MapToTagList

func MapToTagList(m map[string]string) []string

func ParseInstanceID

func ParseInstanceID(providerID string) (string, error)

ParseInstanceID parses the provider ID stored on the node to get the instance ID associated with a node

func PrettySlice

func PrettySlice[T any](s []T, maxItems int) string

PrettySlice truncates a slice after a certain number of max items to ensure that the Slice isn't too long

func TagListToMap

func TagListToMap(tags []string) map[string]string

func UpdateUnavailableOfferingsCache

func UpdateUnavailableOfferingsCache(
	ctx context.Context,
	err error,
	region string,
	instanceType *cloudprovider.InstanceType,
	unavailableOfferings *linodecache.UnavailableOfferings,

)

func WithDefaultFloat64

func WithDefaultFloat64(key string, def float64) float64

WithDefaultFloat64 returns the float64 value of the supplied environment variable or, if not present, the supplied default value. If the float64 conversion fails, returns the default

Types

This section is empty.

Jump to

Keyboard shortcuts

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