MCPcopy Index your code
hub / github.com/atlassian/escalator

github.com/atlassian/escalator @v1.16.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.16.4 ↗ · + Follow
394 symbols 1,613 edges 46 files 240 documented · 61%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Escalator

Godoc Build Status Go Report Card license

Escalator is a batch or job optimized horizontal autoscaler for Kubernetes

It is designed for large batch or job based workloads that cannot be force-drained and moved when the cluster needs to scale down - Escalator will ensure pods have been completed on nodes before terminating them. It is also optimised for scaling up the cluster as fast as possible to ensure pods are not left in a pending state.

Key Features

  • Calculate requests and capacity to determine whether to scale up, down or to stay at the current scale
  • Waits until non-daemonset pods on nodes have completed before terminating the node
  • Designed to work on selected auto-scaling groups to allow the default Kubernetes Autoscaler to continue to scale service based workloads
  • Automatically terminate oldest nodes first
  • Support for slack space to ensure extra space in the event of a spike of scheduled pods
  • Does not terminate or factor cordoned nodes into calculations - allows cordoned nodes to persist for debugging
  • Support for different cloud providers - AWS only at the moment
  • Scaling and utilisation metrics
  • Leader election so you can run a HA Deployment inside a cluster.
  • Basic support for multiple different types of instances in a Node Group.

The need for this autoscaler is derived from our own experiences with very large batch workloads being scheduled and the default autoscaler not scaling up the cluster fast enough. These workloads can't be force-drained by the default autoscaler and must complete before the node can be terminated.

Documentation and Design

See Docs

Requirements

  • Kubernetes version 1.24+. Escalator has been tested and deployed on 1.24+ and newer. Older versions of Kubernetes may have bugs or issues that will prevent it from functioning properly.
  • Go version 1.20+
  • Dependencies and their locked versions can be found in go.mod and go.sum.

Building

# Fetch dependencies and build Escalator
make build

How to run - Quick Start

Locally (out of cluster)

go run cmd/main.go --kubeconfig=~/.kube/config --nodegroups=nodegroups_config.yaml

Deployment (in cluster)

See Deployment for full Deployment documentation.

# Build the docker image
docker build -t atlassian/escalator .

# Create RBAC configuration
kubectl create -f docs/deployment/escalator-rbac.yaml

# Create config map - modify to suit your needs
kubectl create -f docs/deployment/escalator-cm.yaml

# Create deployment
kubectl create -f docs/deployment/escalator-deployment.yaml

Configuring

See Configuration

Testing

make test

Test a specific package

For example, to test the controller package:

go test ./pkg/controller

Contributors

Pull requests, issues and comments welcome. For pull requests:

  • Add tests for new features and bug fixes
  • Follow the existing style (we are using goreturns to format and lint escalator)
  • Separate unrelated changes into multiple pull requests

See the existing issues for things to start contributing.

For bigger changes, make sure you start a discussion first by creating an issue and explaining the intended change.

Atlassian requires contributors to sign a Contributor License Agreement, known as a CLA. This serves as a record stating that the contributor is entitled to contribute the code/documentation/translation to the project and is willing to have it used in distributions and derivative works (or is willing to transfer ownership).

Prior to accepting your contributions we ask that you please follow the appropriate link below to digitally sign the CLA. The Corporate CLA is for those who are contributing as a member of an organization and the individual CLA is for those contributing as an individual.

License

Copyright (c) 2018 Atlassian and others. Apache 2.0 licensed, see LICENSE file.

Extension points exported contracts — how you extend this code

PodLister (Interface)
PodLister provides an interface for anything that can list a pod [4 implementers]
pkg/k8s/pod_listers.go
CloudProvider (Interface)
CloudProvider contains configuration info and functions for interacting with cloud provider (GCE, AWS, etc). [2 implementers]
pkg/cloudprovider/interface.go
NodeLister (Interface)
NodeLister provides an interface for anything that can list a node [4 implementers]
pkg/k8s/node_listers.go
Instance (Interface)
Instance contains convenience functions for extracting common information from CP instances [2 implementers]
pkg/cloudprovider/interface.go
PodFilterFunc (FuncType)
PodFilterFunc provides a definition for a predicate based on matching a pod return true for keep node
pkg/k8s/pod_listers.go
NodeGroup (Interface)
NodeGroup contains configuration info and functions to control a set of nodes that have the same capacity and set of lab [2 …
pkg/cloudprovider/interface.go
NodeFilterFunc (FuncType)
NodeFilterFunc provides a definition for a predicate based on matching a node return true for keep node
pkg/k8s/node_listers.go
Builder (Interface)
Builder interface provides a method to build a cloud provider [2 implementers]
pkg/cloudprovider/interface.go

Core symbols most depended-on inside this repo

BuildTestNode
called by 106
pkg/test/builder.go
BuildTestPod
called by 70
pkg/test/builder.go
String
called by 66
pkg/cloudprovider/aws/aws.go
Add
called by 63
pkg/k8s/scheduler/types.go
Error
called by 33
pkg/cloudprovider/types.go
BuildTestNodes
called by 21
pkg/test/builder.go
scaleNodeGroup
called by 17
pkg/controller/controller.go
GetToBeRemovedTaint
called by 16
pkg/k8s/taint.go

Shape

Function 191
Method 142
Struct 51
Interface 6
FuncType 2
TypeAlias 2

Languages

Go100%

Modules by API surface

pkg/cloudprovider/aws/aws.go36 symbols
pkg/cloudprovider/aws/aws_test.go28 symbols
pkg/test/cloud_provider.go27 symbols
pkg/cloudprovider/interface.go27 symbols
pkg/controller/node_group.go23 symbols
pkg/controller/controller.go20 symbols
pkg/k8s/util.go14 symbols
pkg/controller/controller_scale_node_group_test.go14 symbols
pkg/test/aws.go11 symbols
pkg/cloudprovider/aws/node_group_test.go11 symbols
pkg/k8s/taint_test.go10 symbols
pkg/k8s/scheduler/types.go10 symbols

For agents

$ claude mcp add escalator \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact