Class: Kube::Cluster::Standard::VictoriaMetrics::VMPodScrape

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

Overview

Declares how to scrape the pods selected by the app.kubernetes.io/name label (the pod-selector analogue of VMServiceScrape), relabelling the metrics onto a job.

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of VMPodScrape.



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

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