Commit f1e9e808 authored by 智勇's avatar 智勇

环境所有者

parent 56bfbb17
......@@ -66,7 +66,7 @@ const syncDB = async (cluster) => {
module.exports = () => {
// schedule.scheduleJob('*/2 * * * *', async () => {
schedule.scheduleJob('0 1 * * *', async () => {
schedule.scheduleJob('0 23 * * *', async () => {
try {
await syncDB('qa')
} catch (e) {
......
......@@ -30,18 +30,3 @@ router.post('/create', async (ctx) => {
await createNamespace(ctx.client, ctx.request.body.name, ctx.request.body.description)
ctx.body = ctx.ok()
})
// function generateUUID() {
// let d = new Date().getTime();
// const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
// const r = (d + Math.random() * 16) % 16 | 0;
// d = Math.floor(d / 16);
// return (c === 'x' ? r : ((r & 0x3) | 0x8)).toString(16);
// });
// return uuid;
// }
//
// router.get('/get_code', async (ctx) => {
// newNsKey = newNsKey === '' ? generateUUID() : newNsKey
// ctx.body = ctx.ok(newNsKey)
// })
......@@ -35,7 +35,7 @@ const deploy = async (cluster) => {
const repoName = svc.image.split(':')[0].split('/').slice(1).join('/')
const latest = await container.getTagByName(repoName, 'latest')
const latestImageID = _.get(latest.tagInfo, '[0].tagId', '')
if (svc.imageID.split('@')[1] !== latestImageID) {
if (latestImageID && latestImageID !== svc.imageID.split('@')[1]) {
logger.info('latest不一致,部署项目', namespace.name, svc.podName)
summary[namespace.name].latestArray.push(svc.serviceName)
await serviceRestart(client.clientInfo, namespace.name, svc.podName)
......@@ -86,7 +86,7 @@ const deploy = async (cluster) => {
module.exports = () => {
// schedule.scheduleJob('*/2 * * * *', async () => {
schedule.scheduleJob('0 3 * * *', async () => {
schedule.scheduleJob('0 1 * * *', async () => {
try {
await deploy('qa')
} catch (e) {
......
......@@ -17,6 +17,7 @@ const getAllNamespace = async (client) => {
data.namespaces.push({
name: item.metadata.name,
description: item.metadata.annotations ? item.metadata.annotations.description : '',
owner: item.metadata.annotations ? item.metadata.annotations.owner : '',
status: item.status ? item.status.phase : '',
createdAt: moment(item.metadata.creationTimestamp)
.format('YYYY-MM-DD HH:mm:ss'),
......
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