From 67b7a7e76274606aa6aa3ed00a0ac65e78a52214 Mon Sep 17 00:00:00 2001 From: XiuhongTang Date: Wed, 22 May 2024 22:44:34 +0800 Subject: [PATCH] [feature] add kubernetes deploy (#3516) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 唐修红 --- {docker => deploy/docker}/.env | 0 {docker => deploy/docker}/Dockerfile | 0 deploy/docker/DockerfileDinkyFlink | 42 ++ {docker => deploy/docker}/DockerfileMysql | 0 {docker => deploy/docker}/DockerfileWeb | 0 {docker => deploy/docker}/README.md | 0 {docker => deploy/docker}/README_zh_CN.md | 0 .../docker}/docker-compose.dev.yml | 8 +- {docker => deploy/docker}/docker-compose.yml | 0 {docker => deploy/docker}/web/default.conf | 0 {docker => deploy/docker}/web/nginx.conf | 0 deploy/kubernetes/helm/dinky/.helmignore | 23 ++ deploy/kubernetes/helm/dinky/Chart.yaml | 26 ++ .../helm/dinky/conf/application-flyway.yml | 33 ++ .../helm/dinky/conf/application-h2.yml | 33 ++ .../helm/dinky/conf/application-jmx.yml | 42 ++ .../helm/dinky/conf/application-mysql.yml | 23 ++ .../helm/dinky/conf/application-pgsql.yml | 24 ++ .../helm/dinky/conf/application.yml | 167 ++++++++ .../dinky/conf/jmx/jmx_exporter_config.yaml | 14 + deploy/kubernetes/helm/dinky/conf/log4j2.xml | 86 +++++ .../kubernetes/helm/dinky/templates/NOTES.txt | 34 ++ .../helm/dinky/templates/_helpers.tpl | 71 ++++ .../helm/dinky/templates/configmap.yaml | 82 ++++ .../helm/dinky/templates/dinky.yaml | 169 ++++++++ .../helm/dinky/templates/ingress.yaml | 77 ++++ .../kubernetes/helm/dinky/templates/rbac.yaml | 86 +++++ .../secret-external-mysql-database.yaml | 13 + .../secret-external-postgres-database.yaml | 13 + .../templates/secret-mysql-database.yaml | 11 + .../templates/secret-postgres-database.yaml | 11 + .../templates/service-external-database.yaml | 22 ++ .../helm/dinky/templates/service.yaml | 31 ++ .../helm/dinky/templates/serviceaccount.yaml | 30 ++ deploy/kubernetes/helm/dinky/values.yaml | 126 ++++++ dinky-assembly/src/main/assembly/package.xml | 7 + docker/DockerfileDinkyFlink | 24 -- docs/docs/deploy_guide/kubernetes_deploy.md | 363 ++++++++++++++++++ 38 files changed, 1663 insertions(+), 28 deletions(-) rename {docker => deploy/docker}/.env (100%) rename {docker => deploy/docker}/Dockerfile (100%) create mode 100644 deploy/docker/DockerfileDinkyFlink rename {docker => deploy/docker}/DockerfileMysql (100%) rename {docker => deploy/docker}/DockerfileWeb (100%) rename {docker => deploy/docker}/README.md (100%) rename {docker => deploy/docker}/README_zh_CN.md (100%) rename {docker => deploy/docker}/docker-compose.dev.yml (87%) rename {docker => deploy/docker}/docker-compose.yml (100%) rename {docker => deploy/docker}/web/default.conf (100%) rename {docker => deploy/docker}/web/nginx.conf (100%) create mode 100755 deploy/kubernetes/helm/dinky/.helmignore create mode 100755 deploy/kubernetes/helm/dinky/Chart.yaml create mode 100755 deploy/kubernetes/helm/dinky/conf/application-flyway.yml create mode 100755 deploy/kubernetes/helm/dinky/conf/application-h2.yml create mode 100755 deploy/kubernetes/helm/dinky/conf/application-jmx.yml create mode 100755 deploy/kubernetes/helm/dinky/conf/application-mysql.yml create mode 100755 deploy/kubernetes/helm/dinky/conf/application-pgsql.yml create mode 100755 deploy/kubernetes/helm/dinky/conf/application.yml create mode 100755 deploy/kubernetes/helm/dinky/conf/jmx/jmx_exporter_config.yaml create mode 100755 deploy/kubernetes/helm/dinky/conf/log4j2.xml create mode 100755 deploy/kubernetes/helm/dinky/templates/NOTES.txt create mode 100755 deploy/kubernetes/helm/dinky/templates/_helpers.tpl create mode 100755 deploy/kubernetes/helm/dinky/templates/configmap.yaml create mode 100755 deploy/kubernetes/helm/dinky/templates/dinky.yaml create mode 100755 deploy/kubernetes/helm/dinky/templates/ingress.yaml create mode 100755 deploy/kubernetes/helm/dinky/templates/rbac.yaml create mode 100644 deploy/kubernetes/helm/dinky/templates/secret-external-mysql-database.yaml create mode 100644 deploy/kubernetes/helm/dinky/templates/secret-external-postgres-database.yaml create mode 100644 deploy/kubernetes/helm/dinky/templates/secret-mysql-database.yaml create mode 100644 deploy/kubernetes/helm/dinky/templates/secret-postgres-database.yaml create mode 100755 deploy/kubernetes/helm/dinky/templates/service-external-database.yaml create mode 100755 deploy/kubernetes/helm/dinky/templates/service.yaml create mode 100755 deploy/kubernetes/helm/dinky/templates/serviceaccount.yaml create mode 100755 deploy/kubernetes/helm/dinky/values.yaml delete mode 100644 docker/DockerfileDinkyFlink create mode 100644 docs/docs/deploy_guide/kubernetes_deploy.md diff --git a/docker/.env b/deploy/docker/.env similarity index 100% rename from docker/.env rename to deploy/docker/.env diff --git a/docker/Dockerfile b/deploy/docker/Dockerfile similarity index 100% rename from docker/Dockerfile rename to deploy/docker/Dockerfile diff --git a/deploy/docker/DockerfileDinkyFlink b/deploy/docker/DockerfileDinkyFlink new file mode 100644 index 0000000000..744b408dd1 --- /dev/null +++ b/deploy/docker/DockerfileDinkyFlink @@ -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. +# + +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 diff --git a/docker/DockerfileMysql b/deploy/docker/DockerfileMysql similarity index 100% rename from docker/DockerfileMysql rename to deploy/docker/DockerfileMysql diff --git a/docker/DockerfileWeb b/deploy/docker/DockerfileWeb similarity index 100% rename from docker/DockerfileWeb rename to deploy/docker/DockerfileWeb diff --git a/docker/README.md b/deploy/docker/README.md similarity index 100% rename from docker/README.md rename to deploy/docker/README.md diff --git a/docker/README_zh_CN.md b/deploy/docker/README_zh_CN.md similarity index 100% rename from docker/README_zh_CN.md rename to deploy/docker/README_zh_CN.md diff --git a/docker/docker-compose.dev.yml b/deploy/docker/docker-compose.dev.yml similarity index 87% rename from docker/docker-compose.dev.yml rename to deploy/docker/docker-compose.dev.yml index 4cf467fb04..4275d2e1b0 100644 --- a/docker/docker-compose.dev.yml +++ b/deploy/docker/docker-compose.dev.yml @@ -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 diff --git a/docker/docker-compose.yml b/deploy/docker/docker-compose.yml similarity index 100% rename from docker/docker-compose.yml rename to deploy/docker/docker-compose.yml diff --git a/docker/web/default.conf b/deploy/docker/web/default.conf similarity index 100% rename from docker/web/default.conf rename to deploy/docker/web/default.conf diff --git a/docker/web/nginx.conf b/deploy/docker/web/nginx.conf similarity index 100% rename from docker/web/nginx.conf rename to deploy/docker/web/nginx.conf diff --git a/deploy/kubernetes/helm/dinky/.helmignore b/deploy/kubernetes/helm/dinky/.helmignore new file mode 100755 index 0000000000..0e8a0eb36f --- /dev/null +++ b/deploy/kubernetes/helm/dinky/.helmignore @@ -0,0 +1,23 @@ +# 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/ diff --git a/deploy/kubernetes/helm/dinky/Chart.yaml b/deploy/kubernetes/helm/dinky/Chart.yaml new file mode 100755 index 0000000000..005558e732 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/Chart.yaml @@ -0,0 +1,26 @@ +# +# 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 diff --git a/deploy/kubernetes/helm/dinky/conf/application-flyway.yml b/deploy/kubernetes/helm/dinky/conf/application-flyway.yml new file mode 100755 index 0000000000..8eafc7acd0 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/conf/application-flyway.yml @@ -0,0 +1,33 @@ +# +# 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 + diff --git a/deploy/kubernetes/helm/dinky/conf/application-h2.yml b/deploy/kubernetes/helm/dinky/conf/application-h2.yml new file mode 100755 index 0000000000..f9ea212b83 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/conf/application-h2.yml @@ -0,0 +1,33 @@ +# +# 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 diff --git a/deploy/kubernetes/helm/dinky/conf/application-jmx.yml b/deploy/kubernetes/helm/dinky/conf/application-jmx.yml new file mode 100755 index 0000000000..0123634ab4 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/conf/application-jmx.yml @@ -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 +# +# 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 diff --git a/deploy/kubernetes/helm/dinky/conf/application-mysql.yml b/deploy/kubernetes/helm/dinky/conf/application-mysql.yml new file mode 100755 index 0000000000..6c71564216 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/conf/application-mysql.yml @@ -0,0 +1,23 @@ +# +# 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 diff --git a/deploy/kubernetes/helm/dinky/conf/application-pgsql.yml b/deploy/kubernetes/helm/dinky/conf/application-pgsql.yml new file mode 100755 index 0000000000..eff2bdf64a --- /dev/null +++ b/deploy/kubernetes/helm/dinky/conf/application-pgsql.yml @@ -0,0 +1,24 @@ +# +# 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 diff --git a/deploy/kubernetes/helm/dinky/conf/application.yml b/deploy/kubernetes/helm/dinky/conf/application.yml new file mode 100755 index 0000000000..a8c537a333 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/conf/application.yml @@ -0,0 +1,167 @@ +################################################################################################################# +################################################# 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: diff --git a/deploy/kubernetes/helm/dinky/conf/jmx/jmx_exporter_config.yaml b/deploy/kubernetes/helm/dinky/conf/jmx/jmx_exporter_config.yaml new file mode 100755 index 0000000000..e34f855467 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/conf/jmx/jmx_exporter_config.yaml @@ -0,0 +1,14 @@ +--- +lowercaseOutputLabelNames: true +lowercaseOutputName: true +whitelistObjectNames: ["java.lang:type=OperatingSystem"] +blacklistObjectNames: [] +rules: + - pattern: 'java.lang<>(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<>((?!process_cpu_time)\w+):' + name: os_$1 + type: GAUGE + attrNameSnakeCase: true \ No newline at end of file diff --git a/deploy/kubernetes/helm/dinky/conf/log4j2.xml b/deploy/kubernetes/helm/dinky/conf/log4j2.xml new file mode 100755 index 0000000000..088ef44587 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/conf/log4j2.xml @@ -0,0 +1,86 @@ + + + + + ${sys:dinky.logs.path:-./logs/} + dinky + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deploy/kubernetes/helm/dinky/templates/NOTES.txt b/deploy/kubernetes/helm/dinky/templates/NOTES.txt new file mode 100755 index 0000000000..6d3ea03ba4 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/NOTES.txt @@ -0,0 +1,34 @@ +# +# 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 }} diff --git a/deploy/kubernetes/helm/dinky/templates/_helpers.tpl b/deploy/kubernetes/helm/dinky/templates/_helpers.tpl new file mode 100755 index 0000000000..28b76097d9 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/_helpers.tpl @@ -0,0 +1,71 @@ +{{/* +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 diff --git a/deploy/kubernetes/helm/dinky/templates/configmap.yaml b/deploy/kubernetes/helm/dinky/templates/configmap.yaml new file mode 100755 index 0000000000..dbc25276e6 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/configmap.yaml @@ -0,0 +1,82 @@ +# +# 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 }} diff --git a/deploy/kubernetes/helm/dinky/templates/dinky.yaml b/deploy/kubernetes/helm/dinky/templates/dinky.yaml new file mode 100755 index 0000000000..d4485255fe --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/dinky.yaml @@ -0,0 +1,169 @@ +# +# 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 diff --git a/deploy/kubernetes/helm/dinky/templates/ingress.yaml b/deploy/kubernetes/helm/dinky/templates/ingress.yaml new file mode 100755 index 0000000000..09f52deb8a --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/ingress.yaml @@ -0,0 +1,77 @@ +# +# 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 }} diff --git a/deploy/kubernetes/helm/dinky/templates/rbac.yaml b/deploy/kubernetes/helm/dinky/templates/rbac.yaml new file mode 100755 index 0000000000..2917d40e64 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/rbac.yaml @@ -0,0 +1,86 @@ +# +# 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 }} diff --git a/deploy/kubernetes/helm/dinky/templates/secret-external-mysql-database.yaml b/deploy/kubernetes/helm/dinky/templates/secret-external-mysql-database.yaml new file mode 100644 index 0000000000..9717dd004d --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/secret-external-mysql-database.yaml @@ -0,0 +1,13 @@ +{{- 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 diff --git a/deploy/kubernetes/helm/dinky/templates/secret-external-postgres-database.yaml b/deploy/kubernetes/helm/dinky/templates/secret-external-postgres-database.yaml new file mode 100644 index 0000000000..45b3a3a7b5 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/secret-external-postgres-database.yaml @@ -0,0 +1,13 @@ +{{- 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 diff --git a/deploy/kubernetes/helm/dinky/templates/secret-mysql-database.yaml b/deploy/kubernetes/helm/dinky/templates/secret-mysql-database.yaml new file mode 100644 index 0000000000..0c44962644 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/secret-mysql-database.yaml @@ -0,0 +1,11 @@ +{{- 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 diff --git a/deploy/kubernetes/helm/dinky/templates/secret-postgres-database.yaml b/deploy/kubernetes/helm/dinky/templates/secret-postgres-database.yaml new file mode 100644 index 0000000000..169bb2a042 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/secret-postgres-database.yaml @@ -0,0 +1,11 @@ +{{- 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 diff --git a/deploy/kubernetes/helm/dinky/templates/service-external-database.yaml b/deploy/kubernetes/helm/dinky/templates/service-external-database.yaml new file mode 100755 index 0000000000..f1ef0d2709 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/service-external-database.yaml @@ -0,0 +1,22 @@ +{{- 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 diff --git a/deploy/kubernetes/helm/dinky/templates/service.yaml b/deploy/kubernetes/helm/dinky/templates/service.yaml new file mode 100755 index 0000000000..dfacc0615b --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/service.yaml @@ -0,0 +1,31 @@ +# +# 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 }} diff --git a/deploy/kubernetes/helm/dinky/templates/serviceaccount.yaml b/deploy/kubernetes/helm/dinky/templates/serviceaccount.yaml new file mode 100755 index 0000000000..d24c47fc62 --- /dev/null +++ b/deploy/kubernetes/helm/dinky/templates/serviceaccount.yaml @@ -0,0 +1,30 @@ +# +# 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 }} diff --git a/deploy/kubernetes/helm/dinky/values.yaml b/deploy/kubernetes/helm/dinky/values.yaml new file mode 100755 index 0000000000..a42994c46f --- /dev/null +++ b/deploy/kubernetes/helm/dinky/values.yaml @@ -0,0 +1,126 @@ +# +# 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 diff --git a/dinky-assembly/src/main/assembly/package.xml b/dinky-assembly/src/main/assembly/package.xml index 90594c0c16..ff54e604bc 100644 --- a/dinky-assembly/src/main/assembly/package.xml +++ b/dinky-assembly/src/main/assembly/package.xml @@ -280,6 +280,13 @@ Dockerfile + + ${project.parent.basedir}/deploy + deploy + + **/** + +