/
vmscrapeconfig_types.go
557 lines (529 loc) · 23.1 KB
/
vmscrapeconfig_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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
package v1beta1
import (
"fmt"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// VMScrapeConfig specifies a set of targets and parameters describing how to scrape them.
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="VMScrapeConfig"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=vmscrapeconfigs,scope=Namespaced
// +genclient
type VMScrapeConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec VMScrapeConfigSpec `json:"spec,omitempty"`
// +optional
Status VMScrapeConfigStatus `json:"status"`
}
// VMScrapeConfigSpec defines the desired state of VMScrapeConfig
type VMScrapeConfigSpec struct {
// StaticConfigs defines a list of static targets with a common label set.
// +optional
StaticConfigs []StaticConfig `json:"staticConfigs,omitempty"`
// FileSDConfigs defines a list of file service discovery configurations.
// +optional
FileSDConfigs []FileSDConfig `json:"fileSDConfigs,omitempty"`
// HTTPSDConfigs defines a list of HTTP service discovery configurations.
// +optional
HTTPSDConfigs []HTTPSDConfig `json:"httpSDConfigs,omitempty"`
// KubernetesSDConfigs defines a list of Kubernetes service discovery configurations.
// +optional
KubernetesSDConfigs []KubernetesSDConfig `json:"kubernetesSDConfigs,omitempty"`
// ConsulSDConfigs defines a list of Consul service discovery configurations.
// +optional
ConsulSDConfigs []ConsulSDConfig `json:"consulSDConfigs,omitempty"`
// DNSSDConfigs defines a list of DNS service discovery configurations.
// +optional
DNSSDConfigs []DNSSDConfig `json:"dnsSDConfigs,omitempty"`
// EC2SDConfigs defines a list of EC2 service discovery configurations.
// +optional
EC2SDConfigs []EC2SDConfig `json:"ec2SDConfigs,omitempty"`
// AzureSDConfigs defines a list of Azure service discovery configurations.
// +optional
AzureSDConfigs []AzureSDConfig `json:"azureSDConfigs,omitempty"`
// GCESDConfigs defines a list of GCE service discovery configurations.
// +optional
GCESDConfigs []GCESDConfig `json:"gceSDConfigs,omitempty"`
// OpenStackSDConfigs defines a list of OpenStack service discovery configurations.
// +optional
OpenStackSDConfigs []OpenStackSDConfig `json:"openstackSDConfigs,omitempty"`
// DigitalOceanSDConfigs defines a list of DigitalOcean service discovery configurations.
// +optional
DigitalOceanSDConfigs []DigitalOceanSDConfig `json:"digitalOceanSDConfigs,omitempty"`
// MetricsPath HTTP path to scrape for metrics. If empty, use the default value (e.g. /metrics).
// +optional
MetricsPath *string `json:"metricsPath,omitempty"`
// ScrapeInterval is the interval between consecutive scrapes.
// +optional
ScrapeInterval string `json:"scrapeInterval,omitempty"`
// ScrapeTimeout is the number of seconds to wait until a scrape request times out.
// +optional
ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
// HonorTimestamps controls whether to respect the timestamps present in scraped data.
// +optional
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
// HonorLabels chooses the metric's labels on collisions with target labels.
// +optional
HonorLabels bool `json:"honorLabels,omitempty"`
// Optional HTTP URL parameters
// +optional
// +mapType:=atomic
Params map[string][]string `json:"params,omitempty"`
// Configures the protocol scheme used for requests.
// If empty, use HTTP by default.
// +kubebuilder:validation:Enum=HTTP;HTTPS
// +optional
Scheme *string `json:"scheme,omitempty"`
// VMScrapeParams defines VictoriaMetrics specific scrape parametrs
// +optional
VMScrapeParams *VMScrapeParams `json:"vm_scrape_params,omitempty"`
// FollowRedirects controls redirects for scraping.
// +optional
FollowRedirects *bool `json:"follow_redirects,omitempty"`
// ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
// +optional
ProxyURL *string `json:"proxyURL,omitempty"`
// BasicAuth information to use on every scrape request.
// +optional
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
// Authorization header to use on every scrape request.
// +optional
Authorization *Authorization `json:"authorization,omitempty"`
// OAuth2 defines auth configuration
// +optional
OAuth2 *OAuth2 `json:"oauth2,omitempty"`
// TLS configuration to use on every scrape request
// +optional
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
// SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
// +optional
SampleLimit uint64 `json:"sampleLimit,omitempty"`
// SeriesLimit defines per-scrape limit on number of unique time series
// a single target can expose during all the scrapes on the time window of 24h.
// +optional
SeriesLimit uint64 `json:"seriesLimit,omitempty"`
// MetricRelabelConfigs to apply to samples before ingestion.
// +optional
MetricRelabelConfigs []*RelabelConfig `json:"metricRelabelConfigs,omitempty"`
// RelabelConfigs to apply to samples before scraping.
// See https://docs.victoriametrics.com/vmagent.html#relabeling
// +optional
RelabelConfigs []*RelabelConfig `json:"relabelConfigs,omitempty"`
}
// StaticConfig defines a static configuration.
// See https://docs.victoriametrics.com/sd_configs/#static_configs
type StaticConfig struct {
// List of targets for this static configuration.
// +optional
Targets []string `json:"targets,omitempty"`
// Labels assigned to all metrics scraped from the targets.
// +mapType:=atomic
// +optional
Labels map[string]string `json:"labels,omitempty"`
}
// FileSDConfig defines a file service discovery configuration
// See https://docs.victoriametrics.com/sd_configs/#file_sd_configs
type FileSDConfig struct {
// List of files to be used for file discovery.
// +kubebuilder:validation:MinItems:=1
Files []string `json:"files"`
}
// HTTPSDConfig defines a HTTP service discovery configuration
// See https://docs.victoriametrics.com/sd_configs/#http_sd_configs
type HTTPSDConfig struct {
// URL from which the targets are fetched.
// +kubebuilder:validation:MinLength:=1
// +kubebuilder:validation:Pattern:="^http(s)?://.+$"
URL string `json:"url"`
// BasicAuth information to use on every scrape request.
// +optional
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
// Authorization header to use on every scrape request.
// +optional
Authorization *Authorization `json:"authorization,omitempty"`
// TLS configuration to use on every scrape request
// +optional
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
// ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
// +optional
ProxyURL *string `json:"proxyURL,omitempty"`
// ProxyClientConfig configures proxy auth settings for scraping
// See feature description https://docs.victoriametrics.com/vmagent.html#scraping-targets-via-a-proxy
// +optional
ProxyClientConfig *ProxyAuth `json:"proxy_client_config,omitempty"`
}
// KubernetesSDConfig allows retrieving scrape targets from Kubernetes' REST API.
// See https://docs.victoriametrics.com/sd_configs/#kubernetes_sd_configs
// +k8s:openapi-gen=true
type KubernetesSDConfig struct {
// The API server address consisting of a hostname or IP address followed
// by an optional port number.
// If left empty, assuming process is running inside
// of the cluster. It will discover API servers automatically and use the pod's
// CA certificate and bearer token file at /var/run/secrets/kubernetes.io/serviceaccount/.
// +optional
APIServer *string `json:"apiServer,omitempty"`
// Role of the Kubernetes entities that should be discovered.
// +required
Role string `json:"role"`
// BasicAuth information to use on every scrape request.
// +optional
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
// Authorization header to use on every scrape request.
// +optional
Authorization *Authorization `json:"authorization,omitempty"`
// TLS configuration to use on every scrape request
// +optional
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
// OAuth2 defines auth configuration
// +optional
OAuth2 *OAuth2 `json:"oauth2,omitempty"`
// ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
// +optional
ProxyURL *string `json:"proxyURL,omitempty"`
// ProxyClientConfig configures proxy auth settings for scraping
// See feature description https://docs.victoriametrics.com/vmagent.html#scraping-targets-via-a-proxy
// +optional
ProxyClientConfig *ProxyAuth `json:"proxy_client_config,omitempty"`
// Configure whether HTTP requests follow HTTP 3xx redirects.
// +optional
FollowRedirects *bool `json:"followRedirects,omitempty"`
// Optional namespace discovery. If omitted, discover targets across all namespaces.
// +optional
Namespaces *NamespaceDiscovery `json:"namespaces,omitempty"`
// AttachMetadata configures metadata attaching from service discovery
// +optional
AttachMetadata AttachMetadata `json:"attach_metadata,omitempty"`
// Selector to select objects.
// +optional
// +listType=map
// +listMapKey=role
Selectors []K8SSelectorConfig `json:"selectors,omitempty"`
}
// K8SSelectorConfig is Kubernetes Selector Config
type K8SSelectorConfig struct {
// +kubebuilder:validation:Required
Role string `json:"role"`
Label string `json:"label,omitempty"`
Field string `json:"field,omitempty"`
}
// NamespaceDiscovery is the configuration for discovering
// Kubernetes namespaces.
type NamespaceDiscovery struct {
// Includes the namespace in which the pod exists to the list of watched namespaces.
// +optional
IncludeOwnNamespace *bool `json:"ownNamespace,omitempty"`
// List of namespaces where to watch for resources.
// If empty and `ownNamespace` isn't true, watch for resources in all namespaces.
// +optional
Names []string `json:"names,omitempty"`
}
// ConsulSDConfig defines a Consul service discovery configuration
// See https://docs.victoriametrics.com/sd_configs/#consul_sd_configs
// +k8s:openapi-gen=true
type ConsulSDConfig struct {
// A valid string consisting of a hostname or IP followed by an optional port number.
// +kubebuilder:validation:MinLength=1
// +required
Server string `json:"server"`
// Consul ACL TokenRef, if not provided it will use the ACL from the local Consul Agent.
// +optional
TokenRef *v1.SecretKeySelector `json:"tokenRef,omitempty"`
// Consul Datacenter name, if not provided it will use the local Consul Agent Datacenter.
// +optional
Datacenter *string `json:"datacenter,omitempty"`
// Namespaces are only supported in Consul Enterprise.
// +optional
Namespace *string `json:"namespace,omitempty"`
// Admin Partitions are only supported in Consul Enterprise.
// +optional
Partition *string `json:"partition,omitempty"`
// HTTP Scheme default "http"
// +kubebuilder:validation:Enum=HTTP;HTTPS
// +optional
Scheme *string `json:"scheme,omitempty"`
// A list of services for which targets are retrieved. If omitted, all services are scraped.
// +listType:=atomic
// +optional
Services []string `json:"services,omitempty"`
// An optional list of tags used to filter nodes for a given service. Services must contain all tags in the list.
//+listType:=atomic
// +optional
Tags []string `json:"tags,omitempty"`
// The string by which Consul tags are joined into the tag label.
// If unset, use its default value.
// +optional
TagSeparator *string `json:"tagSeparator,omitempty"`
// Node metadata key/value pairs to filter nodes for a given service.
// +mapType:=atomic
// +optional
NodeMeta map[string]string `json:"nodeMeta,omitempty"`
// Allow stale Consul results (see https://www.consul.io/api/features/consistency.html). Will reduce load on Consul.
// If unset, use its default value.
// +optional
AllowStale *bool `json:"allowStale,omitempty"`
// BasicAuth information to use on every scrape request.
// +optional
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
// Authorization header to use on every scrape request.
// +optional
Authorization *Authorization `json:"authorization,omitempty"`
// OAuth2 defines auth configuration
// +optional
OAuth2 *OAuth2 `json:"oauth2,omitempty"`
// ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
// +optional
ProxyURL *string `json:"proxyURL,omitempty"`
// ProxyClientConfig configures proxy auth settings for scraping
// See feature description https://docs.victoriametrics.com/vmagent.html#scraping-targets-via-a-proxy
// +optional
ProxyClientConfig *ProxyAuth `json:"proxy_client_config,omitempty"`
// Configure whether HTTP requests follow HTTP 3xx redirects.
// If unset, use its default value.
// +optional
FollowRedirects *bool `json:"followRedirects,omitempty"`
// TLS configuration to use on every scrape request
// +optional
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
}
// DNSSDConfig allows specifying a set of DNS domain names which are periodically queried to discover a list of targets.
// The DNS servers to be contacted are read from /etc/resolv.conf.
// See https://docs.victoriametrics.com/sd_configs/#dns_sd_configs
// +k8s:openapi-gen=true
type DNSSDConfig struct {
// A list of DNS domain names to be queried.
// +kubebuilder:validation:MinItems:=1
Names []string `json:"names"`
// The type of DNS query to perform.
// Supported values are: SRV, A, AAAA or MX.
// By default, SRV is used.
// +kubebuilder:validation:Enum=SRV;A;AAAA;MX
// +optional
Type *string `json:"type"`
// The port number used if the query type is not SRV
// Ignored for SRV records
// +optional
Port *int `json:"port"`
}
// EC2SDConfig allow retrieving scrape targets from AWS EC2 instances.
// The private IP address is used by default, but may be changed to the public IP address with relabeling.
// The IAM credentials used must have the ec2:DescribeInstances permission to discover scrape targets
// See https://docs.victoriametrics.com/sd_configs/#ec2_sd_configs
// +k8s:openapi-gen=true
type EC2SDConfig struct {
// The AWS region
// +optional
Region *string `json:"region"`
// AccessKey is the AWS API key.
// +optional
AccessKey *v1.SecretKeySelector `json:"accessKey,omitempty"`
// SecretKey is the AWS API secret.
// +optional
SecretKey *v1.SecretKeySelector `json:"secretKey,omitempty"`
// AWS Role ARN, an alternative to using AWS API keys.
// +optional
RoleARN *string `json:"roleARN,omitempty"`
// The port to scrape metrics from. If using the public IP address, this must
// instead be specified in the relabeling rule.
// +optional
Port *int `json:"port"`
// Filters can be used optionally to filter the instance list by other criteria.
// Available filter criteria can be found here:
// https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html
// Filter API documentation: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Filter.html
// +optional
Filters []*EC2Filter `json:"filters"`
}
// EC2Filter is the configuration for filtering EC2 instances.
type EC2Filter struct {
Name string `json:"name"`
Values []string `json:"values"`
}
// AzureSDConfig allow retrieving scrape targets from Azure VMs.
// See https://docs.victoriametrics.com/sd_configs/#azure_sd_configs
// +k8s:openapi-gen=true
type AzureSDConfig struct {
// The Azure environment.
// +optional
Environment *string `json:"environment,omitempty"`
// # The authentication method, either OAuth or ManagedIdentity.
// See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview
// +kubebuilder:validation:Enum=OAuth;ManagedIdentity
// +optional
AuthenticationMethod *string `json:"authenticationMethod,omitempty"`
// The subscription ID. Always required.
// +kubebuilder:validation:MinLength=1
// +required
SubscriptionID string `json:"subscriptionID"`
// Optional tenant ID. Only required with the OAuth authentication method.
// +optional
TenantID *string `json:"tenantID,omitempty"`
// Optional client ID. Only required with the OAuth authentication method.
// +optional
ClientID *string `json:"clientID,omitempty"`
// Optional client secret. Only required with the OAuth authentication method.
// +optional
ClientSecret *v1.SecretKeySelector `json:"clientSecret,omitempty"`
// Optional resource group name. Limits discovery to this resource group.
// +optional
ResourceGroup *string `json:"resourceGroup,omitempty"`
// The port to scrape metrics from. If using the public IP address, this must
// instead be specified in the relabeling rule.
// +optional
Port *int `json:"port"`
}
// GCESDConfig configures scrape targets from GCP GCE instances.
// The private IP address is used by default, but may be changed to
// the public IP address with relabeling.
// See https://docs.victoriametrics.com/sd_configs/#gce_sd_configs
//
// The GCE service discovery will load the Google Cloud credentials
// from the file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable.
// See https://cloud.google.com/kubernetes-engine/docs/tutorials/authenticating-to-cloud-platform
// +k8s:openapi-gen=true
type GCESDConfig struct {
// The Google Cloud Project ID
// +kubebuilder:validation:MinLength:=1
// +required
Project string `json:"project"`
// The zone of the scrape targets. If you need multiple zones use multiple GCESDConfigs.
// +kubebuilder:validation:MinLength:=1
// +required
Zone string `json:"zone"`
// Filter can be used optionally to filter the instance list by other criteria
// Syntax of this filter is described in the filter query parameter section:
// https://cloud.google.com/compute/docs/reference/latest/instances/list
// +optional
Filter *string `json:"filter,omitempty"`
// The port to scrape metrics from. If using the public IP address, this must
// instead be specified in the relabeling rule.
// +optional
Port *int `json:"port"`
// The tag separator is used to separate the tags on concatenation
// +optional
TagSeparator *string `json:"tagSeparator,omitempty"`
}
// OpenStackSDConfig allow retrieving scrape targets from OpenStack Nova instances.
// See https://docs.victoriametrics.com/sd_configs/#openstack_sd_configs
// +k8s:openapi-gen=true
type OpenStackSDConfig struct {
// The OpenStack role of entities that should be discovered.
// +kubebuilder:validation:Enum=Instance;instance;Hypervisor;hypervisor
// +required
Role string `json:"role"`
// The OpenStack Region.
// +kubebuilder:validation:MinLength:=1
// +required
Region string `json:"region"`
// IdentityEndpoint specifies the HTTP endpoint that is required to work with
// the Identity API of the appropriate version.
// +optional
IdentityEndpoint *string `json:"identityEndpoint,omitempty"`
// Username is required if using Identity V2 API. Consult with your provider's
// control panel to discover your account's username.
// In Identity V3, either userid or a combination of username
// and domainId or domainName are needed
// +optional
Username *string `json:"username,omitempty"`
// UserID
// +optional
UserID *string `json:"userid,omitempty"`
// Password for the Identity V2 and V3 APIs. Consult with your provider's
// control panel to discover your account's preferred method of authentication.
// +optional
Password *v1.SecretKeySelector `json:"password,omitempty"`
// At most one of domainId and domainName must be provided if using username
// with Identity V3. Otherwise, either are optional.
// +optional
DomainName *string `json:"domainName,omitempty"`
// DomainID
// +optional
DomainID *string `json:"domainID,omitempty"`
// The ProjectId and ProjectName fields are optional for the Identity V2 API.
// Some providers allow you to specify a ProjectName instead of the ProjectId.
// Some require both. Your provider's authentication policies will determine
// how these fields influence authentication.
// +optional
ProjectName *string `json:"projectName,omitempty"`
// ProjectID
// +optional
ProjectID *string `json:"projectID,omitempty"`
// The ApplicationCredentialID or ApplicationCredentialName fields are
// required if using an application credential to authenticate. Some providers
// allow you to create an application credential to authenticate rather than a
// password.
// +optional
ApplicationCredentialName *string `json:"applicationCredentialName,omitempty"`
// ApplicationCredentialID
// +optional
ApplicationCredentialID *string `json:"applicationCredentialId,omitempty"`
// The applicationCredentialSecret field is required if using an application
// credential to authenticate.
// +optional
ApplicationCredentialSecret *v1.SecretKeySelector `json:"applicationCredentialSecret,omitempty"`
// Whether the service discovery should list all instances for all projects.
// It is only relevant for the 'instance' role and usually requires admin permissions.
// +optional
AllTenants *bool `json:"allTenants,omitempty"`
// The port to scrape metrics from. If using the public IP address, this must
// instead be specified in the relabeling rule.
// +optional
Port *int `json:"port"`
// Availability of the endpoint to connect to.
// +kubebuilder:validation:Enum=Public;public;Admin;admin;Internal;internal
// +optional
Availability *string `json:"availability,omitempty"`
// TLS configuration to use on every scrape request
// +optional
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
}
// DigitalOceanSDConfig allow retrieving scrape targets from DigitalOcean's Droplets API.
// This service discovery uses the public IPv4 address by default, by that can be changed with relabeling
// See https://docs.victoriametrics.com/sd_configs/#digitalocean_sd_configs
// +k8s:openapi-gen=true
type DigitalOceanSDConfig struct {
// Authorization header to use on every scrape request.
// +optional
Authorization *Authorization `json:"authorization,omitempty"`
// OAuth2 defines auth configuration
// +optional
OAuth2 *OAuth2 `json:"oauth2,omitempty"`
// ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
// +optional
ProxyURL *string `json:"proxyURL,omitempty"`
// ProxyClientConfig configures proxy auth settings for scraping
// See feature description https://docs.victoriametrics.com/vmagent.html#scraping-targets-via-a-proxy
// +optional
ProxyClientConfig *ProxyAuth `json:"proxy_client_config,omitempty"`
// Configure whether HTTP requests follow HTTP 3xx redirects.
// +optional
FollowRedirects *bool `json:"followRedirects,omitempty"`
// TLS configuration to use on every scrape request
// +optional
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
// The port to scrape metrics from.
// +optional
Port *int `json:"port,omitempty"`
}
// VMScrapeConfigStatus defines the observed state of VMScrapeConfig
type VMScrapeConfigStatus struct{}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// VMScrapeConfigList contains a list of VMScrapeConfig
type VMScrapeConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []VMScrapeConfig `json:"items"`
}
// AsProxyKey builds key for proxy cache maps
func (cr VMScrapeConfig) AsProxyKey(prefix string, i int) string {
return fmt.Sprintf("scrapeConfigProxy/%s/%s/%s/%d", cr.Namespace, cr.Name, prefix, i)
}
// AsMapKey - returns cr name with suffix for token/auth maps.
func (cr VMScrapeConfig) AsMapKey(prefix string, i int) string {
return fmt.Sprintf("scrapeConfig/%s/%s/%s/%d", cr.Namespace, cr.Name, prefix, i)
}
func init() {
SchemeBuilder.Register(&VMScrapeConfig{}, &VMScrapeConfigList{})
}