diff --git a/Documentation/api-reference/api.md b/Documentation/api-reference/api.md index 0b224439f..ea9c964e0 100644 --- a/Documentation/api-reference/api.md +++ b/Documentation/api-reference/api.md @@ -11443,8 +11443,9 @@ string (Appears on:RelabelConfig)

-

LabelName is a valid Prometheus label name which may only contain ASCII -letters, numbers, as well as underscores.

+

LabelName is a valid Prometheus label name. +For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. +For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.

ManagedIdentity

diff --git a/bundle.yaml b/bundle.yaml index a160651c5..a5a34bbb5 100644 --- a/bundle.yaml +++ b/bundle.yaml @@ -22338,9 +22338,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -22844,9 +22844,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -23597,9 +23597,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -24228,9 +24228,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -24378,9 +24378,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -31189,9 +31189,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -31495,9 +31495,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -31594,9 +31594,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -37207,9 +37207,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -37490,9 +37490,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -44079,9 +44079,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -44530,9 +44530,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -44629,9 +44629,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -59676,9 +59676,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -62013,9 +62013,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -63073,9 +63073,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -63572,9 +63572,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -69983,9 +69983,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml index 20cf12795..84ea7be69 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_podmonitors.yaml @@ -415,9 +415,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -921,9 +921,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_probes.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_probes.yaml index b2dabace6..40424236b 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_probes.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_probes.yaml @@ -296,9 +296,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -927,9 +927,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -1077,9 +1077,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml index bfad096e8..1ac659735 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheusagents.yaml @@ -6505,9 +6505,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -6811,9 +6811,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -6910,9 +6910,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml index 739e062f7..7ce34d818 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_prometheuses.yaml @@ -1211,9 +1211,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -1494,9 +1494,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -8083,9 +8083,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -8534,9 +8534,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -8633,9 +8633,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_scrapeconfigs.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_scrapeconfigs.yaml index a4379bee7..00f58e2c2 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_scrapeconfigs.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_scrapeconfigs.yaml @@ -9831,9 +9831,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -12168,9 +12168,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml index e33e1c06c..11eba7625 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml @@ -336,9 +336,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -835,9 +835,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd-full/monitoring.coreos.com_thanosrulers.yaml b/example/prometheus-operator-crd-full/monitoring.coreos.com_thanosrulers.yaml index f5669c404..21201ee01 100644 --- a/example/prometheus-operator-crd-full/monitoring.coreos.com_thanosrulers.yaml +++ b/example/prometheus-operator-crd-full/monitoring.coreos.com_thanosrulers.yaml @@ -5848,9 +5848,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml index 2f6424faf..8f4211c7e 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml @@ -416,9 +416,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -922,9 +922,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml index b5a22891b..47cd10994 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml @@ -297,9 +297,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -928,9 +928,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -1078,9 +1078,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml index ad94ed02e..61f915dca 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml @@ -6506,9 +6506,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -6812,9 +6812,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -6911,9 +6911,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml index 0d7719fed..82b350804 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml @@ -1212,9 +1212,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -1495,9 +1495,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -8084,9 +8084,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -8535,9 +8535,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -8634,9 +8634,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml index 905d30e53..31b5185ac 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml @@ -9832,9 +9832,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -12169,9 +12169,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml index af2030690..30cc0a146 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml @@ -337,9 +337,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: @@ -836,9 +836,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml b/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml index 7795d6162..53380ec0e 100644 --- a/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml +++ b/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml @@ -5849,9 +5849,9 @@ spec: configured regular expression. items: description: |- - LabelName is a valid Prometheus label name which may only contain ASCII - letters, numbers, as well as underscores. - pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$ + LabelName is a valid Prometheus label name. + For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. + For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type: string type: array targetLabel: diff --git a/jsonnet/prometheus-operator/podmonitors-crd.json b/jsonnet/prometheus-operator/podmonitors-crd.json index ebb702884..f3ca7b8da 100644 --- a/jsonnet/prometheus-operator/podmonitors-crd.json +++ b/jsonnet/prometheus-operator/podmonitors-crd.json @@ -325,8 +325,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -773,8 +772,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" diff --git a/jsonnet/prometheus-operator/probes-crd.json b/jsonnet/prometheus-operator/probes-crd.json index 68429e70d..cf3da5406 100644 --- a/jsonnet/prometheus-operator/probes-crd.json +++ b/jsonnet/prometheus-operator/probes-crd.json @@ -250,8 +250,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -816,8 +815,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -943,8 +941,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" diff --git a/jsonnet/prometheus-operator/prometheusagents-crd.json b/jsonnet/prometheus-operator/prometheusagents-crd.json index 7f809ac25..ea1071553 100644 --- a/jsonnet/prometheus-operator/prometheusagents-crd.json +++ b/jsonnet/prometheus-operator/prometheusagents-crd.json @@ -5513,8 +5513,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -5762,8 +5761,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -5836,8 +5834,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" diff --git a/jsonnet/prometheus-operator/prometheuses-crd.json b/jsonnet/prometheus-operator/prometheuses-crd.json index 28a626952..e9fd638cc 100644 --- a/jsonnet/prometheus-operator/prometheuses-crd.json +++ b/jsonnet/prometheus-operator/prometheuses-crd.json @@ -994,8 +994,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -1236,8 +1235,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -6892,8 +6890,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -7270,8 +7267,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -7344,8 +7340,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" diff --git a/jsonnet/prometheus-operator/scrapeconfigs-crd.json b/jsonnet/prometheus-operator/scrapeconfigs-crd.json index a20a0927c..0b5adf4e5 100644 --- a/jsonnet/prometheus-operator/scrapeconfigs-crd.json +++ b/jsonnet/prometheus-operator/scrapeconfigs-crd.json @@ -9152,8 +9152,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -11316,8 +11315,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" diff --git a/jsonnet/prometheus-operator/servicemonitors-crd.json b/jsonnet/prometheus-operator/servicemonitors-crd.json index 30f3b3f26..c22d7233f 100644 --- a/jsonnet/prometheus-operator/servicemonitors-crd.json +++ b/jsonnet/prometheus-operator/servicemonitors-crd.json @@ -259,8 +259,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" @@ -700,8 +699,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" diff --git a/jsonnet/prometheus-operator/thanosrulers-crd.json b/jsonnet/prometheus-operator/thanosrulers-crd.json index 0919f5e44..acbbe1b6a 100644 --- a/jsonnet/prometheus-operator/thanosrulers-crd.json +++ b/jsonnet/prometheus-operator/thanosrulers-crd.json @@ -5083,8 +5083,7 @@ "sourceLabels": { "description": "sourceLabels defines the source labels select values from existing labels. Their content is\nconcatenated using the configured Separator and matched against the\nconfigured regular expression.", "items": { - "description": "LabelName is a valid Prometheus label name which may only contain ASCII\nletters, numbers, as well as underscores.", - "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "description": "LabelName is a valid Prometheus label name.\nFor Prometheus 3.x, a label name is valid if it contains UTF-8 characters.\nFor Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores.", "type": "string" }, "type": "array" diff --git a/pkg/apis/monitoring/v1/types.go b/pkg/apis/monitoring/v1/types.go index 9add91b13..9c62771d8 100644 --- a/pkg/apis/monitoring/v1/types.go +++ b/pkg/apis/monitoring/v1/types.go @@ -537,10 +537,9 @@ func (c *WebTLSConfig) Validate() error { return nil } -// LabelName is a valid Prometheus label name which may only contain ASCII -// letters, numbers, as well as underscores. -// -// +kubebuilder:validation:Pattern:="^[a-zA-Z_][a-zA-Z0-9_]*$" +// LabelName is a valid Prometheus label name. +// For Prometheus 3.x, a label name is valid if it contains UTF-8 characters. +// For Prometheus 2.x, a label name is only valid if it contains ASCII characters, letters, numbers, as well as underscores. type LabelName string // Endpoint defines an endpoint serving Prometheus metrics to be scraped by diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index 566537cf4..ef5638312 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -321,6 +321,7 @@ func testAllNSPrometheus(t *testing.T) { "PrometheusAgentSSetServiceName": testPrometheusAgentSSetServiceName, "PrometheusReconciliationOnSecretChanges": testPrometheusReconciliationOnSecretChanges, "PrometheusUTF8MetricsSupport": testPrometheusUTF8MetricsSupport, + "PrometheusUTF8LabelSupport": testPrometheusUTF8LabelSupport, } for name, f := range testFuncs { diff --git a/test/e2e/prometheus_test.go b/test/e2e/prometheus_test.go index c79f844d4..e899818e8 100644 --- a/test/e2e/prometheus_test.go +++ b/test/e2e/prometheus_test.go @@ -4930,22 +4930,15 @@ func testRelabelConfigCRDValidation(t *testing.T) { expectedError: true, }, { - scenario: "empty-source-lbl", + scenario: "accepts-utf-8-labels", relabelConfigs: []monitoringv1.RelabelConfig{ { - SourceLabels: []monitoringv1.LabelName{""}, + SourceLabels: []monitoringv1.LabelName{"app.info"}, + Action: "replace", + TargetLabel: "app.info", + Replacement: ptr.To("test.app"), }, }, - expectedError: true, - }, - { - scenario: "invalid-source-lbl", - relabelConfigs: []monitoringv1.RelabelConfig{ - { - SourceLabels: []monitoringv1.LabelName{"metric%)"}, - }, - }, - expectedError: true, }, } @@ -5501,6 +5494,7 @@ func testPrometheusUTF8MetricsSupport(t *testing.T) { testCtx := framework.NewTestCtx(t) defer testCtx.Cleanup(t) ns := framework.CreateNamespace(context.Background(), t, testCtx) + // Disable admission webhook for rule since utf8 is not enabled by default and rule contain metric name with utf8 characters. ruleNamespaceSelector := map[string]string{"excludeFromWebhook": "true"} err := framework.AddLabelsToNamespace(context.Background(), ns, ruleNamespaceSelector) @@ -5720,6 +5714,153 @@ func testPrometheusUTF8MetricsSupport(t *testing.T) { require.NoError(t, err, "UTF-8 alert rule should be queryable") } +func testPrometheusUTF8LabelSupport(t *testing.T) { + t.Parallel() + + testCtx := framework.NewTestCtx(t) + defer testCtx.Cleanup(t) + ns := framework.CreateNamespace(context.Background(), t, testCtx) + + framework.SetupPrometheusRBAC(context.Background(), t, testCtx, ns) + + name := "prometheus-utf8-test" + + // Create deployment for instrumented sample app + deployment := &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "instrumented-sample-app", + Namespace: ns, + Labels: map[string]string{ + "app": "instrumented-sample-app", + }, + }, + Spec: appsv1.DeploymentSpec{ + Replicas: ptr.To(int32(1)), + Selector: &metav1.LabelSelector{ + MatchLabels: map[string]string{"app.name": "instrumented-sample-app"}, + }, + Template: v1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "app.name": "instrumented-sample-app", + }, + }, + Spec: v1.PodSpec{ + Containers: []v1.Container{{ + Name: "instrumented-sample-app", + Image: "quay.io/prometheus-operator/instrumented-sample-app:latest", + Ports: []v1.ContainerPort{{ + Name: "web", + ContainerPort: 8080, + Protocol: v1.ProtocolTCP, + }}, + }}, + }, + }, + }, + } + _, err := framework.KubeClient.AppsV1().Deployments(ns).Create(context.Background(), deployment, metav1.CreateOptions{}) + require.NoError(t, err) + + service := &v1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: "utf8-test-service", + Namespace: ns, + Labels: map[string]string{ + "app.name": "instrumented-sample-app", + "group": "test.app", + "cluster": "dev", + }, + }, + Spec: v1.ServiceSpec{ + Ports: []v1.ServicePort{{Name: "web", Port: 8080, TargetPort: intstr.FromInt(8080)}}, + Selector: map[string]string{"app.name": "instrumented-sample-app"}, + }, + } + _, err = framework.KubeClient.CoreV1().Services(ns).Create(context.Background(), service, metav1.CreateOptions{}) + require.NoError(t, err) + + sm := &monitoringv1.ServiceMonitor{ + ObjectMeta: metav1.ObjectMeta{ + Name: "utf8-servicemonitor", + Namespace: ns, + Labels: map[string]string{"group": "test.app", "app.name": "instrumented-sample-app"}, + }, + Spec: monitoringv1.ServiceMonitorSpec{ + Selector: metav1.LabelSelector{ + MatchLabels: map[string]string{"app.name": "instrumented-sample-app"}, + }, + Endpoints: []monitoringv1.Endpoint{{ + Port: "web", + Interval: "2s", + RelabelConfigs: []monitoringv1.RelabelConfig{{ + SourceLabels: []monitoringv1.LabelName{"__meta_kubernetes_service_label_cluster"}, + TargetLabel: "service_clustér_label", + Action: "replace", + }}, + BasicAuth: &monitoringv1.BasicAuth{ + Username: v1.SecretKeySelector{ + LocalObjectReference: v1.LocalObjectReference{Name: "basic-auth"}, + Key: "username", + }, + Password: v1.SecretKeySelector{ + LocalObjectReference: v1.LocalObjectReference{Name: "basic-auth"}, + Key: "password", + }, + }, + }}, + }, + } + + secret := &v1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "basic-auth", + Namespace: ns, + }, + Type: v1.SecretTypeOpaque, + StringData: map[string]string{ + "username": "user", + "password": "pass", + }, + } + _, err = framework.KubeClient.CoreV1().Secrets(ns).Create(context.Background(), secret, metav1.CreateOptions{}) + require.NoError(t, err) + + _, err = framework.MonClientV1.ServiceMonitors(ns).Create(context.Background(), sm, metav1.CreateOptions{}) + require.NoError(t, err) + + err = framework.WaitForDeploymentReady(context.Background(), ns, "instrumented-sample-app", 1) + require.NoError(t, err) + + prom := framework.MakeBasicPrometheus(ns, name, "test.app", 1) + _, err = framework.CreatePrometheusAndWaitUntilReady(context.Background(), ns, prom) + require.NoError(t, err) + + // Default Prometheus service name is "prometheus-operated". + promSvcName := "prometheus-operated" + + // Wait for the instrumented-sample-app target to be discovered + err = framework.WaitForHealthyTargets(context.Background(), ns, promSvcName, 1) + require.NoError(t, err) + + // Verify UTF8 labels work in queries. + err = wait.PollUntilContextTimeout(context.Background(), 5*time.Second, 2*time.Minute, false, func(ctx context.Context) (bool, error) { + results, err := framework.PrometheusQuery(ns, promSvcName, "http", `{"service_clustér_label"="dev"}`) + if err != nil { + t.Logf("UTF8 label query failed: %v", err) + return false, nil + } + + if len(results) == 0 { + t.Logf("UTF8 label query returned no results") + return false, nil + } + + return true, nil + }) + require.NoError(t, err, "UTF-8 label queries should work in Prometheus 3.0+ queries") +} + func isAlertmanagerDiscoveryWorking(ns, promSVCName, alertmanagerName string) func(ctx context.Context) (bool, error) { return func(ctx context.Context) (bool, error) { pods, err := framework.KubeClient.CoreV1().Pods(ns).List(