From d47ac43e0ee3124ed8fd4c6f819725f9d9ac05a3 Mon Sep 17 00:00:00 2001 From: "agermel@foxmail.com" Date: Tue, 8 Sep 2026 22:38:40 +0800 Subject: [PATCH] feat(helm): Add service.trafficDistribution to values.yaml --- operations/helm/charts/alloy/CHANGELOG.md | 1 + operations/helm/charts/alloy/README.md | 1 + operations/helm/charts/alloy/templates/service.yaml | 5 +++++ operations/helm/charts/alloy/values.yaml | 2 ++ 4 files changed, 9 insertions(+) diff --git a/operations/helm/charts/alloy/CHANGELOG.md b/operations/helm/charts/alloy/CHANGELOG.md index cd5c0af6792..28bfd709875 100644 --- a/operations/helm/charts/alloy/CHANGELOG.md +++ b/operations/helm/charts/alloy/CHANGELOG.md @@ -13,6 +13,7 @@ Unreleased ### Enhancements - Add `controller.dnsConfig` to configure the pod's DNS settings (`nameservers`, `searches`, `options`). (@younsl) +- Allow setting `trafficDistribution` in the service spec. (@agermel) 1.12.1 (2026-08-26) ---------- diff --git a/operations/helm/charts/alloy/README.md b/operations/helm/charts/alloy/README.md index 2b495456a5a..9189d0ac1f9 100644 --- a/operations/helm/charts/alloy/README.md +++ b/operations/helm/charts/alloy/README.md @@ -188,6 +188,7 @@ useful if just using the default DaemonSet isn't sufficient. | service.externalTrafficPolicy | string | `"Cluster"` | Value for external traffic policy. 'Cluster' or 'Local' | | service.internalTrafficPolicy | string | `"Cluster"` | Value for internal traffic policy. 'Cluster' or 'Local' | | service.nodePort | int | `31128` | NodePort port. Only takes effect when `service.type: NodePort` | +| service.trafficDistribution | string | `""` | Value for traffic distribution. 'PreferSameNode' or 'PreferSameZone' (k8s >= 1.34) | | service.type | string | `"ClusterIP"` | Service type | | serviceAccount.additionalLabels | object | `{}` | Additional labels to add to the created service account. | | serviceAccount.annotations | object | `{}` | Annotations to add to the created service account. | diff --git a/operations/helm/charts/alloy/templates/service.yaml b/operations/helm/charts/alloy/templates/service.yaml index 6064f99c1b4..155ab2ad97b 100644 --- a/operations/helm/charts/alloy/templates/service.yaml +++ b/operations/helm/charts/alloy/templates/service.yaml @@ -25,6 +25,11 @@ spec: externalTrafficPolicy: {{.Values.service.externalTrafficPolicy}} {{- end }} {{- end }} + {{- if semverCompare ">=1.34-0" .Capabilities.KubeVersion.Version }} + {{- with .Values.service.trafficDistribution }} + trafficDistribution: {{ . }} + {{- end }} + {{- end }} ports: - name: http-metrics {{- if eq .Values.service.type "NodePort" }} diff --git a/operations/helm/charts/alloy/values.yaml b/operations/helm/charts/alloy/values.yaml index 29997ca608b..e2a1194da47 100644 --- a/operations/helm/charts/alloy/values.yaml +++ b/operations/helm/charts/alloy/values.yaml @@ -522,6 +522,8 @@ service: internalTrafficPolicy: Cluster # -- Value for external traffic policy. 'Cluster' or 'Local' externalTrafficPolicy: Cluster + # -- Value for traffic distribution. 'PreferSameNode' or 'PreferSameZone' (k8s >= 1.34) + trafficDistribution: "" annotations: {} # cloud.google.com/load-balancer-type: Internal