This is an automated email from the ASF dual-hosted git repository.

liuhan pushed a commit to branch node-registry
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb-helm.git

commit d579d3a9f80aa87ef0bc3e218b0c590559622554
Author: mrproliu <[email protected]>
AuthorDate: Tue Jan 6 14:14:07 2026 -0800

    Support node discovery configuration in cluster mode
---
 CHANGES.md                                       |   7 ++
 chart/templates/_helpers.tpl                     | 118 +++++++++++++++++++++++
 chart/templates/cluster_data_statefulset.yaml    |   4 +-
 chart/templates/cluster_liaison_statefulset.yaml |   1 +
 chart/values.yaml                                |  50 ++++++++++
 5 files changed, 179 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index da5aac9..7473d59 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,13 @@ Changes by Version
 ==================
 Release Notes.
 
+0.5.4
+-----------------
+
+#### Features
+
+-  Support configure node discovery in cluster mode.
+
 0.5.3
 -----------------
 
diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl
index 5d8f674..4063051 100644
--- a/chart/templates/_helpers.tpl
+++ b/chart/templates/_helpers.tpl
@@ -124,3 +124,121 @@ Generate data node names list for "hot" role only
 {{- end }}
 {{- $dataNodes | join "," -}}
 {{- end }}
+
+{{/*
+Generate DNS SRV address for a component
+Format: _<port-name>._<proto>.<service-name>.<namespace>.svc.cluster.local
+*/}}
+{{- define "banyandb.dnsSrvAddress" -}}
+{{- $component := .component }}
+{{- $role := .role }}
+{{- $fullname := include "banyandb.fullname" .root }}
+{{- $namespace := .root.Release.Namespace }}
+{{- $serviceName := "" }}
+{{- $portName := "grpc" }}
+{{- if eq $component "liaison" }}
+  {{- $serviceName = printf "%s-liaison-headless" $fullname }}
+  {{- $portName = "internal-grpc" }}
+{{- else if eq $component "data" }}
+  {{- $serviceName = printf "%s-data-%s-headless" $fullname $role }}
+{{- end }}
+{{- printf "_%s._tcp.%s.%s.svc.cluster.local" $portName $serviceName 
$namespace }}
+{{- end }}
+
+{{/*
+Generate all DNS SRV addresses for node discovery
+Returns comma-separated list of SRV addresses
+*/}}
+{{- define "banyandb.allDnsSrvAddresses" -}}
+{{- $addresses := list }}
+{{- /* Add liaison SRV address */}}
+{{- $liaisonSrv := include "banyandb.dnsSrvAddress" (dict "root" . "component" 
"liaison") }}
+{{- $addresses = append $addresses $liaisonSrv }}
+{{- /* Add data node SRV addresses for each role */}}
+{{- range $roleName, $roleConfig := .Values.cluster.data.roles }}
+  {{- $dataSrv := include "banyandb.dnsSrvAddress" (dict "root" $ "component" 
"data" "role" $roleName) }}
+  {{- $addresses = append $addresses $dataSrv }}
+{{- end }}
+{{- $addresses | join "," }}
+{{- end }}
+
+{{/*
+Generate node registry environment variables for a component
+*/}}
+{{- define "banyandb.nodeRegistryEnv" -}}
+{{- $config := .root.Values.cluster.nodeRegistry | default dict }}
+{{- $mode := $config.mode | default "etcd" }}
+
+- name: BYDB_NODE_DISCOVERY_MODE
+  value: {{ $mode | quote }}
+
+{{- if eq $mode "etcd" }}
+{{- /* Etcd mode configuration */}}
+{{- if $config.etcd.namespace }}
+- name: BYDB_NAMESPACE
+  value: {{ $config.etcd.namespace | quote }}
+{{- end }}
+{{- if $config.etcd.nodeRegistryTimeout }}
+- name: BYDB_NODE_REGISTRY_TIMEOUT
+  value: {{ $config.etcd.nodeRegistryTimeout | quote }}
+{{- end }}
+{{- if $config.etcd.fullSyncInterval }}
+- name: BYDB_ETCD_FULL_SYNC_INTERVAL
+  value: {{ $config.etcd.fullSyncInterval | quote }}
+{{- end }}
+
+{{- else if eq $mode "dns" }}
+{{- /* DNS mode configuration */}}
+{{- /* Always auto-generate SRV addresses for all data nodes */}}
+{{- $srvAddresses := include "banyandb.allDnsSrvAddresses" .root }}
+{{- if $srvAddresses }}
+- name: BYDB_NODE_DISCOVERY_DNS_SRV_ADDRESSES
+  value: {{ $srvAddresses | quote }}
+{{- end }}
+
+{{- if $config.dns.fetchInitInterval }}
+- name: BYDB_NODE_DISCOVERY_DNS_FETCH_INIT_INTERVAL
+  value: {{ $config.dns.fetchInitInterval | quote }}
+{{- end }}
+{{- if $config.dns.fetchInitDuration }}
+- name: BYDB_NODE_DISCOVERY_DNS_FETCH_INIT_DURATION
+  value: {{ $config.dns.fetchInitDuration | quote }}
+{{- end }}
+{{- if $config.dns.fetchInterval }}
+- name: BYDB_NODE_DISCOVERY_DNS_FETCH_INTERVAL
+  value: {{ $config.dns.fetchInterval | quote }}
+{{- end }}
+{{- if $config.dns.grpcTimeout }}
+- name: BYDB_NODE_DISCOVERY_GRPC_TIMEOUT
+  value: {{ $config.dns.grpcTimeout | quote }}
+{{- end }}
+
+{{- /* Auto-generate TLS configuration based on existing gRPC TLS settings */}}
+{{- $tlsEnabled := false }}
+{{- $caCerts := list }}
+{{- /* Check liaison TLS */}}
+{{- if and .root.Values.cluster.liaison .root.Values.cluster.liaison.tls 
.root.Values.cluster.liaison.tls.grpcSecretName }}
+  {{- $tlsEnabled = true }}
+  {{- $caCerts = append $caCerts (printf "/etc/tls/%s/ca.crt" 
.root.Values.cluster.liaison.tls.grpcSecretName) }}
+{{- end }}
+{{- /* Check data nodes TLS for each role */}}
+{{- range $roleName, $roleConfig := .root.Values.cluster.data.roles }}
+  {{- if and $roleConfig.tls $roleConfig.tls.grpcSecretName }}
+    {{- $tlsEnabled = true }}
+    {{- $caCerts = append $caCerts (printf "/etc/tls/%s/ca.crt" 
$roleConfig.tls.grpcSecretName) }}
+  {{- else if and $.root.Values.cluster.data.nodeTemplate.tls 
$.root.Values.cluster.data.nodeTemplate.tls.grpcSecretName }}
+    {{- $tlsEnabled = true }}
+    {{- $caCerts = append $caCerts (printf "/etc/tls/%s/ca.crt" 
$.root.Values.cluster.data.nodeTemplate.tls.grpcSecretName) }}
+  {{- end }}
+{{- end }}
+
+{{- if $tlsEnabled }}
+- name: BYDB_NODE_DISCOVERY_DNS_TLS
+  value: "true"
+{{- if $caCerts }}
+- name: BYDB_NODE_DISCOVERY_DNS_CA_CERTS
+  value: {{ $caCerts | join "," | quote }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end }}
diff --git a/chart/templates/cluster_data_statefulset.yaml 
b/chart/templates/cluster_data_statefulset.yaml
index 9db3538..3d3871c 100644
--- a/chart/templates/cluster_data_statefulset.yaml
+++ b/chart/templates/cluster_data_statefulset.yaml
@@ -193,6 +193,7 @@ spec:
             {{- else }}
             {{- include "banyandb.etcdEndpoints" $ | nindent 12 }}
             {{- end }}
