From 7ba9119fa38bfac59f836bcdbd590c190f098f3e Mon Sep 17 00:00:00 2001 From: "v.oleynikov" Date: Wed, 14 Jan 2026 14:22:25 +0300 Subject: [PATCH] feat(_module_controller): add additionalPorts to webhook service Add optional additionalPorts parameter to helm_lib_module_webhook_service template for exposing additional ports in the service. Usage: $config := dict "additionalPorts" (list (dict "name" "metrics" "port" 8080 "targetPort" "metrics") ) ... --- charts/helm_lib/Chart.yaml | 2 +- charts/helm_lib/templates/_module_controller.tpl | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/charts/helm_lib/Chart.yaml b/charts/helm_lib/Chart.yaml index cc043e7..3eefefc 100644 --- a/charts/helm_lib/Chart.yaml +++ b/charts/helm_lib/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 type: library name: deckhouse_lib_helm -version: 1.69.1 +version: 1.69.2 description: "Helm utils template definitions for Deckhouse modules." diff --git a/charts/helm_lib/templates/_module_controller.tpl b/charts/helm_lib/templates/_module_controller.tpl index e4282a7..3e85539 100644 --- a/charts/helm_lib/templates/_module_controller.tpl +++ b/charts/helm_lib/templates/_module_controller.tpl @@ -315,6 +315,11 @@ spec: - fullname: name of the service (default: "webhooks") - selectorApp: app label for selector (default: "controller") - targetPort: target port name or number (default: "https") + - additionalPorts: list of additional ports (optional), each port is a dict with: + - name: port name (required) + - port: service port (required) + - targetPort: target port name or number (required) + - protocol: protocol (default: "TCP") */ -}} {{- define "helm_lib_module_webhook_service" }} {{- $context := index . 0 }} @@ -323,6 +328,7 @@ spec: {{- $fullname := $config.fullname | default "webhooks" }} {{- $selectorApp := $config.selectorApp | default "controller" }} {{- $targetPort := $config.targetPort | default "https" }} + {{- $additionalPorts := $config.additionalPorts }} --- apiVersion: v1 kind: Service @@ -337,6 +343,12 @@ spec: targetPort: {{ $targetPort }} protocol: TCP name: https + {{- range $additionalPorts }} + - name: {{ .name }} + port: {{ .port }} + targetPort: {{ .targetPort }} + protocol: {{ .protocol | default "TCP" }} + {{- end }} selector: app: {{ $selectorApp }} {{- end }}