Class: Kube::Cluster::Standard::VictoriaMetrics::VMServiceScrape

Inherits:
Object
  • Object
show all
Defined in:
lib/kube/cluster/standard/victoria_metrics/vm_service_scrape.rb

Overview

Declares how to scrape the endpoints behind a Service, selected by the app.kubernetes.io/name label, relabelling the metrics onto a job.

Instance Method Summary collapse

Constructor Details

#initialize(name:, job:, match_name:, port:, &block) ⇒ VMServiceScrape

Returns a new instance of VMServiceScrape.



13
14
15
16
17
18
19
20
# File 'lib/kube/cluster/standard/victoria_metrics/vm_service_scrape.rb', line 13

def initialize(name:, job:, match_name:, port:, &block)
  super() {
    .name  = name
    spec.selector  = { matchLabels: { "app.kubernetes.io/name" => match_name } }
    spec.endpoints = [{ port: port, relabelConfigs: [{ targetLabel: "job", replacement: job }] }]
    instance_exec(&block) if block
  }
end