Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
[7.10] [apm-server] Add missing fields to HPA (elastic#782) (elastic#955
Browse files Browse the repository at this point in the history
)

Co-authored-by: Julien Mailleret <8582351+jmlrt@users.noreply.github.com>

Co-authored-by: David <david@dtslabs.com>
  • Loading branch information
jmlrt and david92rl committed Dec 1, 2020
1 parent 629a067 commit 7c69a50
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apm-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ as a reference. They are also used in the automated testing of this chart.
|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| `affinity` | Configurable [affinity][] | `{}` |
| `apmConfig` | Allows you to add any config files in `/usr/share/apm-server/config` such as `apm-server.yml` | see [values.yaml][] |
| `autoscaling` | Enable the [horizontal pod autoscaler][] | `enabled: false` |
| `autoscaling` | Enable the [horizontal pod autoscaler][] | see [values.yaml][] |
| `envFrom` | Templatable string to be passed to the [environment from variables][] which will be appended to the `envFrom:` definition for the container | `[]` |
| `extraContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` |
| `extraEnvs` | Extra [environment variables][] which will be appended to the `env:` definition for the container | `[]` |
Expand Down
9 changes: 9 additions & 0 deletions apm-server/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ spec:
apiVersion: apps/v1
kind: Deployment
name: {{ template "apm.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.averageCpuUtilization }}
{{- end }}
10 changes: 10 additions & 0 deletions apm-server/tests/apmserver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,13 @@ def test_setting_fullnameOverride():
]
== project
)


def test_enabling_horizontal_pod_autoscaler():
config = """
autoscaling:
enabled: true
"""
r = helm_template(config)

assert "horizontalpodautoscaler" in r
3 changes: 3 additions & 0 deletions apm-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ fullnameOverride: ""

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 3
averageCpuUtilization: 50

ingress:
enabled: false
Expand Down

0 comments on commit 7c69a50

Please sign in to comment.