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

[7.x] [apm-server] Add missing fields to HPA (#782) #956

Merged
merged 1 commit into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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