Skip to content

Commit 64851f0

Browse files
committed
feat(alloy): set default resource requests
The Alloy container has no resource requests by default. The scheduler reserves nothing for it, and the node evicts it first under memory pressure. Set small CPU and memory requests. Set no limits: usage grows with the number of scrape targets, and a limit could throttle or OOM-kill the collector on large clusters. Operators can override alloy.alloy.resources.
1 parent 938aba9 commit 64851f0

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ values which are defined [here](https://github.com/grafana/helm-charts/tree/main
318318
| alloy.alloy.extraArgs[0] | string | `"--disable-reporting=true"` | |
319319
| alloy.alloy.mounts.dockercontainers | bool | `true` | |
320320
| alloy.alloy.mounts.varlog | bool | `true` | |
321+
| alloy.alloy.resources.requests.cpu | string | `"50m"` | |
322+
| alloy.alloy.resources.requests.memory | string | `"128Mi"` | |
321323
| alloy.commonRelabellings | string | `"rule {\n source_labels = [\"__meta_kubernetes_namespace\"]\n target_label = \"namespace\"\n}\nrule {\n source_labels = [\"__meta_kubernetes_pod_name\"]\n target_label = \"pod\"\n}\n// coalesce the following labels and pick the first value; we'll use this to define the \"job\" label\nrule {\n source_labels = [\"__meta_kubernetes_pod_label_app_kubernetes_io_component\", \"app\", \"__meta_kubernetes_pod_container_name\"]\n separator = \"/\"\n target_label = \"__meta_app\"\n action = \"replace\"\n regex = \"^/*([^/]+?)(?:/.*)?$\" // split by the delimiter if it exists, we only want the first one\n replacement = \"${1}\"\n}\nrule {\n source_labels = [\"__meta_kubernetes_namespace\", \"__meta_kubernetes_pod_label_app_kubernetes_io_name\", \"__meta_app\"]\n separator = \"/\"\n target_label = \"job\"\n}\nrule {\n source_labels = [\"__meta_kubernetes_pod_container_name\"]\n target_label = \"container\"\n}\nrule {\n regex = \"__meta_kubernetes_pod_label_(statefulset_kubernetes_io_pod_name|controller_revision_hash)\"\n action = \"labeldrop\"\n}\nrule {\n regex = \"pod_template_generation\"\n action = \"labeldrop\"\n}\nrule {\n source_labels = [\"__meta_kubernetes_pod_phase\"]\n regex = \"Pending|Succeeded|Failed|Completed\"\n action = \"drop\"\n}\nrule {\n source_labels = [\"__meta_kubernetes_pod_node_name\"]\n action = \"replace\"\n target_label = \"node\"\n}\nrule {\n action = \"labelmap\"\n regex = \"__meta_kubernetes_pod_annotation_prometheus_io_param_(.+)\"\n replacement = \"__param_$1\"\n}"` | |
322324
| alloy.controller.podAnnotations."prometheus.io/scrape" | string | `"true"` | |
323325
| alloy.controller.type | string | `"daemonset"` | |

‎coder-observability/values.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ alloy:
207207
mounts:
208208
varlog: true
209209
dockercontainers: true
210+
# Requests only. A limit could throttle or OOM-kill the collector on large
211+
# clusters, where usage grows with the number of scrape targets.
212+
resources:
213+
requests:
214+
cpu: 50m
215+
memory: 128Mi
210216
controller:
211217
type: daemonset
212218
podAnnotations:

‎compiled/resources.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12112,6 +12112,10 @@ spec:
1211212112
scheme: HTTP
1211312113
initialDelaySeconds: 10
1211412114
timeoutSeconds: 1
12115+
resources:
12116+
requests:
12117+
cpu: 50m
12118+
memory: 128Mi
1211512119
volumeMounts:
1211612120
- name: config
1211712121
mountPath: /etc/alloy

0 commit comments

Comments
 (0)