Commit a87800a9 authored by 智勇's avatar 智勇

新增java readinessProbe

parent fbd45b87
......@@ -47,7 +47,7 @@ router.get('/', async (ctx) => {
const createService = async (ctx) => {
const {
type, serviceName, namespace, system_name, domain, label,
type, serviceName, namespace, domain, label,
} = ctx.request.body
logger.info('创建服务', ctx.request.body)
......@@ -58,7 +58,6 @@ const createService = async (ctx) => {
const data = ctx.request.body
data.resources = resources
if (label === 'base' || label === 'ui' || label === 'node') {
await serviceCreate(data)
if (label !== 'base') {
if (serviceName === 'xyqb-user2') {
......@@ -67,8 +66,20 @@ const createService = async (ctx) => {
await ingressCreate(namespace, serviceName, domain)
}
ctx.body = ctx.ok('创建成功')
return
}
}
const createServiceTencent = async (ctx) => {
const {
type, serviceName, namespace, system_name, domain, label,
} = ctx.request.body
logger.info('创建服务', ctx.request.body)
// 资源限制
const resources = projectConfig[serviceName] || defaultConfig[type]
logger.info('资源限制', JSON.stringify(resources))
const data = ctx.request.body
data.resources = resources
if (!system_name) {
// ui abTest的时候不一样
......
......@@ -3,6 +3,7 @@ const Client = require('kubernetes-client').Client
const config = require('kubernetes-client').config
const _ = require('lodash')
const yaml = require('js-yaml')
const logger = require('koa-log4').getLogger('kubeService')
const yamls = require('../yamls')
const client = new Client({
......@@ -28,7 +29,6 @@ const serviceCreate = async (data) => {
for (const item of yamlArray) {
const jsonObj = yaml.load(item);
console.log(JSON.stringify(jsonObj))
let pvc
let pvcName
......@@ -39,6 +39,7 @@ const serviceCreate = async (data) => {
break;
case 'Deployment':
logger.info('Deployment:', JSON.stringify(jsonObj))
await client.apis.apps.v1beta1.namespaces(namespace).deployments.post({ body: jsonObj })
break;
......
......@@ -36,6 +36,15 @@ spec:
limits:
cpu: {{resources.cpu.limit}}m
memory: {{resources.memory.limit}}Mi
readinessProbe:
exec:
command:
- /home/quant_group/readyCheck.sh
initialDelaySeconds: 60
timeoutSeconds: 2
periodSeconds: 5
successThreshold: 1
failureThreshold: 20
restartPolicy: Always
dnsPolicy: ClusterFirst
imagePullSecrets:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment