Browse Source

Merge remote-tracking branch 'origin/dev' into arm-build

# Conflicts:
#	k8s/build_and_deploy.sh
pull/142/head
chenzhihang 1 year ago
parent
commit
d3d883abe7
3 changed files with 10 additions and 7 deletions
  1. +4
    -4
      k8s/build_and_deploy.sh
  2. +1
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java
  3. +5
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java

+ 4
- 4
k8s/build_and_deploy.sh View File

@@ -3,6 +3,10 @@
#记录开始时间
startTime=$(date +%s)

# 登录到目标环境
baseDir="/home/somuns/ci4s"
cd ${baseDir}

#build
# 默认参数
branch="master"
@@ -64,10 +68,6 @@ fi

chmod +777 ${baseDir}/k8s/*.sh

# 登录到目标环境
baseDir="/data/code/manage-platform"
cd ${baseDir}

echo "start build"
sh ${baseDir}/k8s/build.sh -b ${branch} -s ${service}
if [ $? -ne 0 ]; then


+ 1
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java View File

@@ -116,6 +116,7 @@ public class ServiceServiceImpl implements ServiceService {
LoginUser loginUser = SecurityUtils.getLoginUser();
serviceVersion.setCreateBy(loginUser.getUsername());
serviceVersion.setUpdateBy(loginUser.getUsername());
serviceVersion.setRunState(Constant.Pending);
serviceDao.insertServiceVersion(serviceVersion);
runServiceVersion(serviceVersion.getId());
return serviceVersion;


+ 5
- 3
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java View File

@@ -15,6 +15,7 @@ import io.kubernetes.client.openapi.apis.AppsV1Api;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.util.ClientBuilder;
import io.kubernetes.client.util.Config;
import io.kubernetes.client.util.credentials.AccessTokenAuthentication;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -64,9 +65,10 @@ public class K8sClientUtil {
this.http = http;
this.token = token;
try {
this.apiClient = new ClientBuilder().
setBasePath(http).setVerifyingSsl(false).
setAuthentication(new AccessTokenAuthentication(token)).build();
// this.apiClient = new ClientBuilder().
// setBasePath(http).setVerifyingSsl(false).
// setAuthentication(new AccessTokenAuthentication(token)).build();
this.apiClient = Config.fromCluster();
} catch (Exception e) {
log.error("构建K8s-Client异常", e);
throw new RuntimeException("构建K8s-Client异常");


Loading…
Cancel
Save