From 03df0e015de0fd137248c8261119d97e36711633 Mon Sep 17 00:00:00 2001 From: AttributeError Date: Thu, 5 Feb 2026 15:06:13 +0000 Subject: [PATCH 1/3] create new http-route template & update values file --- charts/kafka-ui/templates/http-route.yaml | 77 +++++++++++++++++++++++ charts/kafka-ui/values.yaml | 42 ++++++++++++- 2 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 charts/kafka-ui/templates/http-route.yaml diff --git a/charts/kafka-ui/templates/http-route.yaml b/charts/kafka-ui/templates/http-route.yaml new file mode 100644 index 0000000..6303968 --- /dev/null +++ b/charts/kafka-ui/templates/http-route.yaml @@ -0,0 +1,77 @@ +{{- range $routeIdx, $route := .Values.httpRoutes }} +{{- if $route.enabled }} +{{- if or (not $route.gatewayParentRefs) (lt (len $route.gatewayParentRefs) 1) }} +{{- fail (printf "httpRoute[%d].gatewayParentRefs must be defined and contain at least one gateway reference." $routeIdx) }} +{{- end -}} + +{{- if or (not $route.matches) (lt (len $route.matches) 1) }} +{{- fail (printf "httpRoute[%d].matches must be defined and contain at least one match element." $routeIdx) }} +{{- end -}} + +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ tpl ($route.nameOverride | default (printf "%s-%s" $.Chart.Name (first $route.gatewayParentRefs).name)) $ }}-httproute + labels: + {{- include "kafka-ui.labels" $ | nindent 4 }} + {{- if $route.labels }} + {{- tpl (toYaml $route.labels) $ | nindent 4 }} + {{- end }} + {{- if $route.annotations }} + annotations: + {{- tpl (toYaml $route.annotations) $ | nindent 4 }} + {{- end }} +spec: + parentRefs: + {{- range $idx, $parentRef := $route.gatewayParentRefs }} + - group: gateway.networking.k8s.io + kind: Gateway + name: {{ tpl (required (printf "httpRoutes[%d].gatewayParentRefs[%d].name is required." $routeIdx $idx) $parentRef.name) $ }} + {{- if $parentRef.namespace }} + namespace: {{ tpl ($parentRef.namespace) $ }} + {{- end }} + {{- if $parentRef.sectionName }} + sectionName: {{ tpl ($parentRef.sectionName) $ }} + {{- end }} + {{- end }} + hostnames: + {{- tpl (toYaml $route.hostnames) $ | nindent 2 }} + rules: + - matches: + {{- tpl (toYaml $route.matches) $ | nindent 4 }} + {{- if $route.shouldRouteToService }} + backendRefs: + - group: '' + kind: Service + name: {{ include "kafka-ui.fullname" $ }} + port: {{ tpl ($.Values.service.port | default "80" | quote) $ }} + weight: 1 + {{- end }} + {{- if $route.filters }} + filters: + {{- if $route.shouldStripPath }} + - type: URLRewrite + urlRewrite: + path: + type: ReplacePrefixMatch + replacePrefixMatch: "/" + {{- end }} + {{- tpl (toYaml $route.filters) $ | nindent 4 }} + {{- else if $route.shouldStripPath }} + filters: + - type: URLRewrite + urlRewrite: + path: + type: ReplacePrefixMatch + replacePrefixMatch: "/" + {{- end }} + {{- if $route.timeouts }} + timeouts: + {{- tpl (toYaml $route.timeouts) $ | nindent 4 }} + {{- end }} +{{- /* Add a document separator if there is another item coming */ -}} +{{- if lt (add1 $routeIdx) (len $.Values.httpRoutes) -}} +--- +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/charts/kafka-ui/values.yaml b/charts/kafka-ui/values.yaml index e141787..3885b17 100644 --- a/charts/kafka-ui/values.yaml +++ b/charts/kafka-ui/values.yaml @@ -254,7 +254,47 @@ ingress: ## @param ingress.succeedingPaths [array] Http paths to add to the Ingress after the default path succeedingPaths: [] -## @param resources [object] Set Kafka-UI pod requests and limits for different resources like CPU or memory (essential for production workloads) + +## Kafka-UI HTTPRoute configuration +## ref: https://gateway-api.sigs.k8s.io/api-types/httproute/ +## +## @param httpRoutes [array] HTTPRoute resources to create. +httpRoutes: +## @param httpRoutes.enabled [string] Enable this HTTPRoute +- enabled: false + ## @param httpRoutes.hostnames [array] Hostnames to expose this HTTPRoute under + hostnames: + - "example.com" + ## @param httpRoutes.annotations [object] Additional annotations for the HTTPRoute resource. + annotations: {} + ## @param httpRoutes.labels [object] Labels for the HTTPRoute + labels: {} + ## @param httpRoutes.nameOverride [string] The name to give this HTTPRoute resource. + nameOverride: "" + ## @param httpRoutes.gatewayParentRefs [array] Which gateway to bind this HTTPRoute to + gatewayParentRefs: + ## @param httpRoutes.gatewayParentRefs.name [string] The name of the gateway to bind this HTTPRoute to. + - name: "gateway-example" + ## @param httpRoutes.gatewayParentRefs.namespace [string] The namespace that the gateway is defined under. + namespace: "gateway-example" + ## @param httpRoutes.gatewayParentRefs.sectionName [string] The section name of the listener to bind to on the Gateway. + sectionName: "http-listener" + ## @param httpRoutes.shouldStripPath [string] Whether to strip the path before sending the request to the service. + shouldStripPath: true + ## @param httpRoutes.shouldRouteToService [string] Whether this HTTPRoute should route to the backend service. + shouldRouteToService: true + ## @param httpRoutes.matches [array] HTTPRoute match rules, ref: https://gateway-api.sigs.k8s.io/reference/spec/#httproutematch. + matches: + ## @param httpRoutes.matches.path [object] Match the route based on this path structure. + - path: + ## @param httpRoutes.matches.path.type [string] One of Exact, PathPrefix or RegularExpression. + type: PathPrefix + ## @param httpRoutes.matches.path.value [string] The path to match on after the host. + value: "/kafka-ui" + ## @param httpRoutes.filters [array] HTTPRoute filters, ref: https://gateway-api.sigs.k8s.io/reference/spec/#httproutefilter. + filters: [] + ## @param httpRoutes.timeouts [object] HTTPRoute timeouts, ref: https://gateway-api.sigs.k8s.io/reference/spec/#httproutetimeouts. + timeouts: {} ## @section Scheduling From 05b5c9323675207c3cfc328aaf808c935950929d Mon Sep 17 00:00:00 2001 From: AttributeError Date: Fri, 6 Mar 2026 10:17:01 +0000 Subject: [PATCH 2/3] fix incorrect pipeline chaining resulting in port always being 0 --- charts/kafka-ui/templates/http-route.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/kafka-ui/templates/http-route.yaml b/charts/kafka-ui/templates/http-route.yaml index 6303968..9383ddf 100644 --- a/charts/kafka-ui/templates/http-route.yaml +++ b/charts/kafka-ui/templates/http-route.yaml @@ -44,7 +44,7 @@ spec: - group: '' kind: Service name: {{ include "kafka-ui.fullname" $ }} - port: {{ tpl ($.Values.service.port | default "80" | quote) $ }} + port: {{ (tpl (default "80" ($.Values.service.port)) $) | int }} weight: 1 {{- end }} {{- if $route.filters }} From 162ad27b36f4d78722236718bed33fafba278988 Mon Sep 17 00:00:00 2001 From: AttributeError Date: Fri, 29 May 2026 11:27:15 +0100 Subject: [PATCH 3/3] fix: resolve coderabbit comments --- charts/kafka-ui/templates/http-route.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/charts/kafka-ui/templates/http-route.yaml b/charts/kafka-ui/templates/http-route.yaml index 9383ddf..b884baa 100644 --- a/charts/kafka-ui/templates/http-route.yaml +++ b/charts/kafka-ui/templates/http-route.yaml @@ -34,8 +34,10 @@ spec: sectionName: {{ tpl ($parentRef.sectionName) $ }} {{- end }} {{- end }} + {{- with $route.hostnames }} hostnames: - {{- tpl (toYaml $route.hostnames) $ | nindent 2 }} + {{- tpl (toYaml .) $ | nindent 2 }} + {{- end }} rules: - matches: {{- tpl (toYaml $route.matches) $ | nindent 4 }} @@ -44,7 +46,7 @@ spec: - group: '' kind: Service name: {{ include "kafka-ui.fullname" $ }} - port: {{ (tpl (default "80" ($.Values.service.port)) $) | int }} + port: {{ (tpl (default "80" (toString $.Values.service.port)) $) | int }} weight: 1 {{- end }} {{- if $route.filters }}