From d48e722ee854376aace5184df74aa3fb842de18a Mon Sep 17 00:00:00 2001 From: Costis Date: Tue, 17 Sep 2024 13:59:26 +0300 Subject: [PATCH] LoadBalancer cannot simultaneously support TCP and UDP protocols Signed-off-by: Costis --- charts/tempo/Chart.yaml | 2 +- charts/tempo/README.md | 7 ++- charts/tempo/templates/_ports.tpl | 88 +++++++++++++++++++++++++++++ charts/tempo/templates/service.yaml | 65 +++++---------------- charts/tempo/values.yaml | 6 ++ 5 files changed, 115 insertions(+), 53 deletions(-) create mode 100644 charts/tempo/templates/_ports.tpl diff --git a/charts/tempo/Chart.yaml b/charts/tempo/Chart.yaml index 352a07e83e..969a8112d9 100644 --- a/charts/tempo/Chart.yaml +++ b/charts/tempo/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: tempo description: Grafana Tempo Single Binary Mode type: application -version: 1.10.3 +version: 1.10.4 appVersion: 2.5.0 engine: gotpl home: https://grafana.net diff --git a/charts/tempo/README.md b/charts/tempo/README.md index e34b011ff1..f8913e0363 100644 --- a/charts/tempo/README.md +++ b/charts/tempo/README.md @@ -1,6 +1,6 @@ # tempo -![Version: 1.10.3](https://img.shields.io/badge/Version-1.10.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.5.0](https://img.shields.io/badge/AppVersion-2.5.0-informational?style=flat-square) +![Version: 1.10.4](https://img.shields.io/badge/Version-1.10.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.5.0](https://img.shields.io/badge/AppVersion-2.5.0-informational?style=flat-square) Grafana Tempo Single Binary Mode @@ -41,6 +41,9 @@ Grafana Tempo Single Binary Mode | service.labels | object | `{}` | | | service.targetPort | string | `""` | | | service.type | string | `"ClusterIP"` | | +| service.clusterIP | string | `""` | | +| service.loadBalancerIP | string | `""` | | +| service.protocol | string | `"TCP"` | If service type is LoadBalancer, the exposed protocol can be "UDP", "TCP" or "UDP,TCP" | | serviceAccount.annotations | object | `{}` | Annotations for the service account | | serviceAccount.automountServiceAccountToken | bool | `true` | | | serviceAccount.create | bool | `true` | Specifies whether a ServiceAccount should be created | @@ -148,4 +151,4 @@ and [1.5 -> 2.0 upgrade guide](https://grafana.com/docs/tempo/latest/setup/upgra Upgrading from pre 0.7.0 will, by default, move your trace storage from `/tmp/tempo/traces` to `/var/tempo/traces`. This will cause Tempo to lose trace history. If you would like to retain history just copy the contents from the -old folder to the new. \ No newline at end of file +old folder to the new. diff --git a/charts/tempo/templates/_ports.tpl b/charts/tempo/templates/_ports.tpl new file mode 100644 index 0000000000..e65378489d --- /dev/null +++ b/charts/tempo/templates/_ports.tpl @@ -0,0 +1,88 @@ +{{/* ~=~=~ Partial Templates of exposed Ports ~=~=~ */}} + +{{/* UDP sockets */}} +{{- define "tempo.udp"}} +{{- $endpoint := .Values.tempo.receivers.jaeger.protocols.thrift_compact }} +{{- with $endpoint.endpoint }} +{{- $port := regexSplit ":" . -1 | last }} +- name: tempo-jaeger-thrift-compact + port: {{ $port }} + protocol: UDP + targetPort: 6831 +{{- end }} +{{- $endpoint := .Values.tempo.receivers.jaeger.protocols.thrift_binary }} +{{- with $endpoint.endpoint }} +{{- $port := regexSplit ":" . -1 | last }} +- name: tempo-jaeger-thrift-binary + port: {{ $port }} + protocol: UDP + targetPort: 6832 +{{- end }} +{{- /* end of define */}} +{{- end }} + +{{/* TCP sockets */}} +{{- define "tempo.tcp"}} +- name: tempo-prom-metrics + port: 3100 + protocol: TCP + targetPort: 3100 +{{- if .Values.tempoQuery.enabled }} +- name: jaeger-metrics + port: 16687 + protocol: TCP + targetPort: 16687 +- name: tempo-query-jaeger-ui + port: {{ .Values.tempoQuery.service.port }} + targetPort: {{ .Values.tempoQuery.service.port }} +{{- end }} +{{- $endpoint := .Values.tempo.receivers.jaeger.protocols.thrift_http }} +{{- with $endpoint.endpoint }} +{{- $port := regexSplit ":" . -1 | last }} +- name: tempo-jaeger-thrift-http + port: {{ $port }} + protocol: TCP + targetPort: 14268 +{{- end }} +{{- $endpoint := .Values.tempo.receivers.jaeger.protocols.grpc }} +{{- with $endpoint.endpoint }} +{{- $port := regexSplit ":" . -1 | last }} +- name: grpc-tempo-jaeger + port: {{ $port }} + protocol: TCP + targetPort: 14250 +{{- end }} +- name: tempo-zipkin + port: 9411 + protocol: TCP + targetPort: 9411 +- name: tempo-otlp-legacy + port: 55680 + protocol: TCP + targetPort: 55680 +- name: tempo-otlp-http-legacy + port: 55681 + protocol: TCP + targetPort: 55681 +{{- $endpoint := .Values.tempo.receivers.otlp.protocols.grpc }} +{{- with $endpoint.endpoint }} +{{- $port := regexSplit ":" . -1 | last }} +- name: grpc-tempo-otlp + port: {{ $port }} + protocol: TCP + targetPort: 4317 +{{- end }} +{{- $endpoint := .Values.tempo.receivers.otlp.protocols.http }} +{{- with $endpoint.endpoint }} +{{- $port := regexSplit ":" . -1 | last }} +- name: tempo-otlp-http + port: {{ $port }} + protocol: TCP + targetPort: 4318 +{{- end }} +- name: tempo-opencensus + port: 55678 + protocol: TCP + targetPort: 55678 +{{- /* end of define */}} +{{- end }} \ No newline at end of file diff --git a/charts/tempo/templates/service.yaml b/charts/tempo/templates/service.yaml index 4e23e336d4..9c607d9354 100644 --- a/charts/tempo/templates/service.yaml +++ b/charts/tempo/templates/service.yaml @@ -1,3 +1,4 @@ + apiVersion: v1 kind: Service metadata: @@ -32,56 +33,20 @@ spec: {{- end }} {{- end }} ports: - - name: tempo-prom-metrics - port: 3100 - targetPort: 3100 - {{- if .Values.tempoQuery.enabled }} - - name: jaeger-metrics - port: 16687 - targetPort: 16687 - - name: tempo-query-jaeger-ui - port: {{ .Values.tempoQuery.service.port }} - targetPort: {{ .Values.tempoQuery.service.port }} + {{- if (eq .Values.service.type "LoadBalancer") }} + {{- $protocol := .Values.service.protocol | default "TCP" }} + {{- if contains "UDP" $protocol }} + {{- include "tempo.udp" . | indent 2 }} + {{- end }} + {{- if contains "TCP" $protocol }} + {{- include "tempo.tcp" . | indent 2 }} + {{- end }} + {{- else }} + {{- include "tempo.udp" . | indent 2 }} + {{- include "tempo.tcp" . | indent 2 }} {{- end }} - - name: tempo-jaeger-thrift-compact - port: 6831 - protocol: UDP - targetPort: 6831 - - name: tempo-jaeger-thrift-binary - port: 6832 - protocol: UDP - targetPort: 6832 - - name: tempo-jaeger-thrift-http - port: 14268 - protocol: TCP - targetPort: 14268 - - name: grpc-tempo-jaeger - port: 14250 - protocol: TCP - targetPort: 14250 - - name: tempo-zipkin - port: 9411 - protocol: TCP - targetPort: 9411 - - name: tempo-otlp-legacy - port: 55680 - protocol: TCP - targetPort: 55680 - - name: tempo-otlp-http-legacy - port: 55681 - protocol: TCP - targetPort: 4318 - - name: grpc-tempo-otlp - port: 4317 - protocol: TCP - targetPort: 4317 - - name: tempo-otlp-http - port: 4318 - protocol: TCP - targetPort: 4318 - - name: tempo-opencensus - port: 55678 - protocol: TCP - targetPort: 55678 selector: {{- include "tempo.selectorLabels" . | nindent 4 }} + + + diff --git a/charts/tempo/values.yaml b/charts/tempo/values.yaml index 91bebb1685..c828b24f2b 100644 --- a/charts/tempo/values.yaml +++ b/charts/tempo/values.yaml @@ -257,6 +257,12 @@ serviceAccount: service: type: ClusterIP + # type: LoadBalancer + # clusterIP: "" + # loadBalancerIP: "" + # -- If service type is LoadBalancer, the exposed protocol can either be UDP or TCP + # protocol: "TCP" + annotations: {} labels: {} targetPort: ""