From bec5dcecec222d4222777cd7e39adf21a44ed03b Mon Sep 17 00:00:00 2001 From: Vlad Safronov Date: Fri, 20 Dec 2024 21:32:53 +0300 Subject: [PATCH] Add an external controller metrics service Signed-off-by: Vlad Safronov --- .../templates/external-metrics-service.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 charts/piraeus/templates/external-metrics-service.yaml diff --git a/charts/piraeus/templates/external-metrics-service.yaml b/charts/piraeus/templates/external-metrics-service.yaml new file mode 100644 index 00000000..91f07cd5 --- /dev/null +++ b/charts/piraeus/templates/external-metrics-service.yaml @@ -0,0 +1,39 @@ +{{ if (.Values.externalController).url }} +--- +{{- $url := urlParse .Values.externalController.url -}} +{{- $host := regexSplit ":" (get $url "host") -1 -}} +{{- $ipAddr := index $host 0 -}} +{{- $port := index $host 1 }} +apiVersion: v1 +kind: Endpoints +metadata: + name: {{ include "piraeus-operator.fullname" . }}-external-controller-metrics-service + labels: + {{- include "piraeus-operator.labels" . | nindent 4 }} + app.kubernetes.io/component: linstor-external-controller +subsets: + - addresses: + - ip: {{ $ipAddr }} + ports: + - name: metrics + port: {{ $port }} + protocol: TCP +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "piraeus-operator.fullname" . }}-external-controller-metrics-service + labels: + {{- include "piraeus-operator.labels" . | nindent 4 }} + app.kubernetes.io/component: linstor-external-controller +spec: + type: ExternalName + externalName: {{ $ipAddr }} + clusterIP: "" + selector: + {{- include "piraeus-operator.selectorLabels" . | nindent 4 }} + ports: + - name: metrics + port: {{ $port }} + targetPort: {{ $port }} +{{ end }}