Commit 10509027 authored by 智勇's avatar 智勇

修复 detail 接口的 lanIp

parent 79de54e7
...@@ -106,8 +106,11 @@ router.post('/details', async (ctx) => { ...@@ -106,8 +106,11 @@ router.post('/details', async (ctx) => {
namespace: ctx.Joi.string().required(), namespace: ctx.Joi.string().required(),
})) }))
const res = await ctx.cluster.node_list() // const res = await ctx.cluster.node_list()
const lanIp = _.get(res, 'nodes[0].lanIp', '') // const lanIp = _.get(res, 'nodes[0].lanIp', '')
const podData = await podGet(ctx.query.namespace)
const lanIp = podData.body.items.filter(i => i.metadata.name.indexOf(ctx.query.serviceName) !== -1)[0].status.hostIP
const data = await ctx.cluster.service_get(ctx.request.body.serviceName, ctx.request.body.namespace) const data = await ctx.cluster.service_get(ctx.request.body.serviceName, ctx.request.body.namespace)
ctx.body = ctx.ok(Object.assign({}, data, { lanIp })) ctx.body = ctx.ok(Object.assign({}, data, { lanIp }))
......
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