Skip to content

Commit

Permalink
feat(console): logstash v2
Browse files Browse the repository at this point in the history
  • Loading branch information
tfan authored and tke-robot committed Jun 22, 2020
1 parent 6271181 commit a5f0ad1
Show file tree
Hide file tree
Showing 54 changed files with 1,729 additions and 630 deletions.
22 changes: 19 additions & 3 deletions web/console/Wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,13 @@ const commonRouterConfig: RouterConfig[] = [
},
{
url: '/tkestack/log',
title: '日志',
watchModule: ConsoleModuleEnum.PLATFORM
title: '日志采集',
watchModule: ConsoleModuleEnum.PLATFORM,
},
{
url: '/tkestack/log/setting',
title: '日志组件',
watchModule: ConsoleModuleEnum.PLATFORM,
},
{
url: '/tkestack/persistent-event',
Expand Down Expand Up @@ -221,9 +226,20 @@ const businessCommonRouterConfig: RouterConfig[] = [
url: '/tkestack-project/notify',
title: '通知设置',
watchModule: ConsoleModuleEnum.Notify
},
],
},
{
title: '运维中心',
watchModule: [ConsoleModuleEnum.PLATFORM],
subRouterConfig: [
{
url: '/tkestack-project/log',
title: '日志采集',
watchModule: ConsoleModuleEnum.PLATFORM
}
]
}
},
];

interface ConsoleWrapperProps {
Expand Down
9 changes: 9 additions & 0 deletions web/console/config/apiServerVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,12 @@ export const auditServerVersion = {
group: 'audit.tkestack.io',
version: 'v1'
};

/**
* 新日志模块
*/
export const logAgentServiceVersion = {
basicUrl: 'apis',
group: 'logagent.tkestack.io',
version: 'v1'
};
10 changes: 8 additions & 2 deletions web/console/config/resource/common/apiVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
authServerVersion,
monitorServerVersion,
auditServerVersion,
logAgentServiceVersion,
} from '../../apiServerVersion';
import { t, Trans } from '@tencent/tea-app/lib/i18n';
import { ConsoleModuleEnum } from '../../../Wrapper';
Expand Down Expand Up @@ -48,6 +49,7 @@ export interface ApiVersion {
machines?: ResourceApiInfo;
helm?: ResourceApiInfo;
logcs?: ResourceApiInfo;
logagent?: ResourceApiInfo;
clustercredential?: ResourceApiInfo;
auth_project?: ResourceApiInfo;

Expand Down Expand Up @@ -446,14 +448,18 @@ const k8sApiVersionFor18: ApiVersion = {
watchModule: ConsoleModuleEnum.PLATFORM,
headTitle: 'Helm'
},

logcs: {
group: 'tke.cloud.tencent.com',
version: 'v1',
basicEntry: 'apis',
headTitle: 'LogCollector'
},

logagent: {
group: logAgentServiceVersion.group,
version: logAgentServiceVersion.version,
basicEntry: logAgentServiceVersion.basicUrl,
headTitle: 'LogAgent'
},
clustercredential: {
group: apiServerVersion.group,
version: apiServerVersion.version,
Expand Down
11 changes: 11 additions & 0 deletions web/console/config/resource/k8sConfig/otherResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ export const logcs = (k8sVersion: string) => {
});
};

/** logagent 的相关配置 */
export const logagent = (k8sVersion: string) => {
return generateResourceInfo({
k8sVersion,
resourceName: 'logagent',
requestType: {
list: 'logagents'
}
});
};

export const prometheus = (k8sVersion: string) => {
return generateResourceInfo({
k8sVersion,
Expand Down
2 changes: 2 additions & 0 deletions web/console/config/resourceConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
policy,
category,
logcs,
logagent,
addon,
addon_gpumanager,
addon_helm,
Expand Down Expand Up @@ -140,6 +141,7 @@ export const resourceConfig = (k8sVersion: string = '1.16'): ResourceConfigKey =
machines: getResourceConfig(machines, finalK8sVersion),
helm: getResourceConfig(helm, finalK8sVersion),
logcs: getResourceConfig(logcs, finalK8sVersion),
logagent: getResourceConfig(logagent, finalK8sVersion),
logout: getResourceConfig(logoutConfig, finalK8sVersion),
clustercredential: getResourceConfig(clustercredential, finalK8sVersion),

Expand Down
2 changes: 1 addition & 1 deletion web/console/config/routerConfig.project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const subRouterConfig = () => {
{
name: t('日志'),
path: 'k8sLog',
basicUrl: 'log'
basicUrl: 'log',
},
{
name: t('事件'),
Expand Down
10 changes: 8 additions & 2 deletions web/console/helpers/urlUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ interface K8sRestfulPathOptions {
/** 集群id,适用于addon 请求平台转发的场景 */
clusterId?: string;

/** 集群logAgentName */
logAgentName?: string;

meshId?: string;
}

Expand All @@ -128,6 +131,7 @@ export const reduceK8sRestfulPath = (options: K8sRestfulPathOptions) => {
specificName = '',
extraResource = '',
clusterId = '',
logAgentName = '',
meshId
} = options;

Expand All @@ -153,8 +157,10 @@ export const reduceK8sRestfulPath = (options: K8sRestfulPathOptions) => {
* 非addon(以deployment为例): /apis/apps/v1beta2/namespaces/${namespace}/deployments/${deployment}/${extraResource}
*/
if (isAddon) {
let clusterInfo: ResourceInfo = resourceConfig()['cluster'];
url = `/${clusterInfo.basicEntry}/${clusterInfo.group}/${clusterInfo.version}/${clusterInfo.requestType['list']}/${clusterId}/${resourceInfo.requestType['list']}`;
// 兼容新旧日志组件
let baseInfo: ResourceInfo = resourceConfig()[logAgentName ? 'logagent' : 'cluster'];
let baseValue = logAgentName || clusterId;
url = `/${baseInfo.basicEntry}/${baseInfo.group}/${baseInfo.version}/${baseInfo.requestType['list']}/${baseValue}/${resourceInfo.requestType['list']}`;

if (extraResource || resourceInfo['namespaces'] || specificName) {
let queryArr: string[] = [];
Expand Down
41 changes: 11 additions & 30 deletions web/console/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class EditAddonPanel extends React.Component<RootProps, EdtiAddonPanelSta
bordered
columns={columns}
records={finalAddonList}
rowDisabled={record => isAlreadyOpened(record)}
rowDisabled={record => isAlreadyOpened(record) || record.type === 'LogCollector'}
addons={[
stylize({
headStyle: { display: 'none' },
Expand Down
Loading

0 comments on commit a5f0ad1

Please sign in to comment.