Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,92 @@ imagePullSecrets:
{{- end -}}
{{- end -}}

{{/*
Component resource names.

By default every resource uses a fixed name, so a namespace can hold only one
Fluss release. Setting releaseScopedResourceNames=true prefixes every resource
with "fluss.fullname", which lets several releases coexist in one namespace.

Fixed names are the default so that an existing release keeps upgrading in
place: renaming a StatefulSet makes Helm replace it and orphans its
PersistentVolumeClaims. The default is expected to flip once the option has
been available for a release cycle.
*/}}

{{/*
Name of the coordinator StatefulSet and PodDisruptionBudget.
*/}}
{{- define "fluss.coordinator.fullname" -}}
{{- if .Values.releaseScopedResourceNames -}}
{{- printf "%s-coordinator-server" (include "fluss.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- "coordinator-server" -}}
{{- end -}}
{{- end -}}

{{/*
Name of the coordinator headless Service.
*/}}
{{- define "fluss.coordinator.serviceName" -}}
{{- if .Values.releaseScopedResourceNames -}}
{{- printf "%s-coordinator-server-hs" (include "fluss.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- "coordinator-server-hs" -}}
{{- end -}}
{{- end -}}

{{/*
Name of the coordinator metrics headless Service.
*/}}
{{- define "fluss.coordinator.metricsServiceName" -}}
{{- if .Values.releaseScopedResourceNames -}}
{{- printf "%s-coordinator-server-metrics-hs" (include "fluss.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-coordinator-server-metrics-hs" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{/*
Name of the tablet StatefulSet and PodDisruptionBudget.
*/}}
{{- define "fluss.tablet.fullname" -}}
{{- if .Values.releaseScopedResourceNames -}}
{{- printf "%s-tablet-server" (include "fluss.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- "tablet-server" -}}
{{- end -}}
{{- end -}}

{{/*
Name of the tablet headless Service.
*/}}
{{- define "fluss.tablet.serviceName" -}}
{{- if .Values.releaseScopedResourceNames -}}
{{- printf "%s-tablet-server-hs" (include "fluss.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- "tablet-server-hs" -}}
{{- end -}}
{{- end -}}

{{/*
Name of the tablet metrics headless Service.
*/}}
{{- define "fluss.tablet.metricsServiceName" -}}
{{- if .Values.releaseScopedResourceNames -}}
{{- printf "%s-tablet-server-metrics-hs" (include "fluss.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-tablet-server-metrics-hs" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{/*
Name of the ConfigMap holding server.yaml.
*/}}
{{- define "fluss.configMapName" -}}
{{- if .Values.releaseScopedResourceNames -}}
{{- printf "%s-conf-file" (include "fluss.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- "fluss-conf-file" -}}
{{- end -}}
{{- end -}}
19 changes: 19 additions & 0 deletions helm/templates/_validate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Usage:
{{- $messages = append $messages (include "fluss.security.validateError" .) -}}
{{- $messages = append $messages (include "fluss.metrics.validateError" .) -}}
{{- $messages = append $messages (include "fluss.secrets.validateError" .) -}}
{{- $messages = append $messages (include "fluss.names.validateError" .) -}}

{{- $messages = without $messages "" -}}
{{- join "\n" $messages -}}
Expand Down Expand Up @@ -73,3 +74,21 @@ Usage:
{{- end -}}

{{- end -}}

{{/*
Validates that the generated resource names stay within the 63 character limit
Kubernetes imposes on DNS labels. Only applies with releaseScopedResourceNames,
where the longest generated name adds 30 characters to the release prefix.
Usage:
include "fluss.names.validateError" .
*/}}
{{- define "fluss.names.validateError" -}}
{{- if .Values.releaseScopedResourceNames -}}
{{- $prefix := include "fluss.fullname" . -}}
{{- $longestSuffix := 30 -}}
{{- $maxPrefix := sub 63 $longestSuffix -}}
{{- if gt (len $prefix) (int $maxPrefix) -}}
{{- printf "resource name prefix %q is %d characters, but generated names must stay within 63 characters. Use a release name of at most %d characters, or set fullnameOverride." $prefix (len $prefix) (int $maxPrefix) -}}
{{- end -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: fluss-conf-file
name: {{ include "fluss.configMapName" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
data:
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/pdb-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: coordinator-server
name: {{ include "fluss.coordinator.fullname" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/pdb-tablet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: tablet-server
name: {{ include "fluss.tablet.fullname" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
spec:
Expand Down
8 changes: 4 additions & 4 deletions helm/templates/sts-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: coordinator-server
name: {{ include "fluss.coordinator.fullname" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
{{- with .Values.coordinator.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
serviceName: coordinator-server-hs
serviceName: {{ include "fluss.coordinator.serviceName" . }}
replicas: {{ .Values.coordinator.numberOfReplicas }}
updateStrategy:
type: RollingUpdate
Expand Down Expand Up @@ -125,7 +125,7 @@ spec:
cp /opt/conf/server.yaml $FLUSS_HOME/conf && \

BIND_LISTENERS="INTERNAL://${POD_IP}:{{ .Values.listeners.internal.port }}, CLIENT://${POD_IP}:{{ .Values.listeners.client.port }}" && \
ADVERTISED_LISTENERS="CLIENT://${POD_NAME}.coordinator-server-hs.${POD_NAMESPACE}.svc.cluster.local:{{ .Values.listeners.client.port }}" && \
ADVERTISED_LISTENERS="CLIENT://${POD_NAME}.{{ include "fluss.coordinator.serviceName" . }}.${POD_NAMESPACE}.svc.cluster.local:{{ .Values.listeners.client.port }}" && \

echo "" >> $FLUSS_HOME/conf/server.yaml && \
echo "bind.listeners: ${BIND_LISTENERS}" >> $FLUSS_HOME/conf/server.yaml && \
Expand Down Expand Up @@ -167,7 +167,7 @@ spec:
volumes:
- name: fluss-conf
configMap:
name: fluss-conf-file
name: {{ include "fluss.configMapName" . }}
{{- if not .Values.coordinator.storage.enabled }}
- name: data
emptyDir: {}
Expand Down
8 changes: 4 additions & 4 deletions helm/templates/sts-tablet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: tablet-server
name: {{ include "fluss.tablet.fullname" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
{{- with .Values.tablet.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
serviceName: tablet-server-hs
serviceName: {{ include "fluss.tablet.serviceName" . }}
replicas: {{ .Values.tablet.numberOfReplicas }}
updateStrategy:
type: RollingUpdate
Expand Down Expand Up @@ -121,7 +121,7 @@ spec:
cp /opt/conf/server.yaml $FLUSS_HOME/conf && \

BIND_LISTENERS="INTERNAL://${POD_IP}:{{ .Values.listeners.internal.port }}, CLIENT://${POD_IP}:{{ .Values.listeners.client.port }}" && \
ADVERTISED_LISTENERS="CLIENT://${POD_NAME}.tablet-server-hs.${POD_NAMESPACE}.svc.cluster.local:{{ .Values.listeners.client.port }}" && \
ADVERTISED_LISTENERS="CLIENT://${POD_NAME}.{{ include "fluss.tablet.serviceName" . }}.${POD_NAMESPACE}.svc.cluster.local:{{ .Values.listeners.client.port }}" && \

echo "" >> $FLUSS_HOME/conf/server.yaml && \
echo "tablet-server.id: ${FLUSS_SERVER_ID}" >> $FLUSS_HOME/conf/server.yaml && \
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
volumes:
- name: fluss-conf
configMap:
name: fluss-conf-file
name: {{ include "fluss.configMapName" . }}
{{- if not .Values.tablet.storage.enabled }}
- name: data
emptyDir: {}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/svc-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
apiVersion: v1
kind: Service
metadata:
name: coordinator-server-hs
name: {{ include "fluss.coordinator.serviceName" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
app.kubernetes.io/component: coordinator
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/svc-metrics-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-coordinator-server-metrics-hs
name: {{ include "fluss.coordinator.metricsServiceName" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
app.kubernetes.io/component: metrics
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/svc-metrics-tablet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-tablet-server-metrics-hs
name: {{ include "fluss.tablet.metricsServiceName" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
app.kubernetes.io/component: metrics
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/svc-tablet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
apiVersion: v1
kind: Service
metadata:
name: tablet-server-hs
name: {{ include "fluss.tablet.serviceName" . }}
labels:
{{- include "fluss.labels" . | nindent 4 }}
app.kubernetes.io/component: tablet
Expand Down
Loading
Loading