-
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”,父级菜单是网络。\r\n\n在列表中,增加一列展示 ingress 和 egress rules 的总量,以及一列用于展示出 pod selector 规则。", "images": [] }
- Loading branch information
Showing
4 changed files
with
124 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,40 @@ | ||
import { PolicyRulesColumnRenderer } from '../../hooks/useEagleTable/columns'; | ||
import { PodSelectorColumnRenderer } from '../../hooks/useEagleTable/columns'; | ||
import { DataField } 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'; | ||
|
||
// a example k8s yaml for the network policy resource | ||
const NETWORKPOLICY_INIT_VALUE = { | ||
apiVersion: 'networking.k8s.io/v1', | ||
kind: 'NetworkPolicy', | ||
metadata: { | ||
name: '', | ||
namespace: 'default', | ||
annotations: {}, | ||
labels: {}, | ||
}, | ||
spec: { | ||
podSelector: {}, | ||
ingress: [], | ||
egress: [], | ||
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) => [ | ||
PolicyRulesColumnRenderer(i18n), | ||
PodSelectorColumnRenderer(i18n), | ||
], | ||
showFields: (i18n: i18n) => [[], [], [DataField(i18n)]], | ||
initValue: NETWORKPOLICY_INIT_VALUE, | ||
}; |