-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{ "prompt": "开发 K8s 中 NetworkPolicy 资源的 UI,它在菜单中的名字为“Network Policies”,父级菜单是网络。\n在列表中,增加一列展示 ingress 和 egress rules 的总量,以及一列用于展示出 pod selector 规则。\n\r\n\r\n\r\n在详情区域,增加对 ingress 和 egress 的展示。\r\n\r\n在 ingress 详情中,每个 ingress 用一个 tab 展示。渲染每个 ingress 时,根据 ingress.from 中各条规则的类型分别渲染:\r\n- IP block 类型,展示 CIDR 和 exceptions 字段;\r\n- Namespace Selector 类型,展示 key、operator、value,并统计选中了多少个 namespace;\r\n- Pod selector 类型,展示 key、operator、value,并统计选中了多少个 pod。\r\n将 ingress.ports 展示出来,包含 port 和 protocol 信息。\r\n\r\n在 egress 详情中,每个 egress 用一个 tab 展示。渲染每个 egress 时,根据 egress.to 中各条规则的类型分别渲染:\r\n- IP block 类型,展示 CIDR 和 exceptions 字段;\r\n将 egress.ports 展示出来,包含 port 和 protocol 信息。\r\n", "images": [ "https://github.com/webzard-io/dovetail-v2/assets/13651389/a4976e91-fd81-4560-8fc9-fa7695b25a92" ] }
- Loading branch information
Showing
4 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { RulesCountColumnRenderer } from '../../hooks/useEagleTable/columns'; | ||
import { PodSelectorColumnRenderer } from '../../hooks/useEagleTable/columns'; | ||
import { IngressEgressField } from '../../components/ShowContent/fields'; | ||
import { i18n } from 'i18next'; | ||
import { RESOURCE_GROUP, ResourceConfig, WithId } from '../../types'; | ||
import { ResourceModel } from '../../model'; | ||
import { NetworkPolicy } from 'kubernetes-types/networking/v1'; | ||
|
||
const NETWORKPOLICY_INIT_VALUE = { | ||
apiVersion: 'networking.k8s.io/v1', | ||
kind: 'NetworkPolicy', | ||
metadata: { | ||
name: '', | ||
namespace: 'default', | ||
annotations: {}, | ||
labels: {}, | ||
}, | ||
spec: { | ||
podSelector: {}, | ||
policyTypes: [], | ||
}, | ||
}; | ||
|
||
export const NetworkPolicyConfig: ResourceConfig<WithId<NetworkPolicy>, ResourceModel> = { | ||
name: 'networkpolicies', | ||
kind: 'NetworkPolicy', | ||
basePath: '/apis/networking.k8s.io/v1', | ||
apiVersion: 'v1', | ||
parent: RESOURCE_GROUP.NETWORK, | ||
label: 'Network Policies', | ||
columns: (i18n: i18n) => [ | ||
RulesCountColumnRenderer(i18n), | ||
PodSelectorColumnRenderer(i18n), | ||
], | ||
showFields: (i18n: i18n) => [[], [], [IngressEgressField(i18n)]], | ||
initValue: NETWORKPOLICY_INIT_VALUE, | ||
}; |