1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
export const mockEnvironmentsResponse = {
environments: [
{
id: 1129970,
name: 'production',
state: 'available',
},
{
id: 1156094,
name: 'review/enable-network-policies',
state: 'available',
},
],
available_count: 2,
stopped_count: 5,
};
export const mockPoliciesResponse = [
{
name: 'policy',
namespace: 'production',
manifest: `---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: example-name
namespace: example-namespace
spec:
podSelector:
matchLabels:
role: db
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
project: myproject`,
creation_timestamp: '2020-04-14T00:08:30Z',
is_enabled: true,
},
];
export const mockCiliumPolicy = {
name: 'policy',
creationTimestamp: new Date('2021-06-07T00:00:00.000Z'),
manifest: `apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: policy
spec:
endpointSelector: {}`,
};
export const mockScanExecutionPolicy = {
name: 'Scheduled DAST scan',
creationTimestamp: new Date('2021-06-07T00:00:00.000Z'),
manifest: `---
name: Enforce DAST in every pipeline
description: This policy enforces pipeline configuration to have a job with DAST scan
enabled: true
rules:
- type: pipeline
branches:
- master
actions:
- scan: dast
scanner_profile: Scanner Profile
site_profile: Site Profile
`,
};
export const mockNominalHistory = [
['2019-12-04T00:00:00.000Z', 56],
['2019-12-05T00:00:00.000Z', 2647],
];
export const mockAnomalousHistory = [
['2019-12-04T00:00:00.000Z', 1],
['2019-12-05T00:00:00.000Z', 83],
];
export const mockNetworkPolicyStatisticsResponse = {
ops_total: {
total: 2703,
drops: 84,
},
ops_rate: {
total: [
[1575417600, 56],
[1575504000, 2647],
],
drops: [
[1575417600, 1],
[1575504000, 83],
],
},
};
export const formattedMockNetworkPolicyStatisticsResponse = {
opsRate: {
drops: [
[new Date('2019-12-04T00:00:00.000Z'), 1],
[new Date('2019-12-05T00:00:00.000Z'), 83],
],
total: [
[new Date('2019-12-04T00:00:00.000Z'), 56],
[new Date('2019-12-05T00:00:00.000Z'), 2647],
],
},
opsTotal: { drops: 84, total: 2703 },
};
export const mockAlerts = [
{
iid: '01',
assignees: {
nodes: [
{
id: 'Alert:1',
name: 'Administrator',
username: 'root',
avatarUrl: '/test-avatar-url',
webUrl: 'https://gitlab:3443/root',
},
],
},
eventCount: '1',
issueIid: null,
issue: { iid: '5', state: 'opened', title: 'Issue 01', webUrl: 'http://test.com/05' },
title: 'Issue 01',
severity: 'HIGH',
status: 'TRIGGERED',
startedAt: '2020-11-19T18:36:23Z',
},
{
iid: '02',
eventCount: '2',
assignees: { nodes: [] },
issueIid: null,
issue: { iid: '6', state: 'closed', title: 'Issue 02', webUrl: 'http://test.com/06' },
severity: 'CRITICAL',
title: 'Issue 02',
status: 'ACKNOWLEDGED',
startedAt: '2020-11-16T21:59:28Z',
},
{
iid: '03',
eventCount: '3',
assignees: { nodes: [] },
issueIid: null,
issue: null,
severity: 'MEDIUM',
title: 'Issue 03',
status: 'RESOLVED',
startedAt: '2020-11-13T20:03:04Z',
},
{
iid: '04',
assignees: { nodes: [] },
issueIid: null,
issue: null,
severity: 'LOW',
eventCount: '4',
title: 'Issue 04',
status: 'IGNORED',
startedAt: '2020-10-29T13:37:55Z',
},
];
export const mockPageInfo = {
endCursor: 'eyJpZCI6IjIwIiwic3RhcnRlZF9hdCI6IjIwMjAtMTItMDMgMjM6MTI6NDkuODM3Mjc1MDAwIFVUQyJ9',
hasNextPage: true,
hasPreviousPage: false,
startCursor: 'eyJpZCI6IjM5Iiwic3RhcnRlZF9hdCI6IjIwMjAtMTItMDQgMTg6MDE6MDcuNzY1ODgyMDAwIFVUQyJ9',
};
export const mockAlertDetails = {
iid: '01',
issue: { webUrl: '/#/-/issues/02' },
title: 'dropingress',
monitorTool: 'Cilium',
};
export const mockL7Manifest = `apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: limit-inbound-ip
spec:
endpointSelector: {}
ingress:
- toPorts:
- ports:
- port: '80'
protocol: TCP
- port: '443'
protocol: TCP
rules:
http:
- headers:
- 'X-Forwarded-For: 192.168.1.1'
fromEntities:
- cluster`;
export const mockL3Manifest = `apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
description: test description
metadata:
name: test-policy
labels:
app.gitlab.com/proj: '21'
spec:
endpointSelector:
matchLabels:
network-policy.gitlab.com/disabled_by: gitlab
foo: bar
ingress:
- fromEndpoints:
- matchLabels:
foo: bar`;