All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
v2.11.0 - 2024-03-22
- Updated to
k8shorizmetrics/v3
. - Partial K8s metrics server errors are logged to help with debugging.
v2.10.0 - 2023-12-24
- Added Python 3.12 Docker image (
custompodautoscaler/python-3-12
).
- Dropped support for Python 3.6 and 3.7 Docker images (
custompodautoscaler/python-3-6
andcustompodautoscaler/python-3-7
) which are EOL (see Python version lifecycles here). - Dropped support for OpenJDK image (
custompodautoscaler/openjdk-11
) since the base images are EOL (see deprecation notice here). Instead use a Custom Docker Image and install a JRE into it, see the updated simple-pod-metrics-java example for details.
- Updated
custompodautoscaler/python
to track Python 3.12. - Updated package dependencies.
v2.9.0 - 2023-12-23
- Switched from performing UPDATE using the K8s API to using PATCH, avoids race condition if resource is modified while calculating the target number of replicas. (#187)
v2.8.0 - 2023-08-15
- Upgraded to Go
v1.21
. - Upgraded package dependencies.
- Dropped support for Kubernetes
v1.23
, upgraded to use theautoscaling/v2
API.
v2.7.0 - 2022-05-14
- Upgraded K8s client libraries to
v0.24.0
. - Upgraded to Go
v1.17
. - Extracted out internal K8s metrics calculations to use jthomperoo/k8shorizmetrics instead.
v2.6.0 - 2022-04-17
- Mutual TLS support for
http
methods.- Three new fields to the
http
method,caCert
,clientCert
andclientKey
which allow paths to be specified to certs and keys to support mutual TLS and client certificates.
- Three new fields to the
v2.5.0 - 2022-03-26
- Now internally using the Kubernetes Scale API for determining replica count and selectors, removing any direct dependencies on the Kubernetes core types when used in conjunction with the Kubernetes unstructured API.
- Can now install the project by using the
go install
command since replace directives have been removed.
v2.4.1 - 2022-02-22
- K8s metrics now use the Spec.Selector to select resources from the metrics server, rather than incorrectly using the labels of the resource being scaled.
- K8s metrics now support match
expressions
where available (
Deployment
,ReplicaSet
,StatefulSet
,Rollout
).
v2.4.0 - 2021-12-28
- Error messages now include more context about when they occured, rather than simply outputting the minimum error information.
v2.3.0 - 2021-12-27
- Support for
argoproj.io/v1alpha1
Rollout
resource.
- Add clarity between
autoscaling/v1
andautoscaling/v2beta2
APIs, no breaking changes.
- Updated k8s client libraries to
v0.21.8
to resolve GHSA-f5f7-6478-qm6p.
v2.2.0 - 2021-08-14
- New
openjdk-11
image which includes Java 11 runtime.
v2.1.0 - 2021-06-16
- New
logStderr
option forshell
methods, intended to help debugging by printing out the stderr of a successfulshell
method execution - default valuefalse
.
- Error returned when parsing invalid JSON for an evaluation improved to help debugging.
v2.0.0 - 2021-04-15
- BREAKING CHANGE Project's Go code restructured, limited exposed packages. See the migration guide for full details.
- BREAKING CHANGE Pre-scaling hook moved to after the downscale stabilization value has been calculated.
k8smetric
package now exposed to allow easy Go dependency marshal/unmarshal of K8s metrics.
targetReplicas
value now set properly, set to the pre-stabilized target replica value.
- The Custom Pod Autoscaler version is now printed to the log on autoscaler startup.
v1.1.0 - 2021-04-08
- Feature to provide standard K8s metrics to the metric gathering stage of the autoscaler
- Can now provide a list of Metric Specs (similar to the Horizontal Pod Autoscaler) to choose which metrics to
include in the data sent to the metric gathering stage with the
kubernetesMetricSpecs
configuration option. - Can provide the
requireKubernetesMetrics
option to fail if the metrics server query fails. - Can provide
initialReadinessDelay
andcpuInitializationPeriod
values for use when querying the metrics server.
- Can now provide a list of Metric Specs (similar to the Horizontal Pod Autoscaler) to choose which metrics to
include in the data sent to the metric gathering stage with the
- Switched docs theme to material theme.
v1.0.1 - 2020-09-12
- Three new Python images:
custompodautoscaler/python-3-6
tracks latest stable Python 3.6.x release.custompodautoscaler/python-3-7
tracks latest stable Python 3.7.x release.custompodautoscaler/python-3-8
tracks latest stable Python 3.8.x release.
- The
custompodautoscaler/python
image now tracks the latest stable Python 3.x release.
v1.0.0 - 2020-07-19
v0.13.0 - 2020-07-18
- HTTP method, allows specifying an HTTP request to make as a method - for example querying an external API as part of the metric gathering stage.
- Extra error checking for
shell
method, will no longer throw nil pointer if no shell configuration is provided, more useful error is raised instead.
v0.12.0 - 2020-04-25
- Support scaling to and from zero, matching misimplemented functionality from Horizontal Pod Autoscaler.
v0.11.0 - 2020-02-28
- Series of hooks for injecting user logic throughout the execution process.
preMetric
- Runs before metric gathering, given metric gathering input.postMetric
- Runs after metric gathering, given metric gathering input and result.preEvaluate
- Runs before evaluation, given evaluation input.postEvaluate
- Runs after evaluation, given evaluation input and result.preScale
- Runs before scaling decision, given min and max replicas, current replicas, target replicas, and resource being scaled.postScale
- Runs before scaling decision, given min and max replicas, current replicas, target replicas, and resource being scaled.
- New
downscaleStabilization
option, based on the Horizontal Pod Autoscaler downscale stabilization, operates by taking the maximum target replica count over the stabilization window.
- Metrics from API now returns the entire resource definition as JSON rather than just the resource name.
- Changed JSON generated to be in
camelCase
rather thansnake_case
for consistency with the Kubernetes API.- Evaluation now uses
targetReplicas
overtarget_replicas
. - ResourceMetric now uses
runType
overrun_type
. - Scale hook now provided with
minReplicas
,maxReplicas
,currentReplicas
andtargetReplicas
rather than their snakecase equivalents.
- Evaluation now uses
- Metric gathering and hooks have access to
dryRun
field, allowing them to determine if they are called as part of a dry run. - Standardised input to metric gatherer, evaluator and scaler to take specs rather than lists of parameters, allowing easier serialisation for hooks.
- Endpoint
/api/v1/metrics
now accepts the optionaldry_run
parameter for marking metric gathering as in dry run mode. ResourceMetrics
replaced with a list ofMetric
and aResource
./api/v1/metrics
now simply returns a list ofMetrics
rather than aResourceMetrics
.
ResourceMetrics
struct removed as it was redundant.
v0.10.0 - 2020-01-22
- Set up API to be versioned, starting with
v1
. - Can now manually trigger scaling through the API.
- Added extra
run_type
flag,api_dry_run
, for evaluations through the API indry_run
mode. - Added
apiConfig
to hold configuration for the REST API. - Added extra configuration options within
apiConfig
.enabled
- allows enabling or disabling the API, default enabled (true
).useHTTPS
- allows enabling or disabling HTTPS for the API, default off (false
).certFile
- cert file to be used if HTTPS is enabled.keyFile
- key file to be used if HTTPS is enabled.
- The
command
forshell
methods is now an array of arguments, rather than a string. - The
/api/v1/evaluation
endpoint now requiresPOST
rather thanGET
. - The
/api/v1/evaluation
endpoint now accepts an optional parameter,dry_run
. Ifdry_run
is true the evaluation will be retrieved in a read-only manner, the scaling will not occur. If it is false, or not provided, the evaluation will be retrieved and then used to apply scaling to the target. - Moved
port
andhost
configuration options into theapiConfig
settings.
v0.9.0 - 2020-01-19
- Support for other entrypoints other than
/bin/sh
, can specify an entrypoint for the shell command method. - Add logging library
glog
to allow logging at levels of severity and verbosity. - Can specify verbosity level of logs via the
logVerbosity
configuration option.
- Can scale ReplicaSets, ReplicationControllers and StatefulSets alongside Deployments.
- ResourceMetrics fields have
resourceName
andresource
rather thandeploymentName
anddeployment
. In JSON this means that only the resource name will be exposed via fieldresource
. - Uses scaling API rather than manually adjusting replica count on resource.
- Matches using match selector rather than incorrectly using resource labels and building a different selector.
v0.8.0 - 2019-12-17
- New
startTime
configuration option in milliseconds; allows specifying a time that the interval should count up from when starting. This allows specifying a nearest time to start at, for example setting it to60000
would start running at the closest minute, setting it to15000
would start running at the closest 15 seconds e.g. :15 :30 :45. - Support for JSON configuration, configuration file can now be in either YAML or JSON.
- Replaced shell command with a generic method, allowing different methods to be supported. For example, instead of:
evaluate: "python /evaluate.py"
evaluateTimeout: 2500
It is now:
evaluate:
type: "shell"
timeout: 2500
shell: "python /evaluate.py"
v0.7.0 - 2019-12-08
- New
run_type
flag to the ResourceMetrics; allows scripts to understand the context of how it is being called.- Two values, either
api
triggered by an API call, orscaler
which means it was triggered by the autoscaling logic.
- Two values, either
- Provide full metric information to be piped into the evaluation command, including the resource being managed.
0.6.0 - 2019-11-20
- Allow setting minimum and maximum replicas, with
minReplicas
andmaxReplicas
options - if the evaluation is above maxReplicas the resource is only scaled up tomaxReplicas
value, if the evaluation is belowminReplicas
the resource is only scaled down tominReplicas
. - Can disable autoscaling for a resource by setting its
replicas
to0
.
- The
target_replicas
field in an evaluation is no longer optional.
0.5.0 - 2019-11-18
- Allow specification of how metrics/evaluations should be run with
runMode
, eitherper-pod
orper-resource
. Modeper-pod
means run the metric gathering command individually per pod, with pod info piped in.per-resource
means run the metric gathering command per resource, with the resource info piped in.
- Metrics are now tied to a resource name, rather than a pod name - with
resource
rather thanpod
as the field in metrics, e.g.
{
"resource": "resource-name",
"value:" "value"
}
0.4.0 - 2019-11-16
- Path to config file specified using
configPath
rather thanconfig_path
- consistency with other config options. - Not Found (404) and Method Not Allowed (405) now return valid JSON alongside the error code with a message explaining the error.
- Only allow management of a single deployment.
- Use
ScaleTargetRef
rather thanselector
for deciding which resources to manage, more consistent with Horizontal Pod Autoscaler. - Simplified evaluation, now when hitting CPA API will just return the
target_replicas
rather than additional info and complicated JSON.
0.3.0 - 2019-11-03
- Two new configuration options,
metric_timeout
andevaluate_timeout
. Allows timeouts to be set formetric
command andevaluate
commands; default3000
milliseconds.
- Read configuration in environment variables in consistent way with YAML, env vars are all lowercase.
0.2.0 - 2019-10-28
- Simple API for querying metrics/evaluations.
- Graceful shutdown of API and scaler.
- Namespace support for managing pods.
- Configuration of interval via environment variables/custom resource definition.
- Binary deployed with a release onto GitHub releases.
0.1.0 - 2019-09-30
- Allow specification of deployment to manage with a selector.
- Gather pods for managed deployment.
- Run user defined metric every set interval for each pod.
- Run user defined evaluation based on metric results.
- Updates target number of replicas for a deployment based on evaluation.
- Deploy image to Docker Hub.