Commit 02e81750 authored by 智勇's avatar 智勇

自动更新全部ns

parent 0f5ab501
......@@ -10,7 +10,7 @@ const { serviceRestart, getServicesFormat, getAllNamespace } = require('../kubeS
const container = require('../services/tke.containerService').create()
const repoNS = ['qa-java', 'qa-ui', 'qa-node', 'qa-python']
const testNamespace = ['qa', 'fe', 'data', 'fis', 'xyqb2']
// const testNamespace = ['qa', 'fe', 'data', 'fis', 'xyqb2']
const client = new Client({
config: config.fromKubeconfig(
......@@ -27,9 +27,9 @@ const deploy = async () => {
const repoName = repo.reponame.split('/')[1]
const latest = await container.getTagByName(repo.reponame, 'latest')
const latestImageID = _.get(latest.tagInfo, '[0].tagId', '')
let ns = await getAllNamespace(client)
ns = ns.namespaces && ns.namespaces.filter(item => testNamespace.includes(item.name))
for (const namespace of ns) {
const ns = await getAllNamespace(client)
// ns = ns.namespaces && ns.namespaces.filter(item => testNamespace.includes(item.name))
for (const namespace of ns.namespaces) {
const svcs = await getServicesFormat(client, namespace.name)
for (const svc of svcs) {
if (svc.serviceName === repoName && svc.image.indexOf('latest') !== -1) {
......
......@@ -67,7 +67,8 @@ const dingTalkPush = async function (item, is_recover) {
+ `> 命名空间 : ${item.metadata.namespace}\n\n`
+ `> 异常原因 : ${message}\n\n`
+ `> 异常时间 : ${moment()
.format('YYYY-MM-DD HH:mm:ss')}\n\n`,
.format('YYYY-MM-DD HH:mm:ss')}\n\n`
+ `[查看详情](http://qa2.liangkebang.com/dockers/runingEnv/${item.metadata.namespace})`,
},
};
await awaitRequest({
......@@ -89,7 +90,7 @@ const checkRecoverPod = async () => {
const podname = resKeys[i].split('#')[1]
// 获取新的状态
if (podname.indexOf(resKeys[i].split('#')[1]) > -1) {
const Pod = await getPods(client,namespace)
const Pod = await getPods(client, namespace)
Pod.body.items.forEach(async (item) => {
if (item.metadata.name.indexOf(podname) > -1) {
if (item.status.conditions.length === 3) {
......
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