-
Notifications
You must be signed in to change notification settings - Fork 101
/
endpointmonitor_types.go
365 lines (285 loc) · 11.1 KB
/
endpointmonitor_types.go
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EndpointMonitorSpec defines the desired state of EndpointMonitor
type EndpointMonitorSpec struct {
// URL to monitor
URL string `json:"url,omitempty"`
// Force monitor endpoint to use HTTPS
// +optional
ForceHTTPS bool `json:"forceHttps,omitempty"`
// +optional
HealthEndpoint string `json:"healthEndpoint,omitempty"`
// Comma separated list of providers
// +optional
Providers string `json:"providers"`
// URL to monitor from either an ingress or route reference
// +optional
URLFrom *URLSource `json:"urlFrom,omitempty"`
// Configuration for UptimeRobot Monitor Provider
// +optional
UptimeRobotConfig *UptimeRobotConfig `json:"uptimeRobotConfig,omitempty"`
// Configuration for Uptime Monitor Provider
// +optional
UptimeConfig *UptimeConfig `json:"uptimeConfig,omitempty"`
// Configuration for Updown Monitor Provider
// +optional
UpdownConfig *UpdownConfig `json:"updownConfig,omitempty"`
// Configuration for StatusCake Monitor Provider
// +optional
StatusCakeConfig *StatusCakeConfig `json:"statusCakeConfig,omitempty"`
// Configuration for Pingdom Monitor Provider
// +optional
PingdomConfig *PingdomConfig `json:"pingdomConfig,omitempty"`
// Configuration for AppInsights Monitor Provider
// +optional
AppInsightsConfig *AppInsightsConfig `json:"appInsightsConfig,omitempty"`
// Configuration for Google Cloud Monitor Provider
// +optional
GCloudConfig *GCloudConfig `json:"gcloudConfig,omitempty"`
// Configuration for Grafana Cloud Monitor Provider
// +optional
GrafanaConfig *GrafanaConfig `json:"grafanaConfig,omitempty"`
}
// UptimeRobotConfig defines the configuration for UptimeRobot Monitor Provider
type UptimeRobotConfig struct {
// The uptimerobot alertContacts to be associated with this monitor
// +optional
AlertContacts string `json:"alertContacts,omitempty"`
// The uptimerobot check interval in seconds
// +kubebuilder:validation:Minimum=60
// +optional
Interval int `json:"interval,omitempty"`
// Specify maintenanceWindows i.e. once or recurring “do-not-monitor periods”
// +optional
MaintenanceWindows string `json:"maintenanceWindows,omitempty"`
// The uptimerobot monitor type (http or keyword)
// +kubebuilder:validation:Enum=http;keyword
// +optional
MonitorType string `json:"monitorType,omitempty"`
// Alert if value exist (yes) or doesn't exist (no) (Only if monitor-type is keyword)
// +kubebuilder:validation:Enum=yes;no
// +optional
KeywordExists string `json:"keywordExists,omitempty"`
// keyword to check on URL (e.g.'search' or '404') (Only if monitor-type is keyword)
// +optional
KeywordValue string `json:"keywordValue,omitempty"`
// The uptimerobot public status page ID to add this monitor to
// +optional
StatusPages string `json:"statusPages,omitempty"`
// Defines which http status codes are treated as up or down
// For ex: 200:0_401:1_503:1 (to accept 200 as down and 401 and 503 as up)
CustomHTTPStatuses string `json:"customHTTPStatuses,omitempty"`
}
// UptimeConfig defines the configuration for Uptime Monitor Provider
type UptimeConfig struct {
// The uptime check interval in seconds
// +optional
Interval int `json:"interval,omitempty"`
// The uptime check type that can be HTTP/DNS/ICMP etc.
// +optional
CheckType string `json:"checkType,omitempty"`
// Add one or more contact groups separated by `,`
// +optional
Contacts string `json:"contacts,omitempty"`
// Add different locations for the check
// +optional
Locations string `json:"locations,omitempty"`
// Add one or more tags for the check separated by `,`
// +optional
Tags string `json:"tags,omitempty"`
}
// UpdownConfig defines the configuration for Updown Monitor Provider
type UpdownConfig struct {
// Enable or disable checks
// +optional
Enable bool `json:"enable,omitempty"`
// The pingdom check interval in seconds
// +optional
Period int `json:"period,omitempty"`
// Make status page public or not
// +optional
PublishPage bool `json:"publishPage,omitempty"`
// Additional request headers for API calls
// +optional
RequestHeaders string `json:"requestHeaders,omitempty"`
}
// StatusCakeConfig defines the configuration for StatusCake Monitor Provider
type StatusCakeConfig struct {
// Basic Auth User
// +optional
BasicAuthUser string `json:"basicAuthUser,omitempty"`
// Set Check Rate for the monitor
// +optional
CheckRate int `json:"checkRate,omitempty"`
// Set Test type - HTTP, TCP, PING
// +optional
TestType string `json:"testType,omitempty"`
// Pause the service
// +optional
Paused bool `json:"paused,omitempty"`
// Webhook for alerts
// +optional
PingURL string `json:"pingUrl,omitempty"`
// Enable ingress redirects
// +optional
FollowRedirect bool `json:"followRedirect,omitempty"`
// TCP Port
// +optional
Port int `json:"port,omitempty"`
// Minutes to wait before sending an alert
// +optional
TriggerRate int `json:"triggerRate,omitempty"`
// Contact Group to be alerted.
// +optional
ContactGroup string `json:"contactGroup,omitempty"`
// Comma separated list of tags
// +optional
TestTags string `json:"testTags,omitempty"`
// Comma separated list of Node Location IDs
// +optional
Regions string `json:"regions,omitempty"`
// Comma separated list of HTTP codes to trigger error on
// +optional
StatusCodes string `json:"statusCodes,omitempty"`
// Confirmation value ranges from (0,10)
// +kubebuilder:validation:Maximum=10
// +kubebuilder:validation:Minimum=0
// +optional
Confirmation int `json:"confirmation,omitempty"`
// Enable SSL Alert
// +optional
EnableSSLAlert bool `json:"enableSslAlert,omitempty"`
// Enable Real Browser
// +optional
RealBrowser bool `json:"realBrowser,omitempty"`
// String to look for within the response. Considered down if not found
// +optional
FindString string `json:"findString,omitempty"`
}
// PingdomConfig defines the configuration for Pingdom Monitor Provider
type PingdomConfig struct {
// The pingdom check interval in minutes
// +optional
Resolution int `json:"resolution,omitempty"`
// How many failed check attempts before notifying
// +optional
SendNotificationWhenDown int `json:"sendNotificationWhenDown,omitempty"`
// Set to "true" to pause checks
// +optional
Paused bool `json:"paused,omitempty"`
// Set to "false" to disable recovery notifications
// +optional
NotifyWhenBackUp bool `json:"notifyWhenBackUp,omitempty"`
// Custom pingdom request headers
// +optional
RequestHeaders string `json:"requestHeaders,omitempty"`
// Required for basic-authentication
// +optional
BasicAuthUser string `json:"basicAuthUser,omitempty"`
// Set to text string that has to be present in the HTML code of the page
// +optional
ShouldContain string `json:"shouldContain,omitempty"`
// Comma separated set of tags to apply to check (e.g. "testing,aws")
// +optional
Tags string `json:"tags,omitempty"`
// `-` separated set list of integrations ids (e.g. "91166-12168")
// +optional
AlertIntegrations string `json:"alertIntegrations,omitempty"`
// `-` separated contact id's (e.g. "1234567_8_9-9876543_2_1")
// +optional
AlertContacts string `json:"alertContacts,omitempty"`
// `-` separated team id's (e.g. "1234567_8_9-9876543_2_1")
// +optional
TeamAlertContacts string `json:"teamAlertContacts,omitempty"`
// Monitor SSL/TLS certificate
// Monitor the validity of your SSL/TLS certificate. With this enabled Uptime checks will be considered DOWN when
// the certificate becomes invalid or expires.
// SSL/TLS certificate monitoring is available for HTTP checks.
// +optional
VerifyCertificate bool `json:"verifyCertificate,omitempty"`
// Consider down prior to certificate expiring
// Select the number of days prior to your certificate expiry date that you want to consider the check down.
// At this day your check will be considered down and if applicable a down alert will be sent.
// +optional
SSLDownDaysBefore int `json:"sslDownDaysBefore,omitempty"`
// Data that should be posted to the web page, for example submission data for a sign-up or login form.
// The data needs to be formatted in the same way as a web browser would send it to the web server.
// Because post data contains sensitive secret this field is only reference to a environment variable.
// +optional
PostDataEnvVar string `json:"postDataEnvVar,omitempty"`
}
// AppInsightsConfig defines the configuration for AppInsights Monitor Provider
type AppInsightsConfig struct {
// Returned status code that is counted as a success
// +optional
StatusCode int `json:"statusCode,omitempty"`
// If its `true`, falied test will be retry after a short interval. Possible values: `true, false`
// +optional
RetryEnable bool `json:"retryEnable,omitempty"`
// Sets how often the test should run from each test location. Possible values: `300,600,900` seconds
// +optional
Frequency int `json:"frequency,omitempty"`
}
// GCloudConfiguration defines the configuration for Google Cloud Monitor Provider
type GCloudConfig struct {
// Google Cloud Project ID
// +optional
ProjectId string `json:"projectId,omitempty"`
}
// GrafnaConfiguration defines the configuration for Grafana Cloud Monitor Provider
type GrafanaConfig struct {
TenantId int64 `json:"tenantId,omitempty"`
}
// URLSource represents the set of resources to fetch the URL from
type URLSource struct {
// +optional
IngressRef *IngressURLSource `json:"ingressRef,omitempty"`
// +optional
RouteRef *RouteURLSource `json:"routeRef,omitempty"`
}
// IngressURLSource selects an Ingress to populate the URL with
type IngressURLSource struct {
Name string `json:"name"`
}
// RouteURLSource selects a Route to populate the URL with
type RouteURLSource struct {
Name string `json:"name"`
}
// EndpointMonitorStatus defines the observed state of EndpointMonitor
type EndpointMonitorStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// EndpointMonitor is the Schema for the endpointmonitors API
type EndpointMonitor struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec EndpointMonitorSpec `json:"spec,omitempty"`
Status EndpointMonitorStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// EndpointMonitorList contains a list of EndpointMonitor
type EndpointMonitorList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []EndpointMonitor `json:"items"`
}
func init() {
SchemeBuilder.Register(&EndpointMonitor{}, &EndpointMonitorList{})
}