Commit c671ba7d authored by 智勇's avatar 智勇

获取details单个属性

parent 3955248f
......@@ -91,11 +91,17 @@ router.post('/details', async (ctx) => {
.required(),
type: ctx.Joi.string()
.required(),
key: ctx.Joi.string(),
}))
const data = await getServiceDetail(ctx.client, ctx.request.body.namespace, ctx.request.body.serviceName, ctx.request.body.type)
const req = ctx.request.body
const data = await getServiceDetail(ctx.client, req.namespace, req.serviceName, req.type)
if (req.key && data[req.key]) {
ctx.body = data[req.key]
return
}
ctx.body = ctx.ok(data)
})
router.post('/delete', async (ctx) => {
const { namespace, serviceName, podName } = ctx.request.body
const key = `${namespace}:${podName}#${serviceName}`
......
......@@ -101,10 +101,14 @@ const serviceCreate = async (cluterParams, client, data) => {
if (data.wechat === '"1"') {
manifest.spec.type = 'NodePort'
}
logger.info('创建svc', JSON.stringify(manifest))
await client.api.v1.namespaces(namespace)
.services
.post({ body: manifest })
try {
logger.info('创建svc', JSON.stringify(manifest))
await client.api.v1.namespaces(namespace)
.services
.post({ body: manifest })
} catch (error) {
logger.warn(error.toString())
}
break;
case 'Deployment':
......@@ -340,10 +344,12 @@ const serviceDelete = async (client, namespace, name) => {
await client.apis.apps.v1beta1.namespaces(namespace)
.deployments(name)
.delete()
logger.info('删除svc', namespace, name)
await client.api.v1.namespaces(namespace)
.services(name)
.delete()
if (!~name.indexOf('mysql')) {
logger.info('删除svc', namespace, name)
await client.api.v1.namespaces(namespace)
.services(name)
.delete()
}
} catch (error) {
logger.warn(error.toString())
}
......@@ -365,10 +371,12 @@ const replicaSetDelete = async (client, namespace, name) => {
}
const pvcDelete = async (client, namespace, name) => {
try {
logger.info('删除pvc', namespace, name)
await client.api.v1.namespaces(namespace)
.persistentvolumeclaim(`${name}-${namespace}`)
.delete()
if (!~name.indexOf('mysql')) {
logger.info('删除pvc', namespace, name)
await client.api.v1.namespaces(namespace)
.persistentvolumeclaim(`${name}-${namespace}`)
.delete()
}
} catch (error) {
logger.warn(error.toString())
}
......
......@@ -13,6 +13,8 @@ spec:
port: 80
- name: '5005'
port: 5005
# - name: '20880'
# port: 20880
selector:
qcloud-app: {{serviceName}}
......@@ -64,14 +66,14 @@ spec:
value: {{debug}}
- name: MOCK
value: {{mock}}
- name: DUBBO_PORT_TO_BIND
value: '80'
- name: DUBBO_PORT_TO_REGISTRY
value: '80'
- name: DUBBO_IP_TO_REGISTRY
valueFrom:
fieldRef:
fieldPath: status.hostIP
# - name: DUBBO_PORT_TO_BIND
# value: '80'
# - name: DUBBO_PORT_TO_REGISTRY
# value: '80'
# - name: DUBBO_IP_TO_REGISTRY
# valueFrom:
# fieldRef:
# fieldPath: status.hostIP
resources:
requests:
cpu: {{resources.cpuRequest}}m
......
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