typo in selector implementation
This commit is contained in:
parent
a1ad610198
commit
8dee6a7162
@ -21,7 +21,6 @@ use harmony::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use harmony_macros::http_scheme;
|
use harmony_macros::http_scheme;
|
||||||
use serde_yaml::{Mapping, Value};
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
@ -58,24 +57,20 @@ async fn main() {
|
|||||||
relabelings: vec![],
|
relabelings: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut selector = HashMap::new();
|
|
||||||
selector.insert(
|
|
||||||
"matchExpressions".to_string(),
|
|
||||||
vec![Selector {
|
|
||||||
key: "monitored".to_string(),
|
|
||||||
operator: "In".to_string(),
|
|
||||||
values: vec!["test-service-1".to_string()],
|
|
||||||
}],
|
|
||||||
);
|
|
||||||
|
|
||||||
let service_monitor = ServiceMonitor {
|
let service_monitor = ServiceMonitor {
|
||||||
name: "test-service-monitor".to_string(),
|
name: "test-service-monitor".to_string(),
|
||||||
additional_labels: None,
|
additional_labels: None,
|
||||||
job_label: None,
|
job_label: None,
|
||||||
target_labels: vec![],
|
target_labels: vec![],
|
||||||
pod_target_labels: vec![],
|
pod_target_labels: vec![],
|
||||||
selector: selector,
|
selector: Selector {
|
||||||
match_labels: None,
|
match_labels: None,
|
||||||
|
match_expressions: vec![MatchExpression {
|
||||||
|
key: "test".to_string(),
|
||||||
|
operator: "In".to_string(),
|
||||||
|
values: vec!["test-service".to_string()],
|
||||||
|
}],
|
||||||
|
},
|
||||||
namespace_selector: None,
|
namespace_selector: None,
|
||||||
endpoints: vec![service_monitor_endpoint],
|
endpoints: vec![service_monitor_endpoint],
|
||||||
fallback_scrape_protocol: None,
|
fallback_scrape_protocol: None,
|
||||||
|
|||||||
@ -145,12 +145,20 @@ pub struct ServiceMonitorEndpoint {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Selector {
|
pub struct MatchExpression {
|
||||||
pub key: String,
|
pub key: String,
|
||||||
pub operator: String,
|
pub operator: String,
|
||||||
pub values: Vec<String>,
|
pub values: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct Selector {
|
||||||
|
// # label selector for services
|
||||||
|
pub match_labels: Option<HashMap<String, String>>,
|
||||||
|
pub match_expressions: Vec<MatchExpression>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ServiceMonitor {
|
pub struct ServiceMonitor {
|
||||||
@ -178,10 +186,7 @@ pub struct ServiceMonitor {
|
|||||||
// values:
|
// values:
|
||||||
// - example-service-1
|
// - example-service-1
|
||||||
// - example-service-2
|
// - example-service-2
|
||||||
pub selector: HashMap<String, Vec<Selector>>,
|
pub selector: Selector,
|
||||||
|
|
||||||
// # label selector for services
|
|
||||||
pub match_labels: Option<Mapping>,
|
|
||||||
|
|
||||||
// # Namespaces from which services are selected
|
// # Namespaces from which services are selected
|
||||||
// # Match any namespace
|
// # Match any namespace
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user