bitflicker64 commented on code in PR #3402:
URL: https://github.com/apache/hugegraph/pull/3402#discussion_r4370580765
##########
helm/hugegraph/templates/seatunnel.yaml:
##########
@@ -0,0 +1,262 @@
+{{/*
+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.
+
+Based on Apache SeaTunnel v3.0.0 hybrid Kubernetes resources:
+https://github.com/apache/seatunnel/blob/v3.0.0/docs/zh/getting-started/kubernetes/hybrid-cluster-mode.md
+Use its DNS discovery alternative, so Kubernetes API RBAC is unnecessary.
+*/}}
+
+{{- define "hugegraph.seatunnel.config" -}}
+{{- $name := include "hugegraph.seatunnel.name" . -}}
+{{- $dns := printf "%s-headless.%s.svc" $name .Release.Namespace -}}
+{{- $data := dict -}}
+{{- $hazelcast := dict "hazelcast" (dict
+ "cluster-name" $name
+ "network" (dict
+ "port" (dict "auto-increment" false "port" 5801)
+ "join" (dict "kubernetes" (dict "enabled" true "service-dns" $dns
"service-port" 5801 "service-dns-timeout" 10)))
+ "properties" (dict "hazelcast.logging.type" "log4j2")) -}}
+{{- $_ := set $data "hazelcast.yaml" ($hazelcast | toYaml) -}}
+{{- $client := dict "hazelcast-client" (dict
+ "cluster-name" $name
+ "properties" (dict "hazelcast.logging.type" "log4j2")
+ "connection-strategy" (dict "connection-retry" (dict
"cluster-connect-timeout-millis" 7000))
+ "network" (dict "cluster-members" (list (printf "%s:5801" $dns)))) -}}
+{{- $_ := set $data "hazelcast-client.yaml" ($client | toYaml) -}}
+{{- $engine := dict "seatunnel" (dict "engine" (dict
+ "backup-count" (ternary 0 1 (eq .Values.seatunnel.mode "standalone"))
+ "history-job-expire-minutes" 1440
+ "classloader-cache-mode" true
+ "slot-service" (dict "dynamic-slot" true)
+ "checkpoint" (dict "interval" 180000 "timeout" 30000 "storage" (dict
+ "type" "hdfs" "max-retained" 3 "plugin-config" (dict
+ "namespace" "/tmp/seatunnel/checkpoint/" "storage.type" "hdfs"
"fs.defaultFS" "file:///tmp/")))
+ "http" (dict "enable-http" true "port" 8080 "enable-dynamic-port" false)))
-}}
+{{- $_ := set $data "seatunnel.yaml" ($engine | toYaml) -}}
+{{/* The upstream script appends jvm_options after JAVA_OPTS; set heap in that
file. */}}
+{{- $_ := set $data "jvm_options" (.Values.seatunnel.javaOpts | replace " "
"\n") -}}
+{{- range $path, $_ := .Files.Glob "examples/seatunnel/hugegraph-*.conf" -}}
+{{- $_ := set $data (base $path) ($.Files.Get $path) -}}
+{{- end -}}
+{{- range $filename, $content := .Values.seatunnel.config -}}
+{{- $_ := set $data $filename $content -}}
+{{- end -}}
+{{- toYaml $data -}}
+{{- end -}}
+
+{{- if (.Values.seatunnel | default dict).enabled }}
+{{- include "hugegraph.resolveValues" . }}
+{{- include "hugegraph.validateValues" . }}
+{{- $name := include "hugegraph.seatunnel.name" . }}
+{{- $config := omit (include "hugegraph.seatunnel.config" . | fromYaml)
"seatunnel.yaml" }}
+{{- $svc := .Values.seatunnel.service }}
+{{- $env := list
+ (dict "name" "SEATUNNEL_HOME" "value" "/opt/seatunnel")
+ (dict "name" "HG_HOST" "value" (printf "%s.%s.svc" (include
"hugegraph.server.name" .) .Release.Namespace))
+ (dict "name" "HG_PORT" "value" (.Values.server.port | toString))
+ (dict "name" "HG_PROTOCOL" "value" "http")
+ (dict "name" "HG_USERNAME" "value" "admin")
+ (dict "name" "HG_GRAPH_SPACE" "value" .Values.server.graphSpace)
+ (dict "name" "HG_GRAPH_NAME" "value" "graph_a") }}
+{{- $password := dict "name" "HG_PASSWORD" "value" "" }}
+{{- if .Values.server.auth.enabled }}
+{{- $password = dict "name" "HG_PASSWORD" "valueFrom" (dict "secretKeyRef"
(dict
+ "name" (include "hugegraph.server.authSecretName" .)
+ "key" (include "hugegraph.server.authSecretKey" .))) }}
+{{- end }}
+{{- $env = append $env $password }}
+{{- $overrides := dict }}
+{{- range .Values.seatunnel.env }}
+{{- $_ := set $overrides .name true }}
+{{- end }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ $name }}-configs
+ labels:
+ {{- include "hugegraph.labels" . | nindent 4 }}
+ app.kubernetes.io/component: seatunnel
+data:
+ {{- toYaml $config | nindent 2 }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ $name }}-headless
+ labels:
+ {{- include "hugegraph.labels" . | nindent 4 }}
+ app.kubernetes.io/component: seatunnel
+spec:
+ clusterIP: None
+ publishNotReadyAddresses: true
+ ports:
+ - name: hazelcast
+ port: 5801
+ targetPort: hazelcast
+ selector:
+ {{- include "hugegraph.selectorLabels" . | nindent 4 }}
+ app.kubernetes.io/component: seatunnel
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ $name }}
+ labels:
+ {{- include "hugegraph.labels" . | nindent 4 }}
+ app.kubernetes.io/component: seatunnel
+ {{- with $svc.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ type: {{ $svc.type }}
+ {{- range $field := list "externalTrafficPolicy" "loadBalancerClass"
"loadBalancerIP" "loadBalancerSourceRanges" "externalIPs" }}
+ {{- with get $svc $field }}
+ {{ $field }}: {{ toYaml . | nindent 4 }}
+ {{- end }}
+ {{- end }}
+ {{- if hasKey $svc "allocateLoadBalancerNodePorts" }}
+ {{- if ne (get $svc "allocateLoadBalancerNodePorts") nil }}
+ allocateLoadBalancerNodePorts: {{ $svc.allocateLoadBalancerNodePorts }}
+ {{- end }}
+ {{- end }}
+ ports:
+ - name: http
+ port: 8080
+ targetPort: http
+ {{- with $svc.nodePort }}
+ nodePort: {{ . }}
+ {{- end }}
+ selector:
+ {{- include "hugegraph.selectorLabels" . | nindent 4 }}
+ app.kubernetes.io/component: seatunnel
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: {{ $name }}
+ labels:
+ {{- include "hugegraph.labels" . | nindent 4 }}
+ app.kubernetes.io/component: seatunnel
+spec:
+ serviceName: {{ $name }}-headless
+ replicas: {{ ternary 1 (int .Values.seatunnel.replicas) (eq
.Values.seatunnel.mode "standalone") }}
+ podManagementPolicy: Parallel
Review Comment:
Important: `Parallel` starts both cluster-mode members at once, and members
started together never elect a master: both log `Could not join cluster.
Shutting down now!` after 300s, while 8080 stays up, so the `tcpSocket`
readiness probe passes with `workers: 0`. Drop `podManagementPolicy: Parallel`
so members start in order, as the upstream hybrid manifest does.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]