priority

package
v0.0.0-...-386b7fa Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

README

Priority based expander for cluster-autoscaler

Introduction

Priority based expander selects an expansion option based on priorities assigned by a user to scaling groups. The assignment is based on matching of the scaling group's name to regular expressions. The correct and meaningful naming of scaling groups is left up to the user.

Motivation

This expander gives the user a lot of control over which scaling group specifically will be used by cluster-autoscaler. It makes a lot of sense when configured manually by the user to match the specific needs. It also makes a lot of sense for environments where user's preferences change frequently based on properties outside of cluster scope. A good example here is the constant change of pricing and termination probability on AWS Spot Market for EC2 instances. The expander is configured using a single ConfigMap, which is watched by the expander for any changes. The priority expander can be easily integrated with external optimization engines, that can just change the value of the ConfigMap configuration object. That way it's possible to dynamically change the decision of cluster-autoscaler using ConfigMap updates only.

Configuration

Configuration is based on the values stored in a ConfigMap. This ConfigMap has to be created before cluster autoscaler with priority expander can be started. The ConfigMap must be named cluster-autoscaler-priority-expander and it must be placed in the same namespace as cluster autoscaler pod. The ConfigMap is watched by the cluster autoscaler and any changes made to it are loaded on the fly, without restarting cluster autoscaler.

The format of the ConfigMap (example) is as follows:

apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-autoscaler-priority-expander
data:
  priorities: |-
    10: 
      - .*t2\.large.*
      - .*t3\.large.*
    50: 
      - .*m4\.4xlarge.*

The priority should be a positive value. The highest value wins. For each priority value, a list of regular expressions should be given. If there are multiple node groups matching any of the regular expressions with the highest priority, one group to expand the cluster is selected each time at random. Priority values cannot be duplicated - in that case, only one of the lists will be used.

In the example above, the user gives the highest priority to any expansion option, where the scaling group ID matches the regular expression .*m4\.4xlarge.*. Assuming all of the used scaling groups are based on AWS Spot instances, the user might now want to give up on all the scaling groups based on the m4.4xlarge instance family. To do that, it's enough to either reconfigure the priority to a value <10 or remove the entry with priority 50 altogether.

Documentation

Index

Constants

View Source
const (
	// PriorityConfigMapName defines a name of the ConfigMap used to store priority expander configuration
	PriorityConfigMapName = "cluster-autoscaler-priority-expander"
	// ConfigMapKey defines the key used in the ConfigMap to configure priorities
	ConfigMapKey = "priorities"
)

Variables

This section is empty.

Functions

func NewStrategy

NewStrategy returns an expansion strategy that picks node groups based on user-defined priorities

Types

This section is empty.

Jump to

Keyboard shortcuts

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