| @@ -1,6 +1,6 @@ | |||||
| #!/bin/bash | #!/bin/bash | ||||
| baseDir="/home/somuns/ci4s" | |||||
| baseDir="/data/code/manage-platform" | |||||
| #判断$1是否为all,如果是,则编译所有模块,否则只编译management-platform模块 | #判断$1是否为all,如果是,则编译所有模块,否则只编译management-platform模块 | ||||
| @@ -1,11 +1,9 @@ | |||||
| #!/bin/bash | #!/bin/bash | ||||
| baseDir="/home/somuns/ci4s" | |||||
| baseDir="/data/code/manage-platform" | |||||
| cd ${baseDir}/react-ui | cd ${baseDir}/react-ui | ||||
| npm config set registry https://registry.npmmirror.com/ | npm config set registry https://registry.npmmirror.com/ | ||||
| npm config set proxy http://172.20.32.253:3128 | |||||
| npm config set https-proxy http://172.20.32.253:3128 | |||||
| npm install --force | npm install --force | ||||
| @@ -38,7 +38,7 @@ if [[ ! " ${valid_services[@]} " =~ " $service " ]]; then | |||||
| fi | fi | ||||
| # 登录到目标环境 | # 登录到目标环境 | ||||
| baseDir="/home/somuns/ci4s" | |||||
| baseDir="/data/code/manage-platform" | |||||
| cd ${baseDir} | cd ${baseDir} | ||||
| # 创建目录 | # 创建目录 | ||||
| @@ -53,8 +53,7 @@ compile_front() { | |||||
| # 编译前端 | # 编译前端 | ||||
| docker run -v ${baseDir}:${baseDir} \ | docker run -v ${baseDir}:${baseDir} \ | ||||
| -e http_proxy=http://172.20.32.253:3128 -e https_proxy=http://172.20.32.253:3128 \ | |||||
| 172.20.32.187/ci4s/node:16.16.0 ${baseDir}/k8s/build-node.sh | |||||
| node:16.16.0 ${baseDir}/k8s/build-node.sh | |||||
| if [ $? -ne 0 ]; then | if [ $? -ne 0 ]; then | ||||
| echo "编译失败,请检查代码!" | echo "编译失败,请检查代码!" | ||||
| exit 1 | exit 1 | ||||
| @@ -71,9 +70,8 @@ compile_front() { | |||||
| compile_java() { | compile_java() { | ||||
| param=$1 | param=$1 | ||||
| # 编译java | # 编译java | ||||
| docker run -v ${baseDir}:${baseDir} -v /home/maven:/home/maven \ | |||||
| -e http_proxy=http://172.20.32.253:3128 -e https_proxy=http://172.20.32.253:3128 \ | |||||
| 172.20.32.187/ci4s/build:v3 ${baseDir}/k8s/build-java.sh $param | |||||
| docker run -v ${baseDir}:${baseDir} -v /home/maven:/root/.m2/repository \ | |||||
| maven:3.9 ${baseDir}/k8s/build-java.sh $param | |||||
| if [ $? -ne 0 ]; then | if [ $? -ne 0 ]; then | ||||
| echo "编译失败,请检查代码!" | echo "编译失败,请检查代码!" | ||||
| exit 1 | exit 1 | ||||
| @@ -4,7 +4,7 @@ | |||||
| startTime=$(date +%s) | startTime=$(date +%s) | ||||
| # 登录到目标环境 | # 登录到目标环境 | ||||
| baseDir="/home/somuns/ci4s" | |||||
| baseDir="/data/code/manage-platform" | |||||
| cd ${baseDir} | cd ${baseDir} | ||||
| #build | #build | ||||
| @@ -51,8 +51,8 @@ else | |||||
| exit 1 | exit 1 | ||||
| fi | fi | ||||
| baseDir=/home/somuns/ci4s | |||||
| tag=$(date +'%Y%m%d%H%M') | |||||
| baseDir=/data/code/manage-platform | |||||
| tag=$(date +'%Y%m%d')-arm | |||||
| remote_deploy_dir=/home/deploy/manage-platform | remote_deploy_dir=/home/deploy/manage-platform | ||||
| # 构建镜像函数 | # 构建镜像函数 | ||||
| @@ -125,52 +125,52 @@ build_and_deploy() { | |||||
| local yaml_file=$3 | local yaml_file=$3 | ||||
| build_image ${dockerfile} ${image} | build_image ${dockerfile} ${image} | ||||
| prepare_yaml ${yaml_file} ${image} | |||||
| deploy_service ${yaml_file} | |||||
| # prepare_yaml ${yaml_file} ${image} | |||||
| # deploy_service ${yaml_file} | |||||
| } | } | ||||
| if [ "$service" == "front" ]; then | if [ "$service" == "front" ]; then | ||||
| build_and_deploy "nginx-dockerfile" "172.20.32.187/ci4s/ci4s-front:${tag}" "k8s-12front.yaml" | |||||
| build_and_deploy "nginx-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-front:${tag}" "k8s-12front.yaml" | |||||
| fi | fi | ||||
| # 构建和部署 manage 服务 | # 构建和部署 manage 服务 | ||||
| if [ "$service" == "manage" ]; then | if [ "$service" == "manage" ]; then | ||||
| build_and_deploy "managent-dockerfile" "172.20.32.187/ci4s/ci4s-managent:${tag}" "k8s-7management.yaml" | |||||
| build_and_deploy "managent-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-managent:${tag}" "k8s-7management.yaml" | |||||
| fi | fi | ||||
| if [ "$service" == "auth" ]; then | if [ "$service" == "auth" ]; then | ||||
| #部署认证中心 | #部署认证中心 | ||||
| build_and_deploy "auth-dockerfile" "172.20.32.187/ci4s/ci4s-auth:${tag}" "k8s-5auth.yaml" | |||||
| build_and_deploy "auth-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-auth:${tag}" "k8s-5auth.yaml" | |||||
| fi | fi | ||||
| if [ "$service" == "gateway" ]; then | if [ "$service" == "gateway" ]; then | ||||
| #部署网关 | #部署网关 | ||||
| build_and_deploy "gateway-dockerfile" "172.20.32.187/ci4s/ci4s-gateway:${tag}" "k8s-4gateway.yaml" | |||||
| build_and_deploy "gateway-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-gateway:${tag}" "k8s-4gateway.yaml" | |||||
| fi | fi | ||||
| if [ "$service" == "system" ]; then | if [ "$service" == "system" ]; then | ||||
| #部署系统服务 | #部署系统服务 | ||||
| build_and_deploy "system-dockerfile" "172.20.32.187/ci4s/ci4s-system:${tag}" "k8s-6system.yaml" | |||||
| build_and_deploy "system-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-system:${tag}" "k8s-6system.yaml" | |||||
| fi | fi | ||||
| # 构建和部署 front 服务 | # 构建和部署 front 服务 | ||||
| if [ "$service" == "manage-front" ]; then | if [ "$service" == "manage-front" ]; then | ||||
| build_and_deploy "nginx-dockerfile" "172.20.32.187/ci4s/ci4s-front:${tag}" "k8s-12front.yaml" | |||||
| build_and_deploy "managent-dockerfile" "172.20.32.187/ci4s/ci4s-managent:${tag}" "k8s-7management.yaml" | |||||
| build_and_deploy "nginx-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-front:${tag}" "k8s-12front.yaml" | |||||
| build_and_deploy "managent-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-managent:${tag}" "k8s-7management.yaml" | |||||
| fi | fi | ||||
| if [ "$service" == "all" ]; then | if [ "$service" == "all" ]; then | ||||
| #部署前端 | #部署前端 | ||||
| build_and_deploy "nginx-dockerfile" "172.20.32.187/ci4s/ci4s-front:${tag}" "k8s-12front.yaml" | |||||
| build_and_deploy "nginx-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-front:${tag}" "k8s-12front.yaml" | |||||
| #部署管理平台 | #部署管理平台 | ||||
| build_and_deploy "managent-dockerfile" "172.20.32.187/ci4s/ci4s-managent:${tag}" "k8s-7management.yaml" | |||||
| build_and_deploy "managent-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-managent:${tag}" "k8s-7management.yaml" | |||||
| #部署认证中心 | #部署认证中心 | ||||
| build_and_deploy "auth-dockerfile" "172.20.32.187/ci4s/ci4s-auth:${tag}" "k8s-5auth.yaml" | |||||
| build_and_deploy "auth-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-auth:${tag}" "k8s-5auth.yaml" | |||||
| #部署网关 | #部署网关 | ||||
| build_and_deploy "gateway-dockerfile" "172.20.32.187/ci4s/ci4s-gateway:${tag}" "k8s-4gateway.yaml" | |||||
| build_and_deploy "gateway-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-gateway:${tag}" "k8s-4gateway.yaml" | |||||
| #部署系统服务 | #部署系统服务 | ||||
| build_and_deploy "system-dockerfile" "172.20.32.187/ci4s/ci4s-system:${tag}" "k8s-6system.yaml" | |||||
| build_and_deploy "system-dockerfile" "ccr.ccs.tencentyun.com/somunslotus/ci4s-system:${tag}" "k8s-6system.yaml" | |||||
| #部署配置中心 | #部署配置中心 | ||||
| deploy_nacos "k8s-3nacos.yaml" | deploy_nacos "k8s-3nacos.yaml" | ||||
| fi | fi | ||||
| @@ -1,6 +1,7 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| #FROM openjdk:8-jre | |||||
| FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| FROM openjdk:8-jre | |||||
| #FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -1,6 +1,7 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| #FROM openjdk:8-jre | |||||
| #FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| FROM openjdk:8-jre | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -1,6 +1,7 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| #FROM openjdk:8-jre | |||||
| FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| FROM openjdk:8-jre | |||||
| #FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -1,6 +1,7 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| #FROM openjdk:8-jre | |||||
| FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| FROM openjdk:8-jre | |||||
| #FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -1,6 +1,7 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| #FROM openjdk:8-jre | |||||
| FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| FROM openjdk:8-jre | |||||
| #FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -1,6 +1,8 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| #FROM 172.20.32.187/ci4s/openjdk:8u162 | |||||
| FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| #FROM openjdk:8-jre | |||||
| #FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| FROM ccr.ccs.tencentyun.com/somunslotus/jdk:20241025-arm | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -13,4 +15,4 @@ WORKDIR /home/ruoyi | |||||
| # 复制jar文件到路径 | # 复制jar文件到路径 | ||||
| COPY ./jar/management-platform.jar /home/ruoyi/management-platform.jar | COPY ./jar/management-platform.jar /home/ruoyi/management-platform.jar | ||||
| # 启动系统服务 | # 启动系统服务 | ||||
| ENTRYPOINT ["java","-jar","-Djdk.tls.client.protocols=TLSv1.2","management-platform.jar"] | |||||
| ENTRYPOINT ["java","-jar","-Djdk.tls.client.protocols=TLSv1.2","-Dfile.encoding=UTF-8","management-platform.jar"] | |||||
| @@ -1,6 +1,6 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| #FROM nginx:latest | |||||
| FROM 172.20.32.187/ci4s/nginx:latest | |||||
| FROM nginx:latest | |||||
| #FROM 172.20.32.187/ci4s/nginx:latest | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -1,6 +1,7 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| #FROM openjdk:8-jre | |||||
| FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| FROM openjdk:8-jre | |||||
| #FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -1,6 +1,7 @@ | |||||
| # 基础镜像 | # 基础镜像 | ||||
| #FROM openjdk:8-jre | |||||
| FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| FROM openjdk:8-jre | |||||
| #FROM 172.20.32.187/ci4s/openjdk-dvc:2024829 | |||||
| # author | # author | ||||
| MAINTAINER ruoyi | MAINTAINER ruoyi | ||||
| @@ -0,0 +1,36 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-gen-deployment | |||||
| namespace: ci4s-test | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-gen | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-gen | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-gen | |||||
| image: ${k8s-10gen-image} | |||||
| ports: | |||||
| - containerPort: 9202 | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-gen-service | |||||
| namespace: ci4s-test | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 9202 | |||||
| nodePort: 31211 | |||||
| protocol: TCP | |||||
| selector: | |||||
| app: ci4s-gen | |||||
| @@ -0,0 +1,36 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-visual-deployment | |||||
| namespace: ci4s-test | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-visual | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-visual | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-visual | |||||
| image: ${k8s-11visual-image} | |||||
| ports: | |||||
| - containerPort: 9100 | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-visual-service | |||||
| namespace: ci4s-test | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 9100 | |||||
| nodePort: 31212 | |||||
| protocol: TCP | |||||
| selector: | |||||
| app: ci4s-visual | |||||
| @@ -0,0 +1,36 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-front-deployment | |||||
| namespace: argo | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-front | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-front | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-front | |||||
| image: ccr.ccs.tencentyun.com/somunslotus/ci4s-front:20241024-arm | |||||
| ports: | |||||
| - containerPort: 8000 | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-front-service | |||||
| namespace: argo | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 8000 | |||||
| nodePort: 31213 | |||||
| protocol: TCP | |||||
| selector: | |||||
| app: ci4s-front | |||||
| @@ -0,0 +1,71 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| namespace: argo | |||||
| name: nacos-ci4s | |||||
| labels: | |||||
| app: nacos-ci4s | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: nacos-ci4s | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: nacos-ci4s | |||||
| spec: | |||||
| containers: | |||||
| - name: nacos-ci4s | |||||
| image: nacos/nacos-server:v2.2.0 | |||||
| env: | |||||
| - name: SPRING_DATASOURCE_PLATFORM | |||||
| value: mysql | |||||
| - name: MODE | |||||
| value: standalone | |||||
| - name: MYSQL_SERVICE_HOST | |||||
| value: mysql.argo.svc | |||||
| - name: MYSQL_SERVICE_PORT | |||||
| value: "3306" | |||||
| - name: MYSQL_SERVICE_DB_NAME | |||||
| value: nacos-ci4s-config | |||||
| - name: MYSQL_SERVICE_USER | |||||
| value: root | |||||
| - name: MYSQL_SERVICE_PASSWORD | |||||
| value: qazxc123456. | |||||
| ports: | |||||
| - containerPort: 8848 | |||||
| - containerPort: 9848 | |||||
| - containerPort: 9849 | |||||
| initContainers: | |||||
| - name: init-mydb | |||||
| image: busybox:1.31 | |||||
| command: [ 'sh', '-c', 'nc -zv mysql.argo.svc 3306' ] | |||||
| restartPolicy: Always | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| namespace: argo | |||||
| name: nacos-ci4s | |||||
| labels: | |||||
| app: nacos-ci4s | |||||
| spec: | |||||
| type: NodePort | |||||
| selector: | |||||
| app: nacos-ci4s | |||||
| ports: | |||||
| - port: 8848 | |||||
| targetPort: 8848 | |||||
| nodePort: 31203 | |||||
| name: web | |||||
| - port: 9848 | |||||
| targetPort: 9848 | |||||
| nodePort: 32203 | |||||
| name: podsa | |||||
| - port: 9849 | |||||
| targetPort: 9849 | |||||
| nodePort: 32204 | |||||
| name: tcp-9849 | |||||
| @@ -0,0 +1,36 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-gateway-deployment | |||||
| namespace: argo | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-gateway | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-gateway | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-gateway | |||||
| image: ccr.ccs.tencentyun.com/somunslotus/ci4s-gateway:20241024-arm | |||||
| ports: | |||||
| - containerPort: 8082 | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-gateway-service | |||||
| namespace: argo | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 8082 | |||||
| nodePort: 31205 | |||||
| protocol: TCP | |||||
| selector: | |||||
| app: ci4s-gateway | |||||
| @@ -0,0 +1,36 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-auth-deployment | |||||
| namespace: argo | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-auth | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-auth | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-auth | |||||
| image: ccr.ccs.tencentyun.com/somunslotus/ci4s-auth:20241024-arm | |||||
| ports: | |||||
| - containerPort: 9200 | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-auth-service | |||||
| namespace: argo | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 9200 | |||||
| nodePort: 31206 | |||||
| protocol: TCP | |||||
| selector: | |||||
| app: ci4s-auth | |||||
| @@ -0,0 +1,36 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-system-deployment | |||||
| namespace: argo | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-system | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-system | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-system | |||||
| image: ccr.ccs.tencentyun.com/somunslotus/ci4s-system:20241024-arm | |||||
| ports: | |||||
| - containerPort: 9201 | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-system-service | |||||
| namespace: argo | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 9201 | |||||
| nodePort: 31207 | |||||
| protocol: TCP | |||||
| selector: | |||||
| app: ci4s-system | |||||
| @@ -0,0 +1,54 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-management-platform-deployment | |||||
| namespace: argo | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-management-platform | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-management-platform | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-management-platform | |||||
| image: ccr.ccs.tencentyun.com/somunslotus/ci4s-managent:20241024-arm | |||||
| env: | |||||
| - name: TZ | |||||
| value: Asia/Shanghai | |||||
| - name: JAVA_TOOL_OPTIONS | |||||
| value: "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005" | |||||
| ports: | |||||
| - containerPort: 9213 | |||||
| volumeMounts: | |||||
| - name: resource-volume | |||||
| mountPath: /home/resource/ | |||||
| subPath: mini-model-platform-data | |||||
| volumes: | |||||
| - name: resource-volume | |||||
| hostPath: | |||||
| path: /platform-data | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-management-platform-service | |||||
| namespace: argo | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - name: http | |||||
| port: 9213 | |||||
| nodePort: 31208 | |||||
| protocol: TCP | |||||
| - name: debug | |||||
| nodePort: 31219 | |||||
| port: 5005 | |||||
| protocol: TCP | |||||
| targetPort: 5005 | |||||
| selector: | |||||
| app: ci4s-management-platform | |||||
| @@ -0,0 +1,36 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-file-deployment | |||||
| namespace: ci4s-test | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-file | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-file | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-file | |||||
| image: ${k8s-8file-image} | |||||
| ports: | |||||
| - containerPort: 9300 | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-file-service | |||||
| namespace: ci4s-test | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 9300 | |||||
| nodePort: 31209 | |||||
| protocol: TCP | |||||
| selector: | |||||
| app: ci4s-file | |||||
| @@ -0,0 +1,36 @@ | |||||
| apiVersion: apps/v1 | |||||
| kind: Deployment | |||||
| metadata: | |||||
| name: ci4s-job-deployment | |||||
| namespace: ci4s-test | |||||
| spec: | |||||
| replicas: 1 | |||||
| selector: | |||||
| matchLabels: | |||||
| app: ci4s-job | |||||
| template: | |||||
| metadata: | |||||
| labels: | |||||
| app: ci4s-job | |||||
| spec: | |||||
| containers: | |||||
| - name: ci4s-job | |||||
| image: ${k8s-9job-image} | |||||
| ports: | |||||
| - containerPort: 9203 | |||||
| --- | |||||
| apiVersion: v1 | |||||
| kind: Service | |||||
| metadata: | |||||
| name: ci4s-job-service | |||||
| namespace: ci4s-test | |||||
| spec: | |||||
| type: NodePort | |||||
| ports: | |||||
| - port: 9203 | |||||
| nodePort: 31210 | |||||
| protocol: TCP | |||||
| selector: | |||||
| app: ci4s-job | |||||
| @@ -23,7 +23,10 @@ import { type GlobalInitialState } from '@/types'; | |||||
| import { menuItemRender } from '@/utils/menuRender'; | import { menuItemRender } from '@/utils/menuRender'; | ||||
| import ErrorBoundary from './components/ErrorBoundary'; | import ErrorBoundary from './components/ErrorBoundary'; | ||||
| import { needAuth } from './utils'; | import { needAuth } from './utils'; | ||||
| import { gotoLoginPage } from './utils/ui'; | |||||
| import { gotoLoginPage, logoutHuoShi } from './utils/ui'; | |||||
| // 记录上一次的路由地址 | |||||
| let fromPathname = ''; | |||||
| /** | /** | ||||
| * @see https://umijs.org/zh-CN/plugins/plugin-initial-state | * @see https://umijs.org/zh-CN/plugins/plugin-initial-state | ||||
| @@ -160,16 +163,21 @@ export const layout: RuntimeConfig['layout'] = ({ initialState }) => { | |||||
| }; | }; | ||||
| export const onRouteChange: RuntimeConfig['onRouteChange'] = async (e) => { | export const onRouteChange: RuntimeConfig['onRouteChange'] = async (e) => { | ||||
| const { location } = e; | |||||
| const { location, isFirst } = e; | |||||
| const toPathname = location.pathname; | |||||
| const menus = getRemoteMenu(); | const menus = getRemoteMenu(); | ||||
| console.log('onRouteChange', menus); | |||||
| if (menus === null && needAuth(location.pathname)) { | |||||
| // console.log('onRouteChange', e); | |||||
| if (menus === null && needAuth(toPathname)) { | |||||
| history.go(0); | history.go(0); | ||||
| } else if (fromPathname !== toPathname && fromPathname === '/appsDeployment' && !isFirst) { | |||||
| logoutHuoShi(); | |||||
| console.log('logoutHuoShi'); | |||||
| } | } | ||||
| fromPathname = location.pathname; | |||||
| }; | }; | ||||
| export const patchRoutes: RuntimeConfig['patchRoutes'] = (e) => { | export const patchRoutes: RuntimeConfig['patchRoutes'] = (e) => { | ||||
| //console.log('patchRoutes', e); | |||||
| console.log('patchRoutes', e); | |||||
| }; | }; | ||||
| export const patchClientRoutes: RuntimeConfig['patchClientRoutes'] = (e) => { | export const patchClientRoutes: RuntimeConfig['patchClientRoutes'] = (e) => { | ||||
| @@ -1,8 +1,10 @@ | |||||
| import FullScreenFrame from '@/components/FullScreenFrame'; | import FullScreenFrame from '@/components/FullScreenFrame'; | ||||
| import KFSpin from '@/components/KFSpin'; | import KFSpin from '@/components/KFSpin'; | ||||
| import { getLabelStudioUrl } from '@/services/developmentEnvironment'; | import { getLabelStudioUrl } from '@/services/developmentEnvironment'; | ||||
| import { generateSign } from '@/utils'; | |||||
| import { to } from '@/utils/promise'; | import { to } from '@/utils/promise'; | ||||
| import SessionStorage from '@/utils/sessionStorage'; | import SessionStorage from '@/utils/sessionStorage'; | ||||
| import { useModel } from '@umijs/max'; | |||||
| import classNames from 'classnames'; | import classNames from 'classnames'; | ||||
| import { useEffect, useState } from 'react'; | import { useEffect, useState } from 'react'; | ||||
| import { createPortal } from 'react-dom'; | import { createPortal } from 'react-dom'; | ||||
| @@ -15,12 +17,20 @@ export enum IframePageType { | |||||
| GitLink = 'GitLink', | GitLink = 'GitLink', | ||||
| } | } | ||||
| const getRequestAPI = (type: IframePageType): (() => Promise<any>) => { | |||||
| const getRequestAPI = (type: IframePageType, loginName: string): (() => Promise<any>) => { | |||||
| switch (type) { | switch (type) { | ||||
| case IframePageType.DatasetAnnotation: | case IframePageType.DatasetAnnotation: | ||||
| return getLabelStudioUrl; | return getLabelStudioUrl; | ||||
| case IframePageType.AppDevelopment: | |||||
| return () => Promise.resolve({ code: 200, data: 'http://172.20.32.185:30080/' }); | |||||
| case IframePageType.AppDevelopment: { | |||||
| // return () => Promise.resolve({ code: 200, data: 'http://172.20.32.185:30080/' }); | |||||
| const sign = generateSign(loginName); | |||||
| return () => | |||||
| Promise.resolve({ | |||||
| code: 200, | |||||
| data: `http://10.43.107.27:24078/uap/nudt/sso/login?name=${loginName}&sign=${sign}`, | |||||
| }); | |||||
| } | |||||
| case IframePageType.DevEnv: | case IframePageType.DevEnv: | ||||
| return () => | return () => | ||||
| Promise.resolve({ | Promise.resolve({ | ||||
| @@ -41,6 +51,9 @@ type IframePageProps = { | |||||
| function IframePage({ type, className, style }: IframePageProps) { | function IframePage({ type, className, style }: IframePageProps) { | ||||
| const [iframeUrl, setIframeUrl] = useState(''); | const [iframeUrl, setIframeUrl] = useState(''); | ||||
| const [loading, setLoading] = useState(false); | const [loading, setLoading] = useState(false); | ||||
| const { initialState } = useModel('@@initialState'); | |||||
| const { currentUser } = initialState || {}; | |||||
| useEffect(() => { | useEffect(() => { | ||||
| requestIframeUrl(); | requestIframeUrl(); | ||||
| return () => { | return () => { | ||||
| @@ -51,7 +64,7 @@ function IframePage({ type, className, style }: IframePageProps) { | |||||
| }, []); | }, []); | ||||
| const requestIframeUrl = async () => { | const requestIframeUrl = async () => { | ||||
| setLoading(true); | setLoading(true); | ||||
| const [res] = await to(getRequestAPI(type)()); | |||||
| const [res] = await to(getRequestAPI(type, currentUser?.userName || '')()); | |||||
| if (res && res.data) { | if (res && res.data) { | ||||
| setIframeUrl(res.data); | setIframeUrl(res.data); | ||||
| } else { | } else { | ||||
| @@ -22,7 +22,6 @@ function Authorize() { | |||||
| code, | code, | ||||
| }; | }; | ||||
| const [res] = await to(loginByOauth2Req(params)); | const [res] = await to(loginByOauth2Req(params)); | ||||
| debugger; | |||||
| if (res && res.data) { | if (res && res.data) { | ||||
| const { access_token, expires_in } = res.data; | const { access_token, expires_in } = res.data; | ||||
| setSessionToken(access_token, access_token, expires_in); | setSessionToken(access_token, access_token, expires_in); | ||||
| @@ -6,6 +6,7 @@ | |||||
| import { PageEnum } from '@/enums/pagesEnums'; | import { PageEnum } from '@/enums/pagesEnums'; | ||||
| import G6 from '@antv/g6'; | import G6 from '@antv/g6'; | ||||
| import CryptoJS from 'crypto-js'; | |||||
| // 生成 8 位随机数 | // 生成 8 位随机数 | ||||
| export function s8() { | export function s8() { | ||||
| @@ -241,3 +242,24 @@ export const tableSorter = (a: any, b: any) => { | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| }; | }; | ||||
| // 生成火石平台 sign | |||||
| export const generateSign = (loginName: string) => { | |||||
| // 16-character custom password | |||||
| const key = '8c4ddb8cb50ade0e'; | |||||
| const content = `${loginName}-${Math.floor(Date.now() / 1000)}`; | |||||
| // Generate the AES key (16 bytes for AES-128 or 32 bytes for AES-256) | |||||
| const byteKey = CryptoJS.enc.Utf8.parse(key); | |||||
| // Encrypt the content | |||||
| const encrypted = CryptoJS.AES.encrypt(content, byteKey, { | |||||
| mode: CryptoJS.mode.ECB, | |||||
| padding: CryptoJS.pad.Pkcs7, | |||||
| }); | |||||
| const encryptedHex = encrypted.ciphertext.toString(CryptoJS.enc.Hex); | |||||
| return encryptedHex; | |||||
| }; | |||||
| @@ -142,3 +142,14 @@ export const scrollToBottom = (element: HTMLElement | null, smooth: boolean = tr | |||||
| element.scrollTo(optons); | element.scrollTo(optons); | ||||
| } | } | ||||
| }; | }; | ||||
| // 退出火石平台 | |||||
| export const logoutHuoShi = () => { | |||||
| const iframe = document.createElement('iframe'); | |||||
| iframe.style.display = 'none'; | |||||
| iframe.src = 'http://10.43.107.27:24078/uap/nudt/sso/logout'; | |||||
| document.body.appendChild(iframe); | |||||
| setTimeout(() => { | |||||
| document.body.removeChild(iframe); | |||||
| }, 2000); | |||||
| }; | |||||
| @@ -33,9 +33,4 @@ spring: | |||||
| refresh: true | refresh: true | ||||
| - data-id: ${spring.application.name}-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | - data-id: ${spring.application.name}-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} | ||||
| group: DEFAULT_GROUP | group: DEFAULT_GROUP | ||||
| refresh: true | |||||
| redis: | |||||
| host: 172.20.32.150 | |||||
| port: 6379 | |||||
| password: | |||||
| refresh: true | |||||
| @@ -5,6 +5,7 @@ import com.ruoyi.platform.service.GitService; | |||||
| import com.ruoyi.platform.utils.JacksonUtil; | import com.ruoyi.platform.utils.JacksonUtil; | ||||
| import com.ruoyi.platform.utils.JsonUtils; | import com.ruoyi.platform.utils.JsonUtils; | ||||
| import com.ruoyi.platform.utils.NewHttpUtils; | import com.ruoyi.platform.utils.NewHttpUtils; | ||||
| import com.ruoyi.platform.utils.RedisUtil; | |||||
| import com.ruoyi.platform.vo.GitProjectVo; | import com.ruoyi.platform.vo.GitProjectVo; | ||||
| import com.ruoyi.system.api.model.LoginUser; | import com.ruoyi.system.api.model.LoginUser; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -26,14 +27,12 @@ import java.util.Map; | |||||
| @Service | @Service | ||||
| public class GitServiceImpl implements GitService { | public class GitServiceImpl implements GitService { | ||||
| @Value("${spring.redis.host}") | |||||
| private String redisHost; | |||||
| @Value("${spring.redis.port}") | |||||
| private Integer redisPort; | |||||
| @Value("${git.endpoint}") | @Value("${git.endpoint}") | ||||
| String gitendpoint; | String gitendpoint; | ||||
| @Resource | @Resource | ||||
| private NewHttpUtils httpUtils; | private NewHttpUtils httpUtils; | ||||
| @Resource | |||||
| private RedisUtil redisUtil; | |||||
| private static final Logger log = LoggerFactory.getLogger(GitServiceImpl.class); | private static final Logger log = LoggerFactory.getLogger(GitServiceImpl.class); | ||||
| @Override | @Override | ||||
| @@ -66,7 +65,7 @@ public class GitServiceImpl implements GitService { | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String ci4sUsername = loginUser.getUsername(); | String ci4sUsername = loginUser.getUsername(); | ||||
| // 将access_token存入Redis | // 将access_token存入Redis | ||||
| Jedis jedis = new Jedis(redisHost, redisPort); | |||||
| Jedis jedis = redisUtil.getJedis(); | |||||
| jedis.set(ci4sUsername + "_gitToken", accessToken); | jedis.set(ci4sUsername + "_gitToken", accessToken); | ||||
| jedis.set(ci4sUsername + "_gitUserInfo", userReq); | jedis.set(ci4sUsername + "_gitUserInfo", userReq); | ||||
| return accessToken; | return accessToken; | ||||
| @@ -77,7 +76,7 @@ public class GitServiceImpl implements GitService { | |||||
| } | } | ||||
| public String checkoutToken() { | public String checkoutToken() { | ||||
| Jedis jedis = new Jedis(redisHost, redisPort); | |||||
| Jedis jedis = redisUtil.getJedis(); | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String ci4sUsername = loginUser.getUsername(); | String ci4sUsername = loginUser.getUsername(); | ||||
| String token = jedis.get(ci4sUsername + "_gitToken"); | String token = jedis.get(ci4sUsername + "_gitToken"); | ||||
| @@ -98,10 +98,9 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| @Resource | @Resource | ||||
| private MinioUtil minioUtil; | private MinioUtil minioUtil; | ||||
| @Value("${spring.redis.host}") | |||||
| private String redisHost; | |||||
| @Value("${spring.redis.port}") | |||||
| private Integer redisPort; | |||||
| @Resource | |||||
| private RedisUtil redisUtil; | |||||
| @Value("${git.endpoint}") | @Value("${git.endpoint}") | ||||
| String gitendpoint; | String gitendpoint; | ||||
| @Value("${git.localPath}") | @Value("${git.localPath}") | ||||
| @@ -1273,7 +1272,7 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| } | } | ||||
| Map<String, Object> getUserInfo(String ci4sUsername, String gitLinkUsername, String gitLinkPassword) throws IOException { | Map<String, Object> getUserInfo(String ci4sUsername, String gitLinkUsername, String gitLinkPassword) throws IOException { | ||||
| Jedis jedis = new Jedis(redisHost, redisPort); | |||||
| Jedis jedis = redisUtil.getJedis(); | |||||
| String userReq = jedis.get(ci4sUsername + "_gitUserInfo"); | String userReq = jedis.get(ci4sUsername + "_gitUserInfo"); | ||||
| if (userReq == null) { | if (userReq == null) { | ||||
| gitService.login(gitLinkUsername, gitLinkPassword); | gitService.login(gitLinkUsername, gitLinkPassword); | ||||
| @@ -51,10 +51,6 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||||
| @Resource | @Resource | ||||
| private GitService gitService; | private GitService gitService; | ||||
| @Value("${spring.redis.host}") | |||||
| private String redisHost; | |||||
| @Value("${spring.redis.port}") | |||||
| private Integer redisPort; | |||||
| @Value("${minio.accessKey}") | @Value("${minio.accessKey}") | ||||
| String accessKeyId; | String accessKeyId; | ||||
| @Value("${minio.secretKey}") | @Value("${minio.secretKey}") | ||||
| @@ -77,10 +73,13 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||||
| @Resource | @Resource | ||||
| private MinioUtil minioUtil; | private MinioUtil minioUtil; | ||||
| @Resource | |||||
| private RedisUtil redisUtil; | |||||
| @Override | @Override | ||||
| public String newCreateDataset(NewDatasetVo datasetVo) throws Exception { | public String newCreateDataset(NewDatasetVo datasetVo) throws Exception { | ||||
| String token = gitService.checkoutToken(); | String token = gitService.checkoutToken(); | ||||
| Jedis jedis = new Jedis(redisHost, redisPort); | |||||
| Jedis jedis = redisUtil.getJedis(); | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String ci4sUsername = loginUser.getUsername(); | String ci4sUsername = loginUser.getUsername(); | ||||
| String gitLinkUsername = loginUser.getSysUser().getGitLinkUsername(); | String gitLinkUsername = loginUser.getSysUser().getGitLinkUsername(); | ||||
| @@ -175,7 +174,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||||
| public String newCreateVersion(NewDatasetVo datasetVo) throws Exception { | public String newCreateVersion(NewDatasetVo datasetVo) throws Exception { | ||||
| String token = gitService.checkoutToken(); | String token = gitService.checkoutToken(); | ||||
| Jedis jedis = new Jedis(redisHost, redisPort); | |||||
| Jedis jedis = redisUtil.getJedis(); | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String ci4sUsername = loginUser.getUsername(); | String ci4sUsername = loginUser.getUsername(); | ||||
| String gitLinkUsername = loginUser.getSysUser().getGitLinkUsername(); | String gitLinkUsername = loginUser.getSysUser().getGitLinkUsername(); | ||||
| @@ -290,7 +289,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||||
| @Override | @Override | ||||
| public Page<NewDatasetVo> newPersonalQueryByPage(Dataset dataset, PageRequest pageRequest) throws Exception { | public Page<NewDatasetVo> newPersonalQueryByPage(Dataset dataset, PageRequest pageRequest) throws Exception { | ||||
| String token = gitService.checkoutToken(); | String token = gitService.checkoutToken(); | ||||
| Jedis jedis = new Jedis(redisHost, redisPort); | |||||
| Jedis jedis = redisUtil.getJedis(); | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String ci4sUsername = loginUser.getUsername(); | String ci4sUsername = loginUser.getUsername(); | ||||
| String userReq = jedis.get(ci4sUsername + "_gitUserInfo"); | String userReq = jedis.get(ci4sUsername + "_gitUserInfo"); | ||||
| @@ -315,7 +314,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { | |||||
| @Override | @Override | ||||
| public Page<NewDatasetVo> newPubilcQueryByPage(Dataset dataset, PageRequest pageRequest) throws Exception { | public Page<NewDatasetVo> newPubilcQueryByPage(Dataset dataset, PageRequest pageRequest) throws Exception { | ||||
| String token = gitService.checkoutToken(); | String token = gitService.checkoutToken(); | ||||
| Jedis jedis = new Jedis(redisHost, redisPort); | |||||
| Jedis jedis = redisUtil.getJedis(); | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| String ci4sUsername = loginUser.getUsername(); | String ci4sUsername = loginUser.getUsername(); | ||||
| String userReq = jedis.get(ci4sUsername + "_gitUserInfo"); | String userReq = jedis.get(ci4sUsername + "_gitUserInfo"); | ||||
| @@ -4,6 +4,8 @@ import com.alibaba.fastjson2.JSON; | |||||
| import com.ruoyi.platform.constant.Constant; | import com.ruoyi.platform.constant.Constant; | ||||
| import com.ruoyi.platform.domain.DevEnvironment; | import com.ruoyi.platform.domain.DevEnvironment; | ||||
| import com.ruoyi.platform.mapper.ComputingResourceDao; | import com.ruoyi.platform.mapper.ComputingResourceDao; | ||||
| import io.fabric8.kubernetes.api.model.SecurityContext; | |||||
| import io.fabric8.kubernetes.api.model.SecurityContextBuilder; | |||||
| import io.kubernetes.client.Exec; | import io.kubernetes.client.Exec; | ||||
| import io.kubernetes.client.custom.IntOrString; | import io.kubernetes.client.custom.IntOrString; | ||||
| import io.kubernetes.client.custom.Quantity; | import io.kubernetes.client.custom.Quantity; | ||||
| @@ -12,7 +14,9 @@ import io.kubernetes.client.openapi.ApiException; | |||||
| import io.kubernetes.client.openapi.apis.AppsV1Api; | import io.kubernetes.client.openapi.apis.AppsV1Api; | ||||
| import io.kubernetes.client.openapi.apis.CoreV1Api; | import io.kubernetes.client.openapi.apis.CoreV1Api; | ||||
| import io.kubernetes.client.openapi.models.*; | import io.kubernetes.client.openapi.models.*; | ||||
| import io.kubernetes.client.util.ClientBuilder; | |||||
| import io.kubernetes.client.util.Config; | import io.kubernetes.client.util.Config; | ||||
| import io.kubernetes.client.util.credentials.AccessTokenAuthentication; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
| import org.json.JSONObject; | import org.json.JSONObject; | ||||
| @@ -356,14 +360,14 @@ public class K8sClientUtil { | |||||
| .withPorts(new V1ContainerPort().containerPort(port).protocol("TCP")) | .withPorts(new V1ContainerPort().containerPort(port).protocol("TCP")) | ||||
| .withVolumeMounts(new V1VolumeMount().name("workspace").mountPath(mountPath).subPath(subPath)) | .withVolumeMounts(new V1VolumeMount().name("workspace").mountPath(mountPath).subPath(subPath)) | ||||
| .withNewSecurityContext().withNewPrivileged(true).endSecurityContext() | .withNewSecurityContext().withNewPrivileged(true).endSecurityContext() | ||||
| .addNewEnv() | |||||
| .withName("HTTP_PROXY") | |||||
| .withValue("http://172.20.32.253:3128") | |||||
| .endEnv() | |||||
| .addNewEnv() | |||||
| .withName("HTTPS_PROXY") | |||||
| .withValue("http://172.20.32.253:3128") | |||||
| .endEnv() | |||||
| // .addNewEnv() | |||||
| // .withName("HTTP_PROXY") | |||||
| // .withValue("http://172.20.32.253:3128") | |||||
| // .endEnv() | |||||
| // .addNewEnv() | |||||
| // .withName("HTTPS_PROXY") | |||||
| // .withValue("http://172.20.32.253:3128") | |||||
| // .endEnv() | |||||
| .addNewEnv() | .addNewEnv() | ||||
| .withName("NO_PROXY") | .withName("NO_PROXY") | ||||
| .withValue("localhost,kubernetes.default.svc") | .withValue("localhost,kubernetes.default.svc") | ||||
| @@ -493,7 +497,7 @@ public class K8sClientUtil { | |||||
| .endContainer() | .endContainer() | ||||
| .withVolumes(volumes) | .withVolumes(volumes) | ||||
| .withNodeSelector(nodeSelector) | .withNodeSelector(nodeSelector) | ||||
| .withAffinity(v1Affinity) | |||||
| // .withAffinity(v1Affinity) | |||||
| .endSpec() | .endSpec() | ||||
| .build(); | .build(); | ||||
| @@ -625,8 +629,8 @@ public class K8sClientUtil { | |||||
| public V1Pod createPodWithEnv(String podName, String namespace, String proxyUrl, String mountPath, String pvcName, String image) { | public V1Pod createPodWithEnv(String podName, String namespace, String proxyUrl, String mountPath, String pvcName, String image) { | ||||
| CoreV1Api api = new CoreV1Api(apiClient); | CoreV1Api api = new CoreV1Api(apiClient); | ||||
| V1SecurityContext v1SecurityContext = new V1SecurityContext(); | |||||
| v1SecurityContext.setPrivileged(true); | |||||
| // V1SecurityContext v1SecurityContext = new V1SecurityContext(); | |||||
| // v1SecurityContext.setPrivileged(true); | |||||
| // 配置卷和卷挂载 | // 配置卷和卷挂载 | ||||
| List<V1VolumeMount> volumeMounts = new ArrayList<>(); | List<V1VolumeMount> volumeMounts = new ArrayList<>(); | ||||
| @@ -643,18 +647,18 @@ public class K8sClientUtil { | |||||
| .addNewContainer() | .addNewContainer() | ||||
| .withName(podName) | .withName(podName) | ||||
| .withImage(image) // 替换为您实际要使用的镜像名称 | .withImage(image) // 替换为您实际要使用的镜像名称 | ||||
| .withSecurityContext(v1SecurityContext) | |||||
| // .withSecurityContext(v1SecurityContext) | |||||
| // .withVolumeMounts(new V1VolumeMount().name("workspace").mountPath(mountPath)) | // .withVolumeMounts(new V1VolumeMount().name("workspace").mountPath(mountPath)) | ||||
| .withVolumeMounts(volumeMounts) | .withVolumeMounts(volumeMounts) | ||||
| .withNewSecurityContext().withNewPrivileged(true).endSecurityContext() | .withNewSecurityContext().withNewPrivileged(true).endSecurityContext() | ||||
| .addNewEnv() | |||||
| .withName("HTTP_PROXY") | |||||
| .withValue(proxyUrl) | |||||
| .endEnv() | |||||
| .addNewEnv() | |||||
| .withName("HTTPS_PROXY") | |||||
| .withValue(proxyUrl) | |||||
| .endEnv() | |||||
| // .addNewEnv() | |||||
| // .withName("HTTP_PROXY") | |||||
| // .withValue(proxyUrl) | |||||
| // .endEnv() | |||||
| // .addNewEnv() | |||||
| // .withName("HTTPS_PROXY") | |||||
| // .withValue(proxyUrl) | |||||
| // .endEnv() | |||||
| .addNewEnv() | .addNewEnv() | ||||
| .withName("NO_PROXY") | .withName("NO_PROXY") | ||||
| .withValue("localhost,kubernetes.default.svc") | .withValue("localhost,kubernetes.default.svc") | ||||
| @@ -0,0 +1,26 @@ | |||||
| package com.ruoyi.platform.utils; | |||||
| import org.springframework.beans.factory.annotation.Value; | |||||
| import org.springframework.stereotype.Component; | |||||
| import redis.clients.jedis.Jedis; | |||||
| @Component | |||||
| public class RedisUtil { | |||||
| @Value("${spring.redis.host}") | |||||
| private String redisHost; | |||||
| @Value("${spring.redis.port}") | |||||
| private Integer redisPort; | |||||
| @Value("${spring.redis.password}") | |||||
| private String redisPassword; | |||||
| public Jedis getJedis() { | |||||
| Jedis jedis = new Jedis(redisHost, redisPort); | |||||
| String response = jedis.auth(redisPassword); | |||||
| if ("OK".equals(response)) { | |||||
| return jedis; | |||||
| } else { | |||||
| throw new IllegalStateException("redis密码错误"); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -30,7 +30,7 @@ public class YamlUtils { | |||||
| DumperOptions options = new DumperOptions(); | DumperOptions options = new DumperOptions(); | ||||
| options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); | options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); | ||||
| options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); | options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); | ||||
| options.setAllowUnicode(true); | |||||
| // 创建Yaml实例 | // 创建Yaml实例 | ||||
| Yaml yaml = new Yaml(options); | Yaml yaml = new Yaml(options); | ||||
| @@ -46,8 +46,6 @@ public class YamlUtils { | |||||
| String fullPath = path + "/" + fileName + ".yaml"; | String fullPath = path + "/" + fileName + ".yaml"; | ||||
| try (FileWriter writer = new FileWriter(fullPath)) { | try (FileWriter writer = new FileWriter(fullPath)) { | ||||
| String dump = yaml.dump(data); | |||||
| yaml.dump(data, writer); | yaml.dump(data, writer); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||