Documentation
¶
Index ¶
- Variables
- func CheapestInstanceType(instanceTypes []*cloudprovider.InstanceType) (*cloudprovider.InstanceType, error)
- func DedupeTags(tags []string) []string
- func FilterInstanceTypes(ctx context.Context, instanceTypes []*cloudprovider.InstanceType, ...) ([]*cloudprovider.InstanceType, error)
- func GetNodeClassHash(nodeClass *v1beta1.LinodeNodeClass) string
- func GetTags(nodeClass *v1beta1.LinodeNodeClass, nodeClaim *karpv1.NodeClaim, ...) map[string]string
- func GetTagsForLKE(nodeClass *v1beta1.LinodeNodeClass, nodeClaim *karpv1.NodeClaim, ...) map[string]string
- func IsRetryableError(err error) bool
- func LookupInstanceByTag(ctx context.Context, client sdk.LinodeAPI, tag string) (*linodego.Instance, error)
- func MapToTagList(m map[string]string) []string
- func NodeClaimTag(nodeClaimName string) string
- func NormalizeNodeClaimTagValue(nodeClaimName string) string
- func OpaqueTags(tags []string) []string
- func ParseInstanceID(providerID string) (string, error)
- func PrettySlice[T any](s []T, maxItems int) string
- func TagListToMap(tags []string) map[string]string
- func UpdateUnavailableOfferingsCache(ctx context.Context, err error, region string, ...)
- func ValidateTagLengths(tags []string) error
- func ValidateTags(tags []string) error
- func WithDefaultFloat64(key string, def float64) float64
- type BackoffTracker
Constants ¶
This section is empty.
Variables ¶
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 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 *v1beta1.LinodeNodeClass) string
func GetTagsForLKE ¶
func IsRetryableError ¶
func LookupInstanceByTag ¶
func LookupInstanceByTag(ctx context.Context, client sdk.LinodeAPI, tag string) (*linodego.Instance, error)
LookupInstanceByTag returns the first Linode instance matching the provided tag.
func MapToTagList ¶
func NodeClaimTag ¶ added in v0.1.4
func NormalizeNodeClaimTagValue ¶ added in v0.1.4
func OpaqueTags ¶ added in v0.1.5
func ParseInstanceID ¶
ParseInstanceID parses the provider ID stored on the node to get the instance ID associated with a node
func PrettySlice ¶
PrettySlice truncates a slice after a certain number of max items to ensure that the Slice isn't too long
func TagListToMap ¶
func UpdateUnavailableOfferingsCache ¶
func UpdateUnavailableOfferingsCache( ctx context.Context, err error, region string, instanceType *cloudprovider.InstanceType, unavailableOfferings *linodecache.UnavailableOfferings, )
func ValidateTagLengths ¶ added in v0.1.8
ValidateTagLengths rejects complete tag strings longer than Linode's tag limit, measured in bytes.
func ValidateTags ¶ added in v0.1.5
func WithDefaultFloat64 ¶
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 BackoffTracker ¶ added in v0.1.9
type BackoffTracker struct {
// contains filtered or unexported fields
}
BackoffTracker tracks consecutive failures per key and rejects further attempts until an exponentially growing delay has elapsed, so a persistently failing API call isn't hammered.
func NewBackoffTracker ¶ added in v0.1.9
func NewBackoffTracker(base, maxDelay time.Duration) *BackoffTracker
NewBackoffTracker creates a new BackoffTracker with a cache with a default expiration of an hour
func (*BackoffTracker) Check ¶ added in v0.1.9
func (b *BackoffTracker) Check(key, what string) error
Check returns an error wrapping the last failure while key is backing off, or nil when an attempt is allowed.
func (*BackoffTracker) Clear ¶ added in v0.1.9
func (b *BackoffTracker) Clear(key string)
Clear clears the BackoffTracker entry for the given key
func (*BackoffTracker) RecordFailure ¶ added in v0.1.9
func (b *BackoffTracker) RecordFailure(key string, err error)
RecordFailure records a failure for the given key, updating the error message, setting/incrementing the failure count, and updating the info for when the entry can be retried (exponential backoff)