utils

package
v0.0.0-...-7be06aa Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 GetNodeClassHash

func GetNodeClassHash(nodeClass *v1.LinodeNodeClass) string

func GetTags

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

func GetTagsForLKE

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

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,
	capacityType string,
	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

type Filter

type Filter struct {
	ID                *int              // Filter on the resource's ID (most specific).
	Label             string            // Filter on the resource's label.
	Tags              []string          // Filter resources by their tags (least specific).
	AdditionalFilters map[string]string // Filter resources by additional parameters
}

Filter holds the fields used for filtering results from the Linode API.

The fields within Filter are prioritized so that only the most-specific field is present when Filter is marshaled to JSON.

func (Filter) MarshalJSON

func (f Filter) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON-encoded representation of a Filter. The resulting encoded value will have exactly 1 (one) field present. See Filter for details on the value precedence.

func (Filter) String

func (f Filter) String() (string, error)

String returns the string representation of the encoded value from Filter.MarshalJSON.

Jump to

Keyboard shortcuts

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