Unverified Commit 67b7a7e7 authored by XiuhongTang's avatar XiuhongTang Committed by GitHub

[feature] add kubernetes deploy (#3516)

parent 82366dfa
#
# 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.
#
FROM openjdk:11 as build-stage
ARG FLINK_VERSION=1.17
ENV DINKY_VERSION=1.0.2
ADD dinky-release-${FLINK_VERSION}-${DINKY_VERSION}.tar.gz /
USER root
RUN mv /dinky-release-${FLINK_VERSION}-${DINKY_VERSION} /dinky/
RUN mkdir -p /dinky/run && mkdir -p /dinky/logs && touch /dinky/logs/dinky.log
RUN chmod -R 777 /dinky/
FROM flink:scala_2.12-java11 as reqired-stage
FROM openjdk:11 as production-stage
ARG FLINK_VERSION=1-17
COPY --from=build-stage /dinky/ /dinky/
COPY --from=reqired-stage /opt/flink/lib/*.jar /dinky/extends/flink${FLINK_VERSION}/
RUN rm -f /dinky/extends/flink${FLINK_VERSION}/flink-table-planner-loader*.jar
COPY --from=reqired-stage /opt/flink/opt/flink-table-planner*.jar /dinky/extends/flink${FLINK_VERSION}/
ADD mysql-connector-j-8.1.0.jar /dinky/extends/flink${FLINK_VERSION}/
WORKDIR /dinky/
EXPOSE 8888
CMD ./auto.sh restart && tail -f /dinky/logs/dinky.log
\ No newline at end of file
......@@ -3,13 +3,13 @@ version: "3.9"
services:
mysql:
build:
context: ..
context: ../..
dockerfile: ${PWD:-.}/DockerfileMysql
dinky:
image: dinky-standalone-server:${DINKY_VERSION}
build:
context: ..
context: ../..
dockerfile: ${PWD:-.}/Dockerfile
args:
- DINKY_VERSION
......@@ -18,7 +18,7 @@ services:
standalone:
build:
context: ..
context: ../..
dockerfile: ${PWD:-.}/DockerfileDinkyFlink
args:
- FLINK_BIG_VERSION
......@@ -31,5 +31,5 @@ services:
web:
build:
context: ..
context: ../..
dockerfile: ${PWD:-.}/DockerfileWeb
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
#
# 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: dinky
description: Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑
home: https://www.dinky.org.cn
icon: https://www.dinky.org.cn/side_dinky.svg
type: application
version: 1.0.0
appVersion: 1.0.0
#
# 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
#
# https://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.
#
spring:
flyway:
enabled: true # Is it enabled
group: true # Enable grouping
locations:
- classpath:db/migration/${spring.profiles.active}
table: _dinky_flyway_schema_history
placeholder-replacement: false # Placeholder Replacement
baseline-on-migrate: true # Baseline during migration
baseline-version: 1.0.2 # Baseline version
validate-on-migrate: false # Verify during migration
placeholder-prefix: '##{'
placeholder-suffix: '}##'
fail-on-missing-locations: true # Does the non-existent migration file throw an exception
#
# 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
#
# https://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.
#
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:dinky;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true;
# Note: Since dinky version 1.1.0, Flyway has been integrated, so h2 defaults to memory mode and no longer uses file mode (persistence).
# File mode can cause Flyway to fail to execute duplicate column addition operations correctly
# as h2 does not support stored procedures and cannot determine the existence of columns through stored procedures. Therefore, please do not use file mode
# url: jdbc:h2:./tmp/db/h2;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=29099;
druid:
initial-size: 1
username: dinky
password: dinky
h2:
console:
enabled: true
path: /api/h2
\ No newline at end of file
#
# 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
#
# https://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.
#
management:
endpoints:
web:
exposure:
include: "*"
exclude:
- heapdump
- threaddump
- env
enabled-by-default: true
jmx:
exposure:
include: "*"
health:
redis:
enabled: false
ldap:
enabled: false
endpoint:
health:
show-details: always
metrics:
tags:
application: ${spring.application.name}
\ No newline at end of file
#
# 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
#
# https://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.
#
spring:
datasource:
url: jdbc:mysql://${MYSQL_ADDR:127.0.0.1:3306}/${MYSQL_DATABASE:dinky}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: ${MYSQL_USERNAME:dinky}
password: ${MYSQL_PASSWORD:dinky}
driver-class-name: com.mysql.cj.jdbc.Driver
#
# 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
#
# https://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.
#
spring:
datasource:
username: ${POSTGRES_USER:dinky}
password: ${POSTGRES_PASSWORD:dinky}
driver-class-name: org.postgresql.Driver
# The POSTGRES_ADDR variable is not officially provided. If you use docker, please manually add an env to support it.
url: jdbc:postgresql://${POSTGRES_ADDR:localhost:5432}/${POSTGRES_DB:dinky}?stringtype=unspecified
\ No newline at end of file
#################################################################################################################
################################################# Common Config #################################################
#################################################################################################################
# Dinky application port
server:
port: 8888
shutdown: graceful
spring:
# Dinky application name
application:
name: Dinky
profiles:
# The h2 database is used by default. If you need to use other databases, please set the configuration active to: mysql, currently supports [mysql, pgsql, h2]
# If you use mysql database, please configure mysql database connection information in application-mysql.yml
# If you use pgsql database, please configure pgsql database connection information in application-pgsql.yml
# If you use the h2 database, please configure the h2 database connection information in application-h2.yml,
# note: the h2 database is only for experience use, and the related data that has been created cannot be migrated, please use it with caution
active: ${DB_ACTIVE:h2} #[h2,mysql,pgsql]
include:
- jmx
- flyway
lifecycle:
timeout-per-shutdown-phase: 30s
# mvc config
mvc:
pathmatch:
# Path matching strategy, default ant_path_matcher, support ant_path_matcher and path_pattern_parser
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
# json format global configuration
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
# circular references allowed
main:
allow-circular-references: true
# file upload config of servlet, the default is 500MB
servlet:
multipart:
enabled: true
max-file-size: 524288000
max-request-size: 524288000
# 1. By default, memory cache metadata information is used,
# 2. DINKY supports Redis caching. If necessary, please change simple to Redis and open the Redis connection configuration below
# 3. Sub configuration items can be opened or customized as needed
cache:
type: simple
# If the type is configured as Redis, this item can be configured as needed
# redis:
# Do you want to cache empty values? Just save by default
# cache-null-values: false
# Cache expiration time, 24 hours
# time-to-live: 86400
########################################################## Redis配置 ##########################################################
# Note: Redis related configurations in DINKY can be used to cache meta-data information (memory caching is used by default) and cache session information of SA TOKEN (dependency needs to be added,please refer to the official documentation of SA TOKEN for Redis caching configuration instructions)
## 1. If you need to use Redis to cache metadata information, please configure cache. Type to Redis and then configure the following configuration items
## 2. If you need to use Redis to cache SA Token session information, please follow the instructions in the official SA Token documentation to configure it
# Note: Please pay attention to the indentation after opening comments, otherwise it may cause configuration file parsing errors. Note that when both 1 and 2 are used simultaneously, only the same Redis database can be supported
# redis:
# host: localhost
# port: 6379
# username:
# password:
# Redis database number
# database: 10
# jedis:
# pool:
# The maximum number of connections in the connection pool (use a negative value to indicate no limit)
# max-active: 50
# The maximum blocking waiting time of the connection pool (use a negative value to indicate no limit)
# max-wait: 3000
# The maximum number of idle connections in the connection pool
# max-idle: 20
# The minimum number of idle connections in the connection pool
# min-idle: 5
# Connection timeout (milliseconds)
# timeout: 5000
---
#################################################################################################################
################################################# Mybatis Config ################################################
######### Please note: that the following configurations are not recommended to be modified #####################
#################################################################################################################
mybatis-plus:
mapper-locations: classpath:/mapper/*Mapper.xml
# Entity scanning, multiple packages are separated by commas or semicolons
typeAliasesPackage: org.dinky.model
global-config:
db-config:
id-type: auto
# Logic delete configuration : 0: false(Not deleted), 1: true(deleted)
logic-delete-field: is_delete
logic-delete-value: 1
logic-not-delete-value: 0
banner: false
configuration:
##### mybatis-plus prints complete sql (only for development environment)
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
type-handlers-package: org.dinky.data.typehandler
---
#################################################################################################################
################################################# SMS Config ####################################################
#################################################################################################################
sms:
is-print: false
---
#################################################################################################################
################################################# Sa-Token Config ###############################################
#################################################################################################################
# Sa-Token basic configuration
sa-token:
# The validity period of the token, the unit is 10 hours by default, -1 means it will never expire
timeout: 36000
# The temporary validity period of the token (the token will be considered as expired if there is no operation within the specified time)
# unit: second , if you do not need to set a temporary token, you can set it to -1
active-timeout: -1
# Whether to allow the same account to log in concurrently (when true, allow login together, when false, new login squeezes out old login)
is-concurrent: false
# When multiple people log in to the same account, whether to share a token (if true, all logins share a token, and if false, create a new token for each login)
is-share: true
# token style
token-style: uuid
# Whether to output the operation log
is-log: false
# Whether to print banner
is-print: false
# The secret key
jwt-secret-key: 0DA4198858E84F1AADDF846340587A85
# is write header
is-write-header: true
# is read header
is-read-header: true
token-name: token
is-read-cookie: true
---
#################################################################################################################
################################################# knife4j Config ################################################
#################################################################################################################
knife4j:
enable: true
setting:
language: en
---
#################################################################################################################
################################################# Crypto Config #################################################
#################################################################################################################
crypto:
enabled: false
encryption-password:
---
lowercaseOutputLabelNames: true
lowercaseOutputName: true
whitelistObjectNames: ["java.lang:type=OperatingSystem"]
blacklistObjectNames: []
rules:
- pattern: 'java.lang<type=OperatingSystem><>(committed_virtual_memory|free_physical_memory|free_swap_space|total_physical_memory|total_swap_space)_size:'
name: os_$1_bytes
type: GAUGE
attrNameSnakeCase: true
- pattern: 'java.lang<type=OperatingSystem><>((?!process_cpu_time)\w+):'
name: os_$1
type: GAUGE
attrNameSnakeCase: true
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--status用于设置log4j2框架内部的日志信息输出,设置成OFF将禁止log4j2内部日志输出,毕竟这个日志对我们没有什么作用,如果设置成trace,你会看到log4j2内部各种详细输出;monitorInterval是监控间隔,例如下面的设置是指:log4j2每隔600秒自动监控该配置文件是否有变化,如果有变化,则根据文件内容新的配置生成日志-->
<configuration status="OFF" monitorInterval="600">
<Properties>
<property name="LOG_PATH" >${sys:dinky.logs.path:-./logs/}</property>
<property name="LOG_FILE">dinky</property>
</Properties>
<!--定义添加器-->
<appenders>
<!--Console是输出控制台的标签,target可以控制往控制台输出日志的颜色,例如SYSTEM_OUT就是蓝色的,SYSTEM_ERR就是红色的-->
<Console name="Console" target="SYSTEM_OUT">
<!--控制台只输出level及以上级别的信息,onMatch为true代表符合level标准的才输出,onMismatch为true代表不符合level标准的就不输出-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="ACCEPT"/>
<!--这个是输出日志的格式,如果对里面的参数不理解,可以去看我的这篇文章,网址是:“https://blog.csdn.net/qq_42449963/article/details/104617356”-->
<!--<PatternLayout pattern="[dinky] %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>-->
<PatternLayout
pattern="[dinky] %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight{%6p} %style{%5pid}{bright,magenta} --- [%15.15t] %style{%c{20}}{bright,cyan}: %m%n"/>
</Console>
<!--这种存储文件的方式更加合理,可以设置多长时间把文件归档一次,也可以设置多大文件归档一次,如果都把所有的日志存在一个文件里面,文件会受不了的,解释一下参数信息:fileName后面如果后面不跟/,例如dev/logs/app.log,那就会把日志文件放在project工程下面,不是所属的项目下面如果后面跟/,例如/dev/logs/app.log,那就会把日志文件直接放在项目所在盘符的根目录下,例如项目在E盘存放,那就会把日志文件直接放在E盘的根目录下,如果后面直接加盘符,那就会存在特定的位置,例如F:/dev/logs/app.log,那就会直接放在F盘中特定的位置,上面都是经过测验的,fileName后面的app.log文件相当于是一个缓存文件,我们会把日志信息先放在app.log中,当达到我们设置的要求之后会把app.log中的日志信息转移到filePattern指定的日志文件中,转移的内容就会从app.log日志文件中清除,没有转移的内容还存放在app.log中,等到下一次符合要求的时候在进行一次转移-->
<!--$${date:yyyy-MM}用在文件上面,输出的是目录的名字,例如2020-03,%d{MM-dd-yyyy}输入的就是月日年,例如03-02-2020,%i按照轮询输出,毕竟一天可能有符合要求的多个日志文件生成,所以需要在后面加一个类似于后缀的东西,当天的第一个日志文件可能是-1.log.gz,第二个文件就是-2.log.gz-->
<RollingFile name="RollingFile" fileName="${LOG_PATH}/${LOG_FILE}.log"
filePattern="${LOG_PATH}/$${date:yyyy-MM}/${LOG_FILE}-%d{yyyy-MM-dd}-%i.log">
<!--%thread:线程名;%-5level:级别从左显示5个字符宽度;%msg:在代码中需要输出的日志消息;%class{36}:估计显示的是完整类名-->
<PatternLayout pattern="[dinky] %d{yyyy-MM-dd HH:mm:ss z} %-5level %class{36} %L %M - %msg%xEx%n"/>
<!--<SizeBasedTriggeringPolicy size="300MB"/>-->
<Policies>
<!--TimeBasedTriggeringPolicy基于时间的触发策略,integer属性和上面<RollingFile>标签中的filePattern的值有关,例如:filePattern=”xxx%d{yyyy-MM-dd}xx” interval=”1” 表示将1天一个日志文件;filePattern=”xxx%d{yyyy-MM-dd-HH}xxx” interval=”1”表示一个小时一个日志文件,也就是说interval的单位取决于filePattern中的最小时间单位;modulate是(boolean)以0点钟为边界进行偏移计算,应该就是假设你中午启动项目,晚上0点也是一天了,而不是经过24小时才算一天-->
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<!--当app.log文件大小到达100MB的时候,就归档一次日志文件,也就是把app.log中的那前面100MB文件取出来,放到上面<RollingFile >中的filePattern后面的路径中-->
<SizeBasedTriggeringPolicy size="100MB"/>
</Policies>
</RollingFile>
<RollingFile name="RollingFileWs" fileName="${LOG_PATH}/${LOG_FILE}.log"
filePattern="${LOG_PATH}/$${date:yyyy-MM}/${LOG_FILE}-ws-%d{yyyy-MM-dd}-%i.log">
<!--%thread:线程名;%-5level:级别从左显示5个字符宽度;%msg:在代码中需要输出的日志消息;%class{36}:估计显示的是完整类名-->
<PatternLayout pattern="[dinky] %d{yyyy-MM-dd HH:mm:ss z} %-5level %class{36} %L %M - %msg%xEx%n"/>
<!--<SizeBasedTriggeringPolicy size="300MB"/>-->
<Policies>
<!--TimeBasedTriggeringPolicy基于时间的触发策略,integer属性和上面<RollingFile>标签中的filePattern的值有关,例如:filePattern=”xxx%d{yyyy-MM-dd}xx” interval=”1” 表示将1天一个日志文件;filePattern=”xxx%d{yyyy-MM-dd-HH}xxx” interval=”1”表示一个小时一个日志文件,也就是说interval的单位取决于filePattern中的最小时间单位;modulate是(boolean)以0点钟为边界进行偏移计算,应该就是假设你中午启动项目,晚上0点也是一天了,而不是经过24小时才算一天-->
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<!--当app.log文件大小到达100MB的时候,就归档一次日志文件,也就是把app.log中的那前面100MB文件取出来,放到上面<RollingFile >中的filePattern后面的路径中-->
<SizeBasedTriggeringPolicy size="100MB"/>
</Policies>
<DefaultRolloverStrategy>
<!--
* only files in the log folder, no sub folders
* only rolled over log files (name match)
* only files that are 4 days old or older
-->
<Delete basePath="${LOG_PATH}/" maxDepth="1">
<IfFileName glob="*-ws-.log"/>
<IfLastModified age="3d"/>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<LogSseAppender name="LogSseAppender">
<!--控制台只输出level及以上级别的信息,onMatch为true代表符合level标准的才输出,onMismatch为true代表不符合level标准的就不输出-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="ACCEPT"/>
<!--这个是输出日志的格式,如果对里面的参数不理解,可以去看我的这篇文章,网址是:“https://blog.csdn.net/qq_42449963/article/details/104617356”-->
<!--<PatternLayout pattern="[dinky] %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>-->
<PatternLayout
pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %c{20}(%L): %m"/>
</LogSseAppender>
</appenders>
<loggers>
<!--level="info"代表只能打印出info及其以上的信息;Console是上面Console标签的名字,往这一写,就可以往控制台上输出内容了,RollingFile是上面RollingFile标签的名字,往这一写,就会往设定的文件中输出内容了;当程序运行的时候就会被创建日志输出文件,不过里面没有任何日志内容,是否往里面输入日志,是通过下面的appender-ref标签控制的-->
<Logger name="org.springframework.web.socket" level="info" additivity="false">
<AppenderRef ref="RollingFileWs"/>
</Logger>
<Logger name="org.flywaydb" level="debug" >
<AppenderRef ref="Console"/>
</Logger>
<root level="info">
<appender-ref ref="Console"/>
<!--一般不使用这个,只是让你知道有这个输出日志文件的方式而已-->
<!--<appender-ref ref="File"/>-->
<appender-ref ref="RollingFile"/>
<appender-ref ref="LogSseAppender"/>
</root>
</loggers>
</configuration>
#
# 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
#
# https://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 dinky {{ .Chart.AppVersion }} is being deployed **
Access dinky UI URL by:
ChartVersion:{{ .Chart.Version}}[refers to the release version]
appVersion:{{ .Chart.Version }}[refers to the code version]
{{- if .Values.ingress.enabled }}
dinky UI URL: https://{{ .Values.ingress.host }}/dinky
{{- else if eq .Values.service.type "NodePort" }}
You can try the following command to get the ip, port of dinky:
kubectl get no -n {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}"
kubectl get svc {{ .Values.service.name }} -n {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}"
{{- end }}
{{/*
Expand the name of the chart.
*/}}
{{- define "dinky.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
*/}}
{{- define "dinky.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "dinky.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default common labels.
*/}}
{{- define "dinky.labels" -}}
helm.sh/chart: {{ include "dinky.chart" . }}
{{ include "dinky.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "dinky.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dinky.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create service account name
*/}}
{{- define "dinky.serviceAccountName" -}}
{{- if .Values.dinkyServiceAccount.create }}
{{- default (include "dinky.fullname" .) .Values.dinkyServiceAccount.name }}
{{- else }}
{{- default "default" .Values.dinkyServiceAccount.name }}
{{- end }}
{{- end }}
{{- define "dinky.dbActive" -}}
- name: DB_ACTIVE
{{- if .Values.postgresql.enabled }}
value: "pgsql"
{{- else if .Values.mysql.enabled }}
value: "mysql"
{{- else }}
value: {{ .Values.externalDatabase.type | quote }}
{{- end }}
{{- end }}
\ No newline at end of file
#
# 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
#
# https://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.
#
{{- if .Values.dinkyDefaultConfiguration.create }}
apiVersion: v1
kind: ConfigMap
metadata:
name: dinky-config
namespace: {{ .Release.Namespace }}
labels:
{{- include "dinky.labels" . | nindent 4 }}
data:
application.yml: |+
{{- if .Values.dinkyDefaultConfiguration.append }}
{{- $.Files.Get "conf/application.yml" | nindent 4 -}}
{{- end }}
{{- if index (.Values.dinkyDefaultConfiguration) "application.yml" }}
{{- index (.Values.dinkyDefaultConfiguration) "application.yml" | nindent 4 -}}
{{- end }}
application-h2.yml: |+
{{- if .Values.dinkyDefaultConfiguration.append }}
{{- $.Files.Get "conf/application-h2.yml" | nindent 4 -}}
{{- end }}
{{- if index (.Values.dinkyDefaultConfiguration) "application-h2.yml" }}
{{- index (.Values.dinkyDefaultConfiguration) "application-h2.yml" | nindent 4 -}}
{{- end }}
application-mysql.yml: |+
{{- if .Values.dinkyDefaultConfiguration.append }}
{{- $.Files.Get "conf/application-mysql.yml" | nindent 4 -}}
{{- end }}
{{- if index (.Values.dinkyDefaultConfiguration) "application-mysql.yml" }}
{{- index (.Values.dinkyDefaultConfiguration) "application-mysql.yml" | nindent 4 -}}
{{- end }}
application-pgsql.yml: |+
{{- if .Values.dinkyDefaultConfiguration.append }}
{{- $.Files.Get "conf/application-pgsql.yml" | nindent 4 -}}
{{- end }}
{{- if index (.Values.dinkyDefaultConfiguration) "application-pgsql.yml" }}
{{- index (.Values.dinkyDefaultConfiguration) "application-pgsql.yml" | nindent 4 -}}
{{- end }}
application-jmx.yml: |+
{{- if .Values.dinkyDefaultConfiguration.append }}
{{- $.Files.Get "conf/application-jmx.yml" | nindent 4 -}}
{{- end }}
{{- if index (.Values.dinkyDefaultConfiguration) "application-jmx.yml" }}
{{- index (.Values.dinkyDefaultConfiguration) "application-jmx.yml" | nindent 4 -}}
{{- end }}
application.properties: |+
{{- if .Values.dinkyDefaultConfiguration.append }}
{{- $.Files.Get "conf/application.properties" | nindent 4 -}}
{{- end }}
{{- if index (.Values.dinkyDefaultConfiguration) "application.properties" }}
{{- index (.Values.dinkyDefaultConfiguration) "application.properties" | nindent 4 -}}
{{- end }}
log4j2.xml: |+
{{- if .Values.dinkyDefaultConfiguration.append }}
{{- $.Files.Get "conf/log4j2.xml" | nindent 4 -}}
{{- end }}
{{- if index (.Values.dinkyDefaultConfiguration) "log4j2.xml" }}
{{- index (.Values.dinkyDefaultConfiguration) "log4j2.xml" | nindent 4 -}}
{{- end }}
jmx_exporter_config.yaml: |+
{{- if .Values.dinkyDefaultConfiguration.append }}
{{- $.Files.Get "conf/jmx/jmx_exporter_config.yaml" | nindent 4 -}}
{{- end }}
{{- if index (.Values.dinkyDefaultConfiguration) "jmx_exporter_config.yaml" }}
{{- index (.Values.dinkyDefaultConfiguration) "jmx_exporter_config.yaml" | nindent 4 -}}
{{- end }}
{{- end }}
#
# 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
#
# https://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: {{ include "dinky.name" . }}
namespace: {{ .Release.Namespace | default "default"}}
labels:
{{- include "dinky.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.spec.replicaCount }}
selector:
matchLabels:
{{- include "dinky.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "dinky.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.spec.affinity }}
affinity:
{{- toYaml .Values.spec.affinity | nindent 8 }}
{{- end }}
{{- if .Values.spec.nodeSelector }}
nodeSelector:
{{- toYaml .Values.spec.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Values.spec.tolerations }}
tolerations:
{{- toYaml .Values.spec.tolerations | nindent 8 }}
{{- end }}
{{- if .Values.image.pullSecret }}
imagePullSecrets:
- name: {{ .Values.image.pullSecret }}
{{- end }}
serviceAccountName: {{ include "dinky.serviceAccountName" . }}
containers:
- image: {{ .Values.image.repository }}:{{ .Values.image.tag}}
name: {{ .Chart.Name }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: {{ .Values.spec.name }}
containerPort: {{ .Values.spec.containerPort }}
protocol: TCP
env:
{{- if .Values.mysql.enabled }}
- name: MYSQL_DATABASE
value: {{ .Values.mysql.auth.database }}
{{- else if .Values.postgresql.enabled }}
- name: POSTGRES_DB
value: {{ .Values.postgresql.auth.database }}
{{- else }}
{{ if eq .Values.externalDatabase.type "mysql" }}
- name: MYSQL_DATABASE
value: {{ .Values.externalDatabase.auth.database }}
{{- else }}
- name: POSTGRES_DB
value: {{ .Values.externalDatabase.auth.database }}
{{- end }}
{{- end }}
{{- include "dinky.dbActive" . | nindent 12 }}
envFrom:
{{- if .Values.mysql.enabled }}
- secretRef:
name: {{ include "dinky.name" . }}-mysql
{{- end }}
{{- if .Values.postgresql.enabled }}
- secretRef:
name: {{ include "dinky.name" . }}-postgres
{{- end }}
{{- if .Values.externalDatabase.enabled }}
{{ if eq .Values.externalDatabase.type "mysql" }}
- secretRef:
name: {{ include "dinky.name" . }}-mysql
{{- else }}
- secretRef:
name: {{ include "dinky.name" . }}-postgres
{{- end }}
{{- end }}
securityContext:
privileged: false
command:
- /bin/bash
- '-c'
- >-
/dinky/auto.sh startOnPending {{ .Values.spec.extraEnv.flinkVersion}}
args:
{{- if .Values.spec.livenessProbe.enabled }}
livenessProbe:
exec:
command: [ "curl", "-s", "http://localhost:{{ .Values.spec.containerPort }}/actuator/health/liveness" ]
initialDelaySeconds: {{ .Values.spec.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.spec.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.spec.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.spec.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.spec.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.spec.readinessProbe.enabled }}
readinessProbe:
exec:
command: [ "curl", "-s", "http://localhost:{{ .Values.spec.containerPort }}/actuator/health/readiness" ]
initialDelaySeconds: {{ .Values.spec.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.spec.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.spec.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.spec.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.spec.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
- mountPath: /dinky/conf/application.properties
name: dinky-config-volume
subPath: application.properties
- mountPath: /dinky/conf/application.yml
name: dinky-config-volume
subPath: application.yml
- mountPath: /dinky/conf/application-h2.yml
name: dinky-config-volume
subPath: application-h2.yml
- mountPath: /dinky/conf/application-jmx.yml
name: dinky-config-volume
subPath: application-jmx.yml
- mountPath: /dinky/conf/application-mysql.yml
name: dinky-config-volume
subPath: application-mysql.yml
- mountPath: /dinky/conf/application-pgsql.yml
name: dinky-config-volume
subPath: application-pgsql.yml
- mountPath: /dinky/conf/log4j2.xml
name: dinky-config-volume
subPath: log4j2.xml
- mountPath: /dinky/conf/jmx/jmx_exporter_config.yaml
name: dinky-config-volume
subPath: jmx_exporter_config.yaml
resources:
{{- toYaml .Values.spec.resources | nindent 12 }}
volumes:
- name: dinky-config-volume
configMap:
name: dinky-config
items:
- key: application.properties
path: application.properties
- key: application.yml
path: application.yml
- key: application-h2.yml
path: application-h2.yml
- key: application-jmx.yml
path: application-jmx.yml
- key: application-mysql.yml
path: application-mysql.yml
- key: application-pgsql.yml
path: application-pgsql.yml
- key: log4j2.xml
path: log4j2.xml
- key: jmx_exporter_config.yaml
path: jmx_exporter_config.yaml
\ No newline at end of file
#
# 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
#
# https://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.
#
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "dinky.fullname" . -}}
{{- $svcPort := .Values.spec.containerPort -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "dinky.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
#
# 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
#
# https://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.
#
{{- define "dinky.rbacRules" }}
rules:
- apiGroups:
- "*"
resources:
- "*"
verbs:
- "*"
{{- end }}
---
{{- if .Values.rbac.create }}
---
{{- if .Values.watchNamespaces }}
{{- range .Values.watchNamespaces }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: dinky
namespace: {{ . }}
labels:
{{- include "dinky.labels" $ | nindent 4 }}
{{- template "dinky.rbacRules" $ }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: dinky-role-binding
namespace: {{ . }}
labels:
{{- include "dinky.labels" $ | nindent 4 }}
roleRef:
kind: Role
name: dinky
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ include "dinky.serviceAccountName" $ }}
namespace: {{ $.Release.Namespace }}
---
{{- end }}
{{ else }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: dinky-cluster
namespace: {{ .Release.Namespace }}
labels:
{{- include "dinky.labels" . | nindent 4 }}
{{- template "dinky.rbacRules" $ }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: dinky-cluster-role-binding
namespace: {{ .Release.Namespace }}
labels:
{{- include "dinky.labels" . | nindent 4 }}
roleRef:
kind: ClusterRole
name: dinky-cluster
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ include "dinky.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
{{- if .Values.externalDatabase.enabled -}}
{{ if eq .Values.externalDatabase.type "mysql" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "dinky.name" . }}-mysql
data:
MYSQL_ADDR: {{ .Values.externalDatabase.url | b64enc | quote }}
MYSQL_USERNAME: {{ .Values.externalDatabase.auth.username | b64enc | quote }}
MYSQL_PASSWORD: {{ .Values.externalDatabase.auth.password | b64enc | quote }}
type: Opaque
{{- end }}
{{- end }}
\ No newline at end of file
{{- if .Values.externalDatabase.enabled -}}
{{ if eq .Values.externalDatabase.type "postgresql" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "dinky.name" . }}-postgres
data:
POSTGRES_ADDR: {{ .Values.externalDatabase.url | b64enc | quote }}
POSTGRES_USER: {{ .Values.externalDatabase.auth.username | b64enc | quote }}
POSTGRES_PASSWORD: {{ .Values.externalDatabase.auth.password | b64enc | quote }}
type: Opaque
{{- end }}
{{- end }}
\ No newline at end of file
{{- if .Values.mysql.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "dinky.name" . }}-mysql
data:
MYSQL_ADDR: {{ .Values.mysql.url | b64enc | quote }}
MYSQL_USERNAME: {{ .Values.mysql.auth.username | b64enc | quote }}
MYSQL_PASSWORD: {{ .Values.mysql.auth.password | b64enc | quote }}
type: Opaque
{{- end }}
\ No newline at end of file
{{- if .Values.postgresql.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "dinky.name" . }}-postgres
data:
POSTGRES_ADDR: {{ .Values.postgresql.url | b64enc | quote }}
POSTGRES_USER: {{ .Values.postgresql.auth.username | b64enc | quote }}
POSTGRES_PASSWORD: {{ .Values.postgresql.auth.password | b64enc | quote }}
type: Opaque
{{- end }}
\ No newline at end of file
{{- if .Values.externalDatabase.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}-external-svc
spec:
clusterIP: {{ .Values.externalDatabaseService.clusterIP }}
ports:
- port: {{ .Values.externalDatabaseService.port }}
targetPort: {{ .Values.externalDatabaseService.port }}
protocol: TCP
---
apiVersion: v1
kind: Endpoints
metadata:
name: {{ .Values.service.name }}-external-svc
subsets:
- addresses:
- ip: {{ .Values.externalDatabaseEndpoints.ip }}
ports:
- port: {{ .Values.externalDatabaseEndpoints.port }}
{{- end }}
\ No newline at end of file
#
# 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
#
# https://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: Service
metadata:
name: {{ .Values.service.name }}
labels:
{{- include "dinky.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.spec.containerPort }}
targetPort: {{ .Values.spec.name }}
protocol: TCP
name: {{ .Values.spec.name }}
selector:
{{- include "dinky.selectorLabels" . | nindent 4 }}
#
# 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
#
# https://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.
#
---
{{- if .Values.dinkyServiceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "dinky.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "dinky.labels" . | nindent 4 }}
{{- with .Values.dinkyServiceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
#
# 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.
#
#
timezone: "Asia/Shanghai"
nameOverride: ""
fullnameOverride: ""
image:
repository: "docker.dinky.org.cn:32451/dinky/dev/dinky-txh"
pullPolicy: "Always"
tag: "1.0.2"
pullSecret: ""
mysql:
enabled: false
url: "172.168.1.111:31476"
auth:
username: "dinky"
password: "bigdata123!@#"
database: "dinky-dev-1-17"
postgresql:
enabled: false
url: "172.168.1.111:31476"
auth:
username: "dinky"
password: "bigdata123!@#"
database: "dinky-dev-1-17"
externalDatabase:
enabled: true
type: "mysql"
url: "10.43.2.12:3306"
auth:
username: "root"
password: "Dinky@1234567!"
database: "dinky"
externalDatabaseService:
clusterIP: 10.43.2.12
port: 3306
externalDatabaseEndpoints:
ip: 172.168.1.110
port: 3306
rbac:
create: true
spec:
replicaCount: 1
containerPort: 8888
name: rest
extraEnv:
flinkVersion: "1.17"
affinity: {}
nodeSelector: {}
tolerations: []
resources: {}
# resources:
# limits:
# memory: "2Gi"
# cpu: "1"
# requests:
# memory: "1Gi"
# cpu: "500m"
livenessProbe:
enabled: true
initialDelaySeconds: "90"
periodSeconds: "30"
timeoutSeconds: "20"
failureThreshold: "3"
successThreshold: "1"
readinessProbe:
enabled: true
initialDelaySeconds: "90"
periodSeconds: "30"
timeoutSeconds: "20"
failureThreshold: "3"
successThreshold: "1"
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: demo.dinky.org.cn
paths:
- path: /
pathType: ImplementationSpecific
tls: []
service:
## type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer
type: "ClusterIP"
name: "dinky"
dinkyDefaultConfiguration:
create: true
append: true
dinkyServiceAccount:
create: true
annotations: {}
name: "dinky"
\ No newline at end of file
......@@ -280,6 +280,13 @@
<include>Dockerfile</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.parent.basedir}/deploy</directory>
<outputDirectory>deploy</outputDirectory>
<includes>
<include>**/**</include>
</includes>
</fileSet>
<!--<fileSet>
<directory>${project.parent.basedir}/dinky-web/dist</directory>
<outputDirectory>html</outputDirectory>
......
ARG FLINK_VERSION
ARG DINKY_IMAGE
FROM flink:${FLINK_VERSION} as reqired-stage
FROM ${DINKY_IMAGE} as build-stage
FROM openjdk:8u342-oracle as production-stage
USER root
ARG FLINK_BIG_VERSION
ENV FLINK_BIG_VERSION=${FLINK_BIG_VERSION}
COPY --from=build-stage /opt/dinky/ /opt/dinky/
COPY --from=reqired-stage /opt/flink/lib/*.jar /opt/dinky/extends/flink${FLINK_BIG_VERSION}/
RUN rm -f /opt/dinky/extends/flink${FLINK_BIG_VERSION}/flink-table-planner-loader*.jar
COPY --from=reqired-stage /opt/flink/opt/flink-table-planner*.jar /opt/dinky/extends/flink${FLINK_BIG_VERSION}/
WORKDIR /opt/dinky/
EXPOSE 8888
CMD ./auto.sh restart ${FLINK_BIG_VERSION} && tail -f /opt/dinky/logs/dinky.log
---
sidebar_position: 4
position: 4
id: kubernetes_deploy
title: kubernetes 部署
---
Kubernetes 部署目的是在 Kubernetes 集群中部署 dinky 服务,能快速、便捷在生产中部署。
## 前置条件
- Helm 3.1.0+
- Kubernetes 1.12+
## 安装 dinky
### 下载安装包
https://www.dinky.org.cn/download/download
### 修改配置
#### 修改镜像地址
cd dinky-release-${FLINK-VERSION}-${DINKY-VERSION}/deploy/kubernetes/helm/dinky
```yaml
image:
repository: "docker.dinky.org.cn:32451/dinky/dev/dinky-txh"
pullPolicy: "Always"
tag: "1.0.2"
pullSecret: ""
```
#### 内部数据源(同一个k8环境中部署mysql服务)
修改values.yaml 为mysql数据源
```yaml
mysql:
enabled: true
url: "172.168.1.111:31476"
auth:
username: "dinky"
password: "bigdata123!@#"
database: "dinky-dev-1-17"
```
如果数据源为postgresql,则修改如下
```yaml
postgresql:
enabled: true
url: "172.168.1.111:31476"
auth:
username: "dinky"
password: "bigdata123!@#"
database: "dinky-dev-1-17"
```
修改flink版本,如下修改为1.17版本
```yaml
spec:
replicaCount: 1
containerPort: 8888
name: rest
extraEnv:
flinkVersion: "1.17"
```
例如,mysql数据源完整配置如下:
完整配置如下:
```yaml
#
# 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.
#
#
timezone: "Asia/Shanghai"
nameOverride: ""
fullnameOverride: ""
image:
repository: "docker.dinky.org.cn:32451/dinky/dev/dinky-txh"
pullPolicy: "Always"
tag: "1.0.2"
pullSecret: ""
mysql:
enabled: true
url: "172.168.1.111:31476"
auth:
username: "dinky"
password: "bigdata123!@#"
database: "dinky-dev-1-17"
postgresql:
enabled: false
url: "172.168.1.111:31476"
auth:
username: "dinky"
password: "bigdata123!@#"
database: "dinky-dev-1-17"
externalDatabase:
enabled: false
type: "mysql"
url: "10.43.2.12:3306"
auth:
username: "root"
password: "Dinky@1234567!"
database: "dinky"
externalDatabaseService:
clusterIP: 10.43.2.12
port: 3306
externalDatabaseEndpoints:
ip: 172.168.1.110
port: 3306
rbac:
create: true
spec:
replicaCount: 1
containerPort: 8888
name: rest
extraEnv:
flinkVersion: "1.17"
affinity: {}
nodeSelector: {}
tolerations: []
resources: {}
# resources:
# limits:
# memory: "2Gi"
# cpu: "1"
# requests:
# memory: "1Gi"
# cpu: "500m"
livenessProbe:
enabled: true
initialDelaySeconds: "90"
periodSeconds: "30"
timeoutSeconds: "20"
failureThreshold: "3"
successThreshold: "1"
readinessProbe:
enabled: true
initialDelaySeconds: "90"
periodSeconds: "30"
timeoutSeconds: "20"
failureThreshold: "3"
successThreshold: "1"
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: demo.dinky.org.cn
paths:
- path: /
pathType: ImplementationSpecific
tls: []
service:
## type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer
type: "ClusterIP"
name: "dinky"
dinkyDefaultConfiguration:
create: true
append: true
dinkyServiceAccount:
create: true
annotations: {}
name: "dinky"
```
注意:数据源只能启用一个,不能同时启用mysql和postgresql
#### 外部数据源
修改k8s集群外mysql服务配置
```yaml
externalDatabaseEndpoints:
ip: 172.168.1.110
port: 3306
```
修改k8s集群内映射mysql服务配置
```yaml
externalDatabaseService:
clusterIP: 10.43.2.12
port: 3306
```
修改mysql服务配置
```yaml
externalDatabase:
enabled: true
type: "mysql"
url: "10.43.2.12:3306"
auth:
username: "root"
password: "Dinky@1234567!"
database: "dinky"
```
完整案例如下:
```yaml
#
# 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.
#
#
timezone: "Asia/Shanghai"
nameOverride: ""
fullnameOverride: ""
image:
repository: "docker.dinky.org.cn:32451/dinky/dev/dinky-txh"
pullPolicy: "Always"
tag: "1.0.2"
pullSecret: ""
mysql:
enabled: false
url: "172.168.1.111:31476"
auth:
username: "dinky"
password: "bigdata123!@#"
database: "dinky-dev-1-17"
postgresql:
enabled: false
url: "172.168.1.111:31476"
auth:
username: "dinky"
password: "bigdata123!@#"
database: "dinky-dev-1-17"
externalDatabase:
enabled: true
type: "mysql"
url: "10.43.2.12:3306"
auth:
username: "root"
password: "Dinky@1234567!"
database: "dinky"
externalDatabaseService:
clusterIP: 10.43.2.12
port: 3306
externalDatabaseEndpoints:
ip: 172.168.1.110
port: 3306
rbac:
create: true
spec:
replicaCount: 1
containerPort: 8888
name: rest
extraEnv:
flinkVersion: "1.17"
affinity: {}
nodeSelector: {}
tolerations: []
resources: {}
# resources:
# limits:
# memory: "2Gi"
# cpu: "1"
# requests:
# memory: "1Gi"
# cpu: "500m"
livenessProbe:
enabled: true
initialDelaySeconds: "90"
periodSeconds: "30"
timeoutSeconds: "20"
failureThreshold: "3"
successThreshold: "1"
readinessProbe:
enabled: true
initialDelaySeconds: "90"
periodSeconds: "30"
timeoutSeconds: "20"
failureThreshold: "3"
successThreshold: "1"
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: demo.dinky.org.cn
paths:
- path: /
pathType: ImplementationSpecific
tls: []
service:
## type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer
type: "ClusterIP"
name: "dinky"
dinkyDefaultConfiguration:
create: true
append: true
dinkyServiceAccount:
create: true
annotations: {}
name: "dinky"
```
### 部署
将名为 dinky 的版本(release) 发布到 dinky 的命名空间中:
```shell
cd dinky-release-${FLINK-VERSION}-${DINKY-VERSION}/deploy/kubernetes/helm/dinky
helm install dinky . -n dinky
```
### 卸载
```shell
cd dinky-release-${FLINK-VERSION}-${DINKY-VERSION}/deploy/kubernetes/helm/dinky
helm uninstall dinky -n dinky
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment