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

Metricbeat daemonset deployment optional #716

Merged
merged 4 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
10 changes: 6 additions & 4 deletions metricbeat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ as a reference. They are also used in the automated testing of this chart.
| Parameter | Description | Default |
|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------|
| `clusterRoleRules` | Configurable [cluster role rules][] that Metricbeat uses to access Kubernetes resources | see [values.yaml][] |
| `daemonset.annotations` | Configurable [annotations][] for Metricbeat daemonset | `{}` |
| `daemonset.annotations` | Configurable [annotations][] for Metricbeat daemonset | `{}` |
| `daemonset.affinity` | Configurable [affinity][] for Metricbeat daemonset | `{}` |
| `daemonset.enabled` | If true, enable daemonset | `true` |
| `daemonset.envFrom` | Templatable string of `envFrom` to be passed to the [environment from variables][] which will be appended to Metricbeat container for DaemonSet | `[]` |
| `daemonset.extraEnvs` | Extra [environment variables][] which will be appended to Metricbeat container for DaemonSet | `[]` |
| `daemonset.extraVolumeMounts` | Templatable string of additional `volumeMounts` to be passed to the `tpl` function or DaemonSet | `[]` |
Expand All @@ -97,8 +98,9 @@ as a reference. They are also used in the automated testing of this chart.
| `daemonset.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 | `[]` |
| `daemonset.securityContext` | Configurable [securityContext][] for Metricbeat DaemonSet pod execution environment | see [values.yaml][] |
| `daemonset.tolerations` | Configurable [tolerations][] for Metricbeat DaemonSet | `[]` |
| `deployment.annotations` | Configurable [annotations][] for Metricbeat Deployment | `{}` |
| `deployment.annotations` | Configurable [annotations][] for Metricbeat Deployment | `{}` |
| `deployment.affinity` | Configurable [affinity][] for Metricbeat Deployment | `{}` |
| `deployment.enabled` | If true, enable deployment | `true` |
| `deployment.envFrom` | Templatable string of `envFrom` to be passed to the [environment from variables][] which will be appended to Metricbeat container for Deployment | `[]` |
| `deployment.extraEnvs` | Extra [environment variables][] which will be appended to Metricbeat container for Deployment | `[]` |
| `deployment.extraVolumeMounts` | Templatable string of additional `volumeMounts` to be passed to the `tpl` function or DaemonSet | `[]` |
Expand All @@ -115,7 +117,7 @@ as a reference. They are also used in the automated testing of this chart.
| `hostPathRoot` | Fully-qualified [hostPath][] that will be used to persist Metricbeat registry data | `/var/lib` |
| `imagePullPolicy` | The Kubernetes [imagePullPolicy][] value | `IfNotPresent` |
| `imagePullSecrets` | Configuration for [imagePullSecrets][] so that you can use a private registry for your image | `[]` |
| `imageTag` | The Metricbeat Docker image tag | `8.0.0-SNAPSHOT` |
| `imageTag` | The Metricbeat Docker image tag | `8.0.0-SNAPSHOT` |
| `image` | The Metricbeat Docker image | `docker.elastic.co/beats/metricbeat` |
| `labels` | Configurable [labels][] applied to all Metricbeat pods | `{}` |
| `livenessProbe` | Parameters to pass to liveness [probe][] checks for values such as timeouts and thresholds | see [values.yaml][] |
Expand All @@ -126,7 +128,7 @@ as a reference. They are also used in the automated testing of this chart.
| `readinessProbe` | Parameters to pass to readiness [probe][] checks for values such as timeouts and thresholds | see [values.yaml][] |
| `replicas` | The replica count for the Metricbeat deployment talking to kube-state-metrics | `1` |
| `serviceAccount` | Custom [serviceAccount][] that Metricbeat will use during execution. By default will use the service account created by this chart | `""` |
| `serviceAccountAnnotations` | Annotations to be added to the ServiceAccount that is created by this chart. | `{}`
| `serviceAccountAnnotations` | Annotations to be added to the ServiceAccount that is created by this chart. | `{}` |
| `terminationGracePeriod` | Termination period (in seconds) to wait before killing Metricbeat pod process on pod shutdown | `30` |
| `updateStrategy` | The [updateStrategy][] for the DaemonSet By default Kubernetes will kill and recreate pods on updates. Setting this to `OnDelete` will require that pods be deleted manually | `RollingUpdate` |

Expand Down
4 changes: 3 additions & 1 deletion metricbeat/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.daemonset.enabled }}
---
apiVersion: apps/v1
kind: DaemonSet
Expand Down Expand Up @@ -164,4 +165,5 @@ spec:
{{- end }}
{{- if .Values.extraContainers }}
{{ tpl .Values.extraContainers . | indent 6 }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions metricbeat/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Deploy singleton instance in the whole cluster for some unique data sources, like kube-state-metrics
{{- if .Values.deployment.enabled }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -129,3 +131,4 @@ spec:
{{- if .Values.extraContainers }}
{{ tpl .Values.extraContainers . | indent 6 }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions metricbeat/tests/metricbeat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,3 +1161,23 @@ def test_adding_annotations():
== "waldo"
)
assert "annotations" not in r["daemonset"][name]["metadata"]


def test_disable_daemonset():
config = """
daemonset:
enabled: false
"""
r = helm_template(config)

assert name not in r.get("daemonset", {})


def test_disable_deployment():
config = """
deployment:
enabled: false
"""
r = helm_template(config)

assert name + "-metrics" not in r.get("deployment", {})
4 changes: 4 additions & 0 deletions metricbeat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ daemonset:
# Annotations to apply to the daemonset
annotations: {}
affinity: {}
# Include the daemonset
enabled: true
# Extra environment variables for Metricbeat container.
envFrom: []
# - configMapRef:
Expand Down Expand Up @@ -96,6 +98,8 @@ deployment:
# Annotations to apply to the deployment
annotations: {}
affinity: {}
# Include the deployment
enabled: true
# Extra environment variables for Metricbeat container.
envFrom: []
# - configMapRef:
Expand Down