This is an automated email from the ASF dual-hosted git repository.
nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-webui.git
The following commit(s) were added to refs/heads/main by this push:
new 8f6d61ab [Feature] Support kubernetes deployment via YAML files (#401)
8f6d61ab is described below
commit 8f6d61abe9ac8f44f32c8232405c564f48039e23
Author: yangyang zhong <[email protected]>
AuthorDate: Tue Jun 18 17:06:13 2024 +0800
[Feature] Support kubernetes deployment via YAML files (#401)
---
paimon-web-server/src/main/bin/env.sh | 4 +-
scripts/deploy/kubernetes/configmap.yaml | 125 +++++++++++++++++++++
scripts/deploy/kubernetes/deployment.yaml | 87 ++++++++++++++
.../deploy/kubernetes/ingress.yaml | 39 ++++---
.../deploy/kubernetes/service.yaml | 33 +++---
5 files changed, 252 insertions(+), 36 deletions(-)
diff --git a/paimon-web-server/src/main/bin/env.sh
b/paimon-web-server/src/main/bin/env.sh
index 1419a868..da7a989a 100644
--- a/paimon-web-server/src/main/bin/env.sh
+++ b/paimon-web-server/src/main/bin/env.sh
@@ -17,7 +17,7 @@
#
# Set the FLINK_HOME directory to execute the flink command to submit the cdc
job.
-FLINK_HOME=
+FLINK_HOME=${FLINK_HOME:-""}
# Set the ACTION_JAR_PATH to execute the paimon action job.
ACTION_JAR_PATH=
@@ -26,4 +26,4 @@ JVM_ARGS="-server"
JAVA_OPTS=${JAVA_OPTS:-"${JVM_ARGS}"}
-JAVA_HOME=
\ No newline at end of file
+JAVA_HOME=${JAVA_HOME:-/opt/java/openjdk}
\ No newline at end of file
diff --git a/scripts/deploy/kubernetes/configmap.yaml
b/scripts/deploy/kubernetes/configmap.yaml
new file mode 100644
index 00000000..f341bd84
--- /dev/null
+++ b/scripts/deploy/kubernetes/configmap.yaml
@@ -0,0 +1,125 @@
+# 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: paimon-web-configmap
+ labels:
+ app: paimon-web
+data:
+ application.yml: |-
+ server:
+ port: 10088
+ spring:
+ application:
+ name: Paimon-Web-UI
+ profiles:
+ active: dev-mysql
+ messages:
+ basename: i18n/messages
+ encoding: UTF-8
+ mvc:
+ pathmatch:
+ matching-strategy: ant_path_matcher
+ format:
+ date: yyyy-MM-dd HH:mm:ss # date format
+ time: HH:mm:ss # time format
+ date-time: yyyy-MM-dd HH:mm:ss # date-time format
+ jackson:
+ time-zone: GMT+8 # Time zone, default is GMT+8
+ date-format: yyyy-MM-dd HH:mm:ss # Date format, the default is
yyyy-MM-dd HH:mm:ss
+ spring:
+ datasource:
+ url:
jdbc:mysql://${MYSQL_ADDR:127.0.0.1:3306}/${MYSQL_DATABASE:paimon}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
+ username: ${MYSQL_USERNAME:username}
+ password: ${MYSQL_PASSWORD:password}
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ hikari:
+ maximum-pool-size: 20
+ minimum-idle: 10
+ max-lifetime: 27000000
+ idle-timeout: 600000
+ connection-test-query: SELECT 1
+ mybatis-plus:
+ mapperLocations: classpath*:mapper/*Mapper.xml
+ global-config:
+ banner: false
+ db-config:
+ logic-delete-field: is_delete
+ configuration:
+ log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
+ sa-token:
+ token-name: ${spring.application.name}
+ timeout: 2592000
+ active-timeout: -1
+ is-concurrent: true
+ is-share: true
+ token-style: uuid
+ is-log: false
+ is-print: false
+ is-read-cookie: true
+ is-write-header: true
+ is-read-header: true
+ is-read-body: true
+ management:
+ web:
+ exposure:
+ include: info,health
+ endpoint:
+ health:
+ show-details: when-authorized
+ health:
+ ldap:
+ enabled: false
+
+ log4j2-spring.xml: |-
+ <?xml version="1.0" encoding="UTF-8"?>
+ <configuration status="OFF" monitorInterval="600">
+ <Properties>
+ <property name="LOG_PATH">./logs/</property>
+ <property name="LOG_FILE">paimon</property>
+ <property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss z}
%-5level %class{36}#%M:%L - %msg%xEx%n"/>
+ <property name="CONSOLE_LOG_PATTERN" value="%d{yyyy-MM-dd
HH:mm:ss.SSS} %highlight{%6p} %style{%5pid}{bright,magenta} --- [%15.15t]
%style{%c{20}}{bright,cyan}: %m%n"/>
+ </Properties>
+ <appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <ThresholdFilter level="info" onMatch="ACCEPT"
onMismatch="ACCEPT"/>
+ <PatternLayout>
+ <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
+ </PatternLayout>
+ </Console>
+
+ <RollingFile name="RollingFile"
fileName="${LOG_PATH}/${LOG_FILE}.log"
+
filePattern="${LOG_PATH}/$${date:yyyy-MM}/${LOG_FILE}-%d{yyyy-MM-dd}-%i.log">
+ <PatternLayout>
+ <Pattern>${FILE_LOG_PATTERN}</Pattern>
+ </PatternLayout>
+ <Policies>
+ <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
+ <SizeBasedTriggeringPolicy size="100MB"/>
+ </Policies>
+ </RollingFile>
+ </appenders>
+
+ <loggers>
+ <root level="info">
+ <appender-ref ref="Console"/>
+ <!--<appender-ref ref="File"/>-->
+ <appender-ref ref="RollingFile"/>
+ </root>
+
+ </loggers>
+ </configuration>
+
+
diff --git a/scripts/deploy/kubernetes/deployment.yaml
b/scripts/deploy/kubernetes/deployment.yaml
new file mode 100644
index 00000000..a7f4f32c
--- /dev/null
+++ b/scripts/deploy/kubernetes/deployment.yaml
@@ -0,0 +1,87 @@
+# 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: apps/v1
+kind: Deployment
+metadata:
+ name: paimon-web-deployment # Deployment name for Paimon Web UI
+ labels:
+ app: paimon-web # Label to categorize the Deployment
+
+spec:
+ replicas: 1 # Number of desired replicas
+ selector: # Selector to match Pods controlled by this Deployment
+ matchLabels:
+ app: paimon-web
+
+ strategy:
+ type: RollingUpdate # Strategy for updating Pods
+ rollingUpdate:
+ maxSurge: 25% # Maximum surge of new Pods during update
+ maxUnavailable: 0 # Ensure no Pods are unavailable during update
+
+ template: # Pod template specification
+ metadata:
+ labels:
+ app: paimon-web # Pod labels to match Deployment selector
+
+ spec:
+ serviceAccountName: default # Use the default service account
+ containers:
+ - name: paimon-web-container # Name of the container
+ ports:
+ - containerPort: 10088 # Exposed port within the container
+ name: "port"
+
+ image: apache/paimon-webui:latest # Docker image to use
+ imagePullPolicy: IfNotPresent # Always pull the latest image
+
+ env: # Environment variables for container configuration
+ - name: MYSQL_HOST # MySQL host address
+ value: xxxxx
+ - name: MYSQL_USERNAME # MySQL username
+ value: xxxxx
+ - name: MYSQL_PASSWORD # MySQL password
+ value: xxxxx
+ - name: ACTION_JAR_PATH # Path to action JAR file
+ value: xxxxx
+ - name: FLINK_HOME # Home directory for Flink
+ value: xxxxx
+ - name: JAVA_HOME
+ value: java
+ livenessProbe: # Liveness probe to check container health
+ exec: # Command execution for probe
+ command: ["curl", "-s",
"http://localhost:10088/actuator/health/liveness"]
+ initialDelaySeconds: 30 # Initial delay before probe starts
+ periodSeconds: 30 # How often to perform the probe
+ timeoutSeconds: 5 # Probe timeout
+ successThreshold: 1 # Minimum consecutive successes for healthy
status
+ failureThreshold: 1 # Minimum consecutive failures for unhealthy
status
+
+ readinessProbe: # Readiness probe to verify if Pod is ready to serve
traffic
+ exec:
+ command: ["curl", "-s",
"http://localhost:10088/actuator/health/readiness"]
+ initialDelaySeconds: 30
+ periodSeconds: 30
+ timeoutSeconds: 5
+ successThreshold: 1
+ failureThreshold: 1
+
+ volumeMounts: # Volume mounts for the container
+ - mountPath: /opt/paimon/config # Path where the volume is mounted
inside the container
+ name: config-volume # Named volume
+ volumes:
+ - name: config-volume
+ configMap:
+ name: paimon-web-configmap
+
diff --git a/paimon-web-server/src/main/bin/env.sh
b/scripts/deploy/kubernetes/ingress.yaml
similarity index 53%
copy from paimon-web-server/src/main/bin/env.sh
copy to scripts/deploy/kubernetes/ingress.yaml
index 1419a868..bf82ac20 100644
--- a/paimon-web-server/src/main/bin/env.sh
+++ b/scripts/deploy/kubernetes/ingress.yaml
@@ -1,29 +1,34 @@
-#!/bin/bash
-#
# 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
-#
+# 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.
-#
-# Set the FLINK_HOME directory to execute the flink command to submit the cdc
job.
-FLINK_HOME=
-
-# Set the ACTION_JAR_PATH to execute the paimon action job.
-ACTION_JAR_PATH=
-
-JVM_ARGS="-server"
-
-JAVA_OPTS=${JAVA_OPTS:-"${JVM_ARGS}"}
-
-JAVA_HOME=
\ No newline at end of file
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+ name: paimon-web
+ labels:
+ app: paimon-web
+ annotations:
+ nginx.ingress.kubernetes.io/rewrite-target: / # Example annotation for
path-based routing with Nginx Ingress Controller
+spec:
+ ingressClassName: nginx # Your ingress class name
+ rules:
+ - host: paimonweb.k8s.io # Replace with your desired hostname
+ http:
+ paths:
+ - path: /
+ pathType: Prefix
+ backend:
+ service:
+ name: paimon-web-svc
+ port:
+ name: server
diff --git a/paimon-web-server/src/main/bin/env.sh
b/scripts/deploy/kubernetes/service.yaml
similarity index 70%
copy from paimon-web-server/src/main/bin/env.sh
copy to scripts/deploy/kubernetes/service.yaml
index 1419a868..815a8fe5 100644
--- a/paimon-web-server/src/main/bin/env.sh
+++ b/scripts/deploy/kubernetes/service.yaml
@@ -1,29 +1,28 @@
-#!/bin/bash
-#
# 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
-#
+# 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.
-#
-# Set the FLINK_HOME directory to execute the flink command to submit the cdc
job.
-FLINK_HOME=
-
-# Set the ACTION_JAR_PATH to execute the paimon action job.
-ACTION_JAR_PATH=
-
-JVM_ARGS="-server"
-
-JAVA_OPTS=${JAVA_OPTS:-"${JVM_ARGS}"}
-
-JAVA_HOME=
\ No newline at end of file
+apiVersion: v1
+kind: Service
+metadata:
+ name: paimon-web-svc
+ labels:
+ app: paimon-web
+spec:
+ type: ClusterIP
+ ports:
+ - port: 10088
+ targetPort: 10088
+ name: port
+ protocol: TCP
+ selector:
+ app: paimon-web
\ No newline at end of file