diff --git a/metricbeat/README.md b/metricbeat/README.md
index 840a061b7..e4a78cb9f 100644
--- a/metricbeat/README.md
+++ b/metricbeat/README.md
@@ -66,11 +66,13 @@ helm install --name metricbeat elastic/metricbeat --set imageTag=7.6.2
## Configuration
| Parameter | Description | Default |
-| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
+| --- | --- | --- |
| `daemonset.affinity` | Configurable [affinity][] for Metricbeat `DaemonSet`. | `{}` |
| `daemonset.metricbeatConfig` | Allows you to add any config files in `/usr/share/metricbeat` such as `metricbeat.yml` for Metricbeat `DaemonSet`. | see [values.yaml][] |
+| `daemonset.resources` | Allows you to set the [resources][] for Metricbeat `DaemonSet` | `requests.cpu: 100m`
`requests.memory: 100Mi`
`limits.cpu: 1000m`
`limits.memory: 200Mi` |
| `deployment.affinity` | Configurable [affinity][] for Metricbeat `Deployment`. | `{}` |
| `deployment.metricbeatConfig` | Allows you to add any config files in `/usr/share/metricbeat` such as `metricbeat.yml` for Metricbeat `Deployment`. | see [values.yaml][] |
+| `deployment.resources` | Allows you to set the [resources][] for Metricbeat `Deployment` | `requests.cpu: 100m`
`requests.memory: 100Mi`
`limits.cpu: 1000m`
`limits.memory: 200Mi` |
| `extraContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` |
| `extraInitContainers` | 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 | `[]` |
@@ -89,7 +91,6 @@ helm install --name metricbeat elastic/metricbeat --set imageTag=7.6.2
| `podSecurityContext` | Configurable [podSecurityContext][] for Metricbeat pod execution environment | `runAsUser: 0`
`privileged: false` |
| `livenessProbe` | Parameters to pass to [liveness probe][] checks for values such as timeouts and thresholds. | `failureThreshold: 3`
`initialDelaySeconds: 10`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` |
| `readinessProbe` | Parameters to pass to [readiness probe][] checks for values such as timeouts and thresholds. | `failureThreshold: 3`
`initialDelaySeconds: 10`
`periodSeconds: 10`
`successThreshold: 3`
`timeoutSeconds: 5` |
-| `resources` | Allows you to set the [resources][] for the `DaemonSet` | `requests.cpu: 100m`
`requests.memory: 100Mi`
`limits.cpu: 1000m`
`limits.memory: 200Mi` |
| `serviceAccount` | Custom [serviceAccount][] that Metricbeat will use during execution. By default will use the service account created by this chart. | `""` |
| `secretMounts` | Allows you easily mount a secret as a file inside the `DaemonSet`. Useful for mounting certificates and other secrets. See [values.yaml][] for an example | `[]` |
| `terminationGracePeriod` | Termination period (in seconds) to wait before killing Metricbeat pod process on pod shutdown | `30` |
@@ -101,10 +102,11 @@ helm install --name metricbeat elastic/metricbeat --set imageTag=7.6.2
| `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to "`.Release.Name`-`.Values.nameOverride or .Chart.Name`" | `""` |
### Deprecated
-| Parameter | Description | Default |
-| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
-| `affinity` | Configurable [affinity][] | `{}` |
-| `metricbeatConfig` | Allows you to add any config files in `/usr/share/metricbeat` such as `metricbeat.yml` for both Metricbeat `DaemonSet` and `Deployment`. | see [values.yaml][] |
+| Parameter | Description | Default |
+| --- | --- | --- |
+| `affinity` | Configurable [affinity][] | `{}` |
+| `metricbeatConfig` | Allows you to add any config files in `/usr/share/metricbeat` such as `metricbeat.yml` for both Metricbeat `DaemonSet` and `Deployment`. | see [values.yaml][] |
+| `resources` | Allows you to set the [resources][] for both Metricbeat `DaemonSet` and `Deployment`. | `requests.cpu: 100m`
`requests.memory: 100Mi`
`limits.cpu: 1000m`
`limits.memory: 200Mi` |
## Examples
diff --git a/metricbeat/templates/daemonset.yaml b/metricbeat/templates/daemonset.yaml
index 73f0b41ba..7ff7830c3 100644
--- a/metricbeat/templates/daemonset.yaml
+++ b/metricbeat/templates/daemonset.yaml
@@ -104,8 +104,7 @@ spec:
{{ toYaml .Values.livenessProbe | indent 10 }}
readinessProbe:
{{ toYaml .Values.readinessProbe | indent 10 }}
- resources:
-{{ toYaml .Values.resources | indent 10 }}
+ resources: {{ toYaml ( .Values.resources | default .Values.daemonset.resources ) | nindent 10 }}
env:
- name: POD_NAMESPACE
valueFrom:
diff --git a/metricbeat/templates/deployment.yaml b/metricbeat/templates/deployment.yaml
index 041c06230..422f9d32b 100644
--- a/metricbeat/templates/deployment.yaml
+++ b/metricbeat/templates/deployment.yaml
@@ -82,8 +82,7 @@ spec:
{{ toYaml .Values.livenessProbe | indent 10 }}
readinessProbe:
{{ toYaml .Values.readinessProbe | indent 10 }}
- resources:
-{{ toYaml .Values.resources | indent 10 }}
+ resources: {{ toYaml ( .Values.resources | default .Values.deployment.resources ) | nindent 10 }}
env:
- name: POD_NAMESPACE
valueFrom:
diff --git a/metricbeat/tests/metricbeat_test.py b/metricbeat/tests/metricbeat_test.py
index 0403e658a..2110ec6ae 100644
--- a/metricbeat/tests/metricbeat_test.py
+++ b/metricbeat/tests/metricbeat_test.py
@@ -98,6 +98,15 @@ def test_defaults():
"readOnly": True,
} in deployment["containers"][0]["volumeMounts"]
+ assert daemonset["containers"][0]["resources"] == {
+ "requests": {"cpu": "100m", "memory": "100Mi"},
+ "limits": {"cpu": "1000m", "memory": "200Mi"},
+ }
+ assert deployment["containers"][0]["resources"] == {
+ "requests": {"cpu": "100m", "memory": "100Mi"},
+ "limits": {"cpu": "1000m", "memory": "200Mi"},
+ }
+
def test_adding_a_extra_container():
config = """
@@ -541,6 +550,81 @@ def test_adding_env_from():
assert configMapRef == {"name": "configmap-name"}
+def test_overriding_resources():
+ config = """
+daemonset:
+ resources:
+ limits:
+ cpu: "25m"
+ memory: "128Mi"
+ requests:
+ cpu: "25m"
+ memory: "128Mi"
+"""
+ r = helm_template(config)
+ assert r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
+ "resources"
+ ] == {
+ "requests": {"cpu": "25m", "memory": "128Mi"},
+ "limits": {"cpu": "25m", "memory": "128Mi"},
+ }
+ assert r["deployment"][name + "-metrics"]["spec"]["template"]["spec"]["containers"][
+ 0
+ ]["resources"] == {
+ "requests": {"cpu": "100m", "memory": "100Mi"},
+ "limits": {"cpu": "1000m", "memory": "200Mi"},
+ }
+
+ config = """
+deployment:
+ resources:
+ limits:
+ cpu: "25m"
+ memory: "128Mi"
+ requests:
+ cpu: "25m"
+ memory: "128Mi"
+"""
+ r = helm_template(config)
+ assert r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
+ "resources"
+ ] == {
+ "requests": {"cpu": "100m", "memory": "100Mi"},
+ "limits": {"cpu": "1000m", "memory": "200Mi"},
+ }
+ assert r["deployment"][name + "-metrics"]["spec"]["template"]["spec"]["containers"][
+ 0
+ ]["resources"] == {
+ "requests": {"cpu": "25m", "memory": "128Mi"},
+ "limits": {"cpu": "25m", "memory": "128Mi"},
+ }
+
+
+def test_adding_deprecated_resources():
+ config = """
+resources:
+ limits:
+ cpu: "25m"
+ memory: "128Mi"
+ requests:
+ cpu: "25m"
+ memory: "128Mi"
+"""
+ r = helm_template(config)
+ assert r["daemonset"][name]["spec"]["template"]["spec"]["containers"][0][
+ "resources"
+ ] == {
+ "requests": {"cpu": "25m", "memory": "128Mi"},
+ "limits": {"cpu": "25m", "memory": "128Mi"},
+ }
+ assert r["deployment"][name + "-metrics"]["spec"]["template"]["spec"]["containers"][
+ 0
+ ]["resources"] == {
+ "requests": {"cpu": "25m", "memory": "128Mi"},
+ "limits": {"cpu": "25m", "memory": "128Mi"},
+ }
+
+
def test_setting_fullnameOverride():
config = """
fullnameOverride: 'metricbeat-custom'
diff --git a/metricbeat/values.yaml b/metricbeat/values.yaml
index 68711372e..96f27b1bb 100755
--- a/metricbeat/values.yaml
+++ b/metricbeat/values.yaml
@@ -52,6 +52,13 @@ daemonset:
system.filesystem.mount_point: '^/(sys|cgroup|proc|dev|etc|host|lib)($|/)'
output.elasticsearch:
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'
+ resources:
+ requests:
+ cpu: "100m"
+ memory: "100Mi"
+ limits:
+ cpu: "1000m"
+ memory: "200Mi"
deployment:
affinity: {}
@@ -72,6 +79,13 @@ deployment:
hosts: ["${KUBE_STATE_METRICS_HOSTS}"]
output.elasticsearch:
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'
+ resources:
+ requests:
+ cpu: "100m"
+ memory: "100Mi"
+ limits:
+ cpu: "1000m"
+ memory: "200Mi"
# DEPRECATED
# Allows you to add any config files in /usr/share/metricbeat
@@ -186,14 +200,6 @@ podSecurityContext:
runAsUser: 0
privileged: false
-resources:
- requests:
- cpu: "100m"
- memory: "100Mi"
- limits:
- cpu: "1000m"
- memory: "200Mi"
-
# Custom service account override that the pod will use
serviceAccount: ""
@@ -221,3 +227,6 @@ updateStrategy: RollingUpdate
# Only edit these if you know what you're doing
nameOverride: ""
fullnameOverride: ""
+
+# DEPRECATED
+resources: {}
\ No newline at end of file