+            {{- include "banyandb.nodeRegistryEnv" (dict "root" $) | nindent 
12 }}
             {{- $mergedEnv := concat $.Values.cluster.data.nodeTemplate.env 
$roleConfig.env }}
             {{- range $env := $mergedEnv }}
             - name: {{ $env.name }}
@@ -362,7 +363,8 @@ spec:
               value: "{{- $.Values.cluster.etcdEndpoints | join "," -}}"
             {{- else }}
             {{- include "banyandb.etcdEndpoints" $ | nindent 12 }}
-            {{- end }} 
+            {{- end }}
+            {{- include "banyandb.nodeRegistryEnv" (dict "root" $) | nindent 
12 }}
           command:
             - "/lifecycle"
             - "--schedule={{ $roleConfig.lifecycleSidecar.schedule }}"
diff --git a/chart/templates/cluster_liaison_statefulset.yaml 
b/chart/templates/cluster_liaison_statefulset.yaml
index 705e903..b903645 100644
--- a/chart/templates/cluster_liaison_statefulset.yaml
+++ b/chart/templates/cluster_liaison_statefulset.yaml
@@ -164,6 +164,7 @@ spec:
             {{- else }}
             {{- include "banyandb.etcdEndpoints" . | nindent 12 }}
             {{- end }}
+            {{- include "banyandb.nodeRegistryEnv" (dict "root" .) | nindent 
12 }}
             {{- if include "banyandb.hasDataNodeListValue" . }}
             - name: BYDB_DATA_NODE_LIST
               value: "{{ include "banyandb.dataNodeListValue" . }}"
diff --git a/chart/values.yaml b/chart/values.yaml
index 90f425e..9acd285 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -248,6 +248,56 @@ cluster:
   ## @param cluster.etcdEndpoints List of etcd endpoints
   ##
   etcdEndpoints: []
+
+  ## @section Node Registry Configuration for Service Discovery
+  ##
+  nodeRegistry:
+    ## @param cluster.nodeRegistry.mode Node discovery mode (etcd, dns)
+    ## Default: etcd
+    ##
+    mode: "etcd"
+
+    ## @section Etcd Mode Configuration
+    ##
+    etcd:
+      ## @param cluster.nodeRegistry.etcd.namespace Namespace in etcd for node 
registration
+      ## Default: banyandb
+      ##
+      namespace: "banyandb"
+
+      ## @param cluster.nodeRegistry.etcd.nodeRegistryTimeout Timeout for node 
registration
+      ## Default: 2m
+      ##
+      nodeRegistryTimeout: "2m"
+
+      ## @param cluster.nodeRegistry.etcd.fullSyncInterval Interval for full 
state synchronization
+      ## Default: 30m
+      ##
+      fullSyncInterval: "30m"
+
+    ## @section DNS Mode Configuration
+    ##
+    dns:
+      ## @param cluster.nodeRegistry.dns.fetchInitInterval Query interval 
during initialization
+      ## Default: 5s
+      ##
+      fetchInitInterval: "5s"
+
+      ## @param cluster.nodeRegistry.dns.fetchInitDuration Duration of 
initialization phase
+      ## Default: 5m
+      ##
+      fetchInitDuration: "5m"
+
+      ## @param cluster.nodeRegistry.dns.fetchInterval Query interval after 
initialization
+      ## Default: 15s
+      ##
+      fetchInterval: "15s"
+
+      ## @param cluster.nodeRegistry.dns.grpcTimeout Timeout for gRPC metadata 
fetch
+      ## Default: 5s
+      ##
+      grpcTimeout: "5s"
+
   ## @section Configuration for liaison component
   ##
   liaison:

Reply via email to