This is an automated email from the ASF dual-hosted git repository.
hanahmily pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb-helm.git
The following commit(s) were added to refs/heads/master by this push:
new 507b3a5 Validate generated resource names to avoid Kubernetes 63-byte
limit errors (#67)
507b3a5 is described below
commit 507b3a5190f095e0f82ecbc39f36650e3c14fb64
Author: Gao Hongtao <[email protected]>
AuthorDate: Thu Jul 16 09:48:14 2026 +0800
Validate generated resource names to avoid Kubernetes 63-byte limit errors
(#67)
Adds banyandb.validateNames helper that checks all generated resource
names at helm template time. StatefulSet names are capped at 52 bytes
so the controller-revision-hash pod label stays within the 63-byte
Kubernetes limit. Validation runs once from a dedicated template
(chart/templates/validate-names.yaml) and values.yaml documents the
naming constraint.
---
chart/templates/_helpers.tpl | 63 +++++++++++++++++++++++++++++++++++++
chart/templates/validate-names.yaml | 18 +++++++++++
chart/values.yaml | 4 +++
3 files changed, 85 insertions(+)
diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl
index 4c0879c..6553b29 100644
--- a/chart/templates/_helpers.tpl
+++ b/chart/templates/_helpers.tpl
@@ -84,6 +84,69 @@ Create the name of the service account to use
{{- end }}
{{- end }}
+{{/*
+Validate a generated Kubernetes name does not exceed a byte limit.
+Usage: include "banyandb.validateNameLength" (dict "name" $name "limit" 63
"description" "..." "release" .Release.Name)
+*/}}
+{{- define "banyandb.validateNameLength" -}}
+{{- $name := .name -}}
+{{- $limit := .limit | default 63 -}}
+{{- $description := .description -}}
+{{- $release := .release -}}
+{{- if gt (len $name) (int $limit) }}
+{{- fail (printf "%s '%s' is %d bytes long, which exceeds the %d-byte
Kubernetes limit. Shorten the Helm release name '%s' or set a shorter
fullnameOverride." $description $name (len $name) $limit $release) }}
+{{- end }}
+{{- end }}
+
+{{/*
+Validate all generated resource names fit within Kubernetes limits.
+StatefulSet names must leave room for the controller-revision-hash suffix
+(<statefulset-name>-<10-char-hash>) so pod labels stay within 63 bytes.
+*/}}
+{{- define "banyandb.validateNames" -}}
+{{- $fullname := include "banyandb.fullname" . -}}
+{{- $release := .Release.Name -}}
+
+{{/* fullname itself */}}
+{{- include "banyandb.validateNameLength" (dict "name" $fullname "limit" 63
"description" "Generated fullname" "release" $release) }}
+
+{{/* Standalone mode */}}
+{{- if .Values.standalone.enabled }}
+{{- include "banyandb.validateNameLength" (dict "name" $fullname "limit" 52
"description" "Standalone StatefulSet name" "release" $release) }}
+{{- end }}
+
+{{/* Cluster liaison */}}
+{{- if and .Values.cluster.enabled .Values.cluster.liaison }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf "%s-liaison"
$fullname) "limit" 52 "description" "Liaison StatefulSet name" "release"
$release) }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf
"%s-liaison-headless" $fullname) "limit" 63 "description" "Liaison headless
service name" "release" $release) }}
+{{- end }}
+
+{{/* Cluster data roles */}}
+{{- if and .Values.cluster.enabled .Values.cluster.data }}
+{{- range $roleName, $roleConfig := .Values.cluster.data.roles }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf "%s-data-%s"
$fullname $roleName) "limit" 52 "description" (printf "Data StatefulSet name
for role '%s'" $roleName) "release" $release) }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf
"%s-data-%s-headless" $fullname $roleName) "limit" 63 "description" (printf
"Data headless service name for role '%s'" $roleName) "release" $release) }}
+{{- end }}
+{{- end }}
+
+{{/* Auth Secret */}}
+{{- if and .Values.auth.enabled (not .Values.auth.existingSecret) }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf "%s-auth"
$fullname) "limit" 63 "description" "Auth Secret name" "release" $release) }}
+{{- end }}
+
+{{/* Standalone UI */}}
+{{- if and .Values.cluster.enabled (eq .Values.cluster.ui.type "Standalone") }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf "%s-ui"
$fullname) "limit" 63 "description" "UI Deployment name" "release" $release) }}
+{{- end }}
+
+{{/* FODC proxy */}}
+{{- if and .Values.cluster.enabled .Values.cluster.fodc.enabled }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf "%s-fodc-proxy"
$fullname) "limit" 63 "description" "FODC proxy Deployment name" "release"
$release) }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf
"%s-fodc-proxy-grpc" $fullname) "limit" 63 "description" "FODC proxy gRPC
service name" "release" $release) }}
+{{- include "banyandb.validateNameLength" (dict "name" (printf
"%s-fodc-proxy-http" $fullname) "limit" 63 "description" "FODC proxy HTTP
service name" "release" $release) }}
+{{- end }}
+{{- end }}
+
{{/*
SchemaStoragePropertyServerEnv - injects property server env vars (data node
only)
Includes: repair cron, schema server parameters, schema server TLS
diff --git a/chart/templates/validate-names.yaml
b/chart/templates/validate-names.yaml
new file mode 100644
index 0000000..f831021
--- /dev/null
+++ b/chart/templates/validate-names.yaml
@@ -0,0 +1,18 @@
+{{/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+{{- include "banyandb.validateNames" . }}
diff --git a/chart/values.yaml b/chart/values.yaml
index 0585ee4..b93ec5a 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -21,6 +21,10 @@
##
## @param fullnameOverride Override the full name of the chart
+## Keep this short enough that generated resource names stay within Kubernetes
limits.
+## StatefulSet names must be <= 52 characters so the controller-revision-hash
pod label
+## does not exceed 63 bytes. The chart will fail at render time if any
generated name is
+## too long.
##
fullnameOverride: ""
## @param nameOverride Override the name of the chart