Skip to content

Commit 13f3d74

Browse files
Merge pull request #50 from openlit/fix/controller-service-name-resolution
fix(controller): resolve correct parent service name in auto-derived …
2 parents fccdbff + b48a373 commit 13f3d74

7 files changed

Lines changed: 71 additions & 14 deletions

File tree

charts/openlit-controller/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: openlit-controller
33
description: OpenLIT Controller - Zero-code LLM and Agent observability using eBPF
44
type: application
5-
version: 0.1.0
5+
version: 0.1.1
66
appVersion: "0.1.0"
77
home: https://openlit.io
88
sources:

charts/openlit-controller/templates/_helpers.tpl

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,65 @@ ServiceAccount name
6363
{{- end }}
6464
{{- end }}
6565

66+
{{/*
67+
Resolve the OpenLIT Kubernetes service name.
68+
69+
Priority (highest to lowest):
70+
1. config.openlitServiceName — explicit override for standalone deployments.
71+
2. Auto-derive — mirrors the parent "openlit" chart's fullname logic so the
72+
name is correct when deployed as a subchart regardless of release name.
73+
*/}}
74+
{{- define "openlit-controller.parentServiceName" -}}
75+
{{- if .Values.config.openlitServiceName }}
76+
{{- .Values.config.openlitServiceName | trunc 63 | trimSuffix "-" }}
77+
{{- else }}
78+
{{- $parentName := "openlit" }}
79+
{{- if contains $parentName .Release.Name }}
80+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
81+
{{- else }}
82+
{{- printf "%s-%s" .Release.Name $parentName | trunc 63 | trimSuffix "-" }}
83+
{{- end }}
84+
{{- end }}
85+
{{- end }}
86+
87+
{{/*
88+
Build a host string for the parent OpenLIT service.
89+
90+
When config.openlitNamespace is set (standalone / cross-namespace), produce a
91+
fully-qualified DNS name. Otherwise use the short service name (same namespace).
92+
*/}}
93+
{{- define "openlit-controller.parentServiceHost" -}}
94+
{{- $svc := include "openlit-controller.parentServiceName" . }}
95+
{{- if .Values.config.openlitNamespace }}
96+
{{- printf "%s.%s.svc.cluster.local" $svc .Values.config.openlitNamespace }}
97+
{{- else }}
98+
{{- $svc }}
99+
{{- end }}
100+
{{- end }}
101+
66102
{{/*
67103
Resolve the OpenLIT dashboard URL.
68-
When config.openlitUrl is set, use it directly.
69-
Otherwise, derive from the parent chart's release name (subchart mode).
104+
105+
Priority: explicit config.openlitUrl > auto-derived from service name + namespace.
70106
*/}}
71107
{{- define "openlit-controller.openlitUrl" -}}
72108
{{- if .Values.config.openlitUrl }}
73109
{{- .Values.config.openlitUrl }}
74110
{{- else }}
75-
{{- printf "http://%s-openlit:%s" .Release.Name "3000" }}
111+
{{- printf "http://%s:%s" (include "openlit-controller.parentServiceHost" .) "3000" }}
76112
{{- end }}
77113
{{- end }}
78114

79115
{{/*
80116
Resolve the OTLP endpoint.
81-
When config.otlpEndpoint is set, use it directly.
82-
Otherwise, derive from the parent chart's release name (subchart mode).
117+
118+
Priority: explicit config.otlpEndpoint > auto-derived from service name + namespace.
83119
*/}}
84120
{{- define "openlit-controller.otlpEndpoint" -}}
85121
{{- if .Values.config.otlpEndpoint }}
86122
{{- .Values.config.otlpEndpoint }}
87123
{{- else }}
88-
{{- printf "http://%s-openlit:%s" .Release.Name "4318" }}
124+
{{- printf "http://%s:%s" (include "openlit-controller.parentServiceHost" .) "4318" }}
89125
{{- end }}
90126
{{- end }}
91127

charts/openlit-controller/values.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,31 @@ fullnameOverride: ""
1919
# are auto-derived from the parent release name. Override only when using an
2020
# external OpenLIT instance or deploying the controller standalone.
2121
config:
22-
# URL of the OpenLIT dashboard (required when standalone)
22+
# Full URL of the OpenLIT dashboard. Highest priority override — when set,
23+
# openlitServiceName and openlitNamespace are ignored for this field.
24+
# Example: "http://openlit.monitoring.svc.cluster.local:3000"
2325
openlitUrl: ""
24-
# OTLP HTTP endpoint for traces and metrics (required when standalone)
26+
# Full OTLP HTTP endpoint. Same override semantics as openlitUrl.
27+
# Example: "http://openlit.monitoring.svc.cluster.local:4318"
2528
otlpEndpoint: ""
29+
30+
# --- Standalone deployment helpers ---
31+
# When deploying the controller chart on its own (not as a subchart of
32+
# openlit), set openlitServiceName to the Kubernetes Service name of your
33+
# existing OpenLIT deployment. Optionally set openlitNamespace if OpenLIT
34+
# is in a different namespace.
35+
#
36+
# Examples (standalone in same namespace):
37+
# config.openlitServiceName: openlit
38+
#
39+
# Examples (standalone, cross-namespace):
40+
# config.openlitServiceName: openlit
41+
# config.openlitNamespace: monitoring
42+
#
43+
# When deployed as a subchart of the openlit chart, leave both empty —
44+
# the service name is auto-derived from the release.
45+
openlitServiceName: ""
46+
openlitNamespace: ""
2647
# How often the controller polls the dashboard
2748
pollInterval: "60s"
2849
# Deployment environment label

charts/openlit/Chart.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencies:
22
- name: openlit-controller
33
repository: file://../openlit-controller
4-
version: 0.1.0
5-
digest: sha256:c38e4d551a6786cf6f90da491c3ff6bb7e5511389972fbadd52021dc5ef83398
6-
generated: "2026-04-11T16:35:42.016301+05:30"
4+
version: 0.1.1
5+
digest: sha256:4ddad965d3914002694065413b7df1c67b230f326767e2d32367e28382e2e9b5
6+
generated: "2026-05-04T17:03:06.057969+05:30"

charts/openlit/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: openlit
33
description: A Helm chart for OpenLIT
44
type: application
5-
version: 1.19.0
5+
version: 1.19.1
66
appVersion: 1.19.0
77
icon: https://avatars.githubusercontent.com/u/149867240?s=200&v=4
88
home: https://openlit.io
@@ -22,7 +22,7 @@ maintainers:
2222
url: https://openlit.io
2323
dependencies:
2424
- name: openlit-controller
25-
version: "0.1.0"
25+
version: "0.1.1"
2626
repository: "file://../openlit-controller"
2727
condition: openlit-controller.enabled
2828
tags:
-3.22 KB
Binary file not shown.
3.83 KB
Binary file not shown.

0 commit comments

Comments
 (0)