Skip to content

Commit

Permalink
[Feature] add helm chart.
Browse files Browse the repository at this point in the history
  • Loading branch information
FrommyMind committed Dec 13, 2024
1 parent 1a5feb1 commit 7ac1f24
Show file tree
Hide file tree
Showing 14 changed files with 927 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/publish-helm-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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.

name: publish-helm-chart

on:
push:
tags:
- '*'
paths-ignore:
- 'docs/**'
- '**/*.md'

jobs:
build:
if: github.repository == 'apache/seatunnel'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set environment variables
run: |
if [[ ${{ github.event_name }} == "release" ]]; then
echo "HUB=registry-1.docker.io/apache" >> $GITHUB_ENV
echo "DOCKER_REGISTRY=docker.io" >> $GITHUB_ENV
echo "DOCKER_USERNAME=${{ secrets.DOCKERHUB_USER }}" >> $GITHUB_ENV
echo "DOCKER_PASSWORD=${{ secrets.DOCKERHUB_TOKEN }}" >> $GITHUB_ENV
else
echo "HUB=ghcr.io/apache/seatunnel" >> $GITHUB_ENV
echo "DOCKER_REGISTRY=ghcr.io/apache/seatunnel" >> $GITHUB_ENV
echo "DOCKER_USERNAME=${{ github.actor }}" >> $GITHUB_ENV
echo "DOCKER_PASSWORD=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
fi
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Publish Helm Chart
working-directory: deploy/kubernetes
run: |
if [[ ${{ env.HUB }} == "ghcr.io/apache/seatunnel" ]]; then
VERSION=0.0.0-$(git rev-parse --short HEAD)
sed -i "s/^version: .*/version: $VERSION/" seatunnel/Chart.yaml
fi
helm dep up seatunnel
helm package seatunnel
helm push seatunnel-helm-*.tgz oci://${{ env.HUB }}
42 changes: 42 additions & 0 deletions deploy/kubernetes/seatunnel/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# 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.
#


apiVersion: v2
name: seatunnel-helm
description: SeaTunnel is a next-generation, high-performance, distributed data integration tool, capable of synchronizing vast amounts of data daily. It's trusted by numerous companies for its efficiency and stability.
home: https://seatunnel.apache.org
icon: https://seatunnel.apache.org/image/logo.png
keywords:
- seatunnel
- integration
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 2.3.9

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 2.3.9
58 changes: 58 additions & 0 deletions deploy/kubernetes/seatunnel/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{/*
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.
*/}}

** Please be patient while the chart seatunnel {{ .Chart.AppVersion }} is being deployed **

Access seatunnel UI URL by:

{{- if .Values.ingress.enabled }}

seatunnel UI URL: http{{ if .Values.ingress.tls.enabled }}s{{ end }}://{{ .Values.ingress.host }}/seatunnel

{{- else if eq .Values.master.service.type "ClusterIP" }}

kubectl port-forward -n {{ .Release.Namespace }} svc/{{ template "seatunnel.fullname" . }}-master 5801:5801

seatunnel restapi URL for running jobs: http://127.0.0.1:5801/hazelcast/rest/maps/running-jobs
seatunnel restapi URL for system monitoring information: http://127.0.0.1:5801/hazelcast/rest/maps/system-monitoring-information

For more restapi please refer to https://seatunnel.apache.org/docs/{{ .Chart.AppVersion }}/seatunnel-engine/rest-api


{{- else if eq .Values.master.service.type "NodePort" }}

NODE_IP=$(kubectl get no -n {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
NODE_PORT=$(kubectl get svc {{ template "seatunnel.fullname" . }}-api -n {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}")
echo http://$NODE_IP:$NODE_PORT/seatunnel

seatunnel restapi URL for running jobs: http://$NODE_IP:$NODE_PORT/hazelcast/rest/maps/running-jobs
seatunnel restapi URL for system monitoring information: http://$NODE_IP:$NODE_PORT/hazelcast/rest/maps/system-monitoring-information

For more restapi please refer to https://seatunnel.apache.org/docs/{{ .Chart.AppVersion }}/seatunnel-engine/rest-api
{{- else if eq .Values.api.service.type "LoadBalancer" }}

NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc {{ template "seatunnel.fullname" . }}-api -n {{ .Release.Namespace }} -w'

SERVICE_IP=$(kubectl get svc {{ template "seatunnel.fullname" . }}-api -n {{ .Release.Namespace }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:5801/hazelcast/rest/maps/running-jobs

seatunnel resetapi URL for running jobs: http://$SERVICE_IP:5801/hazelcast/rest/maps/running-jobs
seatunnel resetapi URL for system monitoring information: http://$SERVICE_IP:5801/hazelcast/rest/maps/system-monitoring-information

For more restapi please refer to https://seatunnel.apache.org/docs/{{ .Chart.AppVersion }}/seatunnel-engine/rest-api
{{- end }}
65 changes: 65 additions & 0 deletions deploy/kubernetes/seatunnel/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#
# 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.
#

{{/* vim: set filetype=mustache: */}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "seatunnel.fullname" -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create default docker images' fullname.
*/}}
{{- define "seatunnel.image.fullname.master" -}}
{{- .Values.image.registry }}:{{ .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
{{- define "seatunnel.image.fullname.worker" -}}
{{- .Values.image.registry }}:{{ .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}
{{/*
Create a default common labels.
*/}}
{{- define "seatunnel.common.labels" -}}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
{{- end -}}
{{/*
Create a master labels.
*/}}
{{- define "seatunnel.master.labels" -}}
app.kubernetes.io/name: {{ include "seatunnel.fullname" . }}-master
app.kubernetes.io/component: master
{{ include "seatunnel.common.labels" . }}
{{- end -}}
{{/*
Create a worker labels.
*/}}
{{- define "seatunnel.worker.labels" -}}
app.kubernetes.io/name: {{ include "seatunnel.fullname" . }}-worker
app.kubernetes.io/component: worker
{{ include "seatunnel.common.labels" . }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# 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.
#
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "seatunnel.fullname" . }}-master
labels:
app.kubernetes.io/name: {{ include "seatunnel.fullname" . }}-master
{{- include "seatunnel.master.labels" . | nindent 4 }}
data:
hazelcast-master.yaml: |-
{{- if .Values.conf.master }}
{{- toYaml .Values.conf.master | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# 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.
#
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "seatunnel.fullname" . }}-worker
labels:
app.kubernetes.io/name: {{ include "seatunnel.fullname" . }}-worker
{{- include "seatunnel.master.labels" . | nindent 4 }}
data:
hazelcast-worker.yaml: |-
{{- if .Values.conf.worker }}
{{- toYaml .Values.conf.worker | nindent 4 }}
{{- end }}
28 changes: 28 additions & 0 deletions deploy/kubernetes/seatunnel/templates/configmap-seatunnel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# 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.
#
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "seatunnel.fullname" . }}-seatunnel
labels:
app.kubernetes.io/name: {{ include "seatunnel.fullname" . }}-seatunnel
{{- include "seatunnel.common.labels" . | nindent 4 }}
data:
seatunnel.yaml: |-
{{- if .Values.conf.seatunnel }}
{{- toYaml .Values.conf.seatunnel | nindent 4}}
{{- end }}
Loading

0 comments on commit 7ac1f24

Please sign in to comment.