Skip to content

Commit 943694d

Browse files
authored
Merge branch 'master' into vm-integration-update
2 parents 4ef7cd4 + 808d455 commit 943694d

13 files changed

Lines changed: 73 additions & 11 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ skaffold.dev.yaml
2121
tests/last_used_tag.txt
2222
pytest.ini
2323
gen-config-test
24+
25+
**/.claude/settings.local.json

docs/configuration/alertmanager-integration/_pull_integration.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ If Robusta fails to auto-detect the Prometheus and Alertmanager urls - and you s
2424
# prometheus_auth: ...
2525
# alertmanager_auth: ...
2626
27+
# If using a multi-tenant prometheus or alertmanager, pass the org id to all queries
28+
# prometheus_additional_headers:
29+
# X-Scope-OrgID: <org id>
30+
# alertmanager_additional_headers:
31+
# X-Scope-OrgID: <org id>
32+
2733
.. code-annotations::
2834
1. Example: http://alertmanager-Helm_release_name-kube-prometheus-alertmanager.default.svc.cluster.local:9093.
2935
2. Example: http://Helm_Release_Name-kube-prometheus-prometheus.default.svc.cluster.local:9090

docs/configuration/alertmanager-integration/coralogix_managed_prometheus.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ Metrics querying lets Robusta pull metrics from Coralogix Managed Prometheus.
8282
# grafana_api_key: <YOUR GRAFANA EDITOR API KEY> # (1)
8383
# alertmanager_flavor: grafana
8484
85+
# If using a multi-tenant prometheus or alertmanager, pass the org id to all queries
86+
# prometheus_additional_headers:
87+
# X-Scope-OrgID: <org id>
88+
# alertmanager_additional_headers:
89+
# X-Scope-OrgID: <org id>
90+
8591
.. code-annotations::
8692
1. This is necessary for Robusta to create silences when using Grafana Alerts, because of minor API differences in the AlertManager embedded in Grafana.
8793

docs/configuration/alertmanager-integration/grafana-alert-manager.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ Modify and add the following config to ``generated_values.yaml`` and :ref:`updat
8383
# prometheus_additional_labels:
8484
# cluster: 'CLUSTER_NAME_HERE'
8585
86+
# If using a multi-tenant prometheus or alertmanager, pass the org id to all queries
87+
# prometheus_additional_headers:
88+
# X-Scope-OrgID: <org id>
89+
# alertmanager_additional_headers:
90+
# X-Scope-OrgID: <org id>
91+
8692
.. code-annotations::
8793
1. This is necessary for Robusta to create silences when using Grafana Alerts, because of minor API differences in the AlertManager embedded in Grafana.
8894

docs/configuration/alertmanager-integration/victoria-metrics.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ If auto-detection fails you must add the ``prometheus_url`` parameter and :ref:`
6161
# grafana_api_key: <YOUR GRAFANA EDITOR API KEY> # (1)
6262
# alertmanager_flavor: grafana
6363
64+
# If using a multi-tenant prometheus or alertmanager, pass the org id to all queries
65+
# prometheus_additional_headers:
66+
# X-Scope-OrgID: <org id>
67+
# alertmanager_additional_headers:
68+
# X-Scope-OrgID: <org id>
69+
6470
.. code-annotations::
6571
1. This is necessary for Robusta to create silences when using Grafana Alerts, because of minor API differences in the AlertManager embedded in Grafana.
6672

helm/robusta/Chart.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ dependencies:
44
version: 55.7.0
55
- name: holmes
66
repository: https://robusta-charts.storage.googleapis.com
7-
version: 0.10.9
8-
digest: sha256:5510176739e62f2765876c1dc397518230ae4e4d2103a9630a6546ae65716c37
9-
generated: "2025-04-14T11:54:09.485155+03:00"
7+
version: 0.11.1
8+
digest: sha256:0b622c65ad0b2d18c52c4c4d8f3c19f6176ce89b1ae7c98411211ee2d50d4b46
9+
generated: "2025-05-12T09:51:33.315282+03:00"

helm/robusta/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ dependencies:
1515
condition: enablePrometheusStack
1616
repository: "https://prometheus-community.github.io/helm-charts"
1717
- name: holmes
18-
version: 0.10.9
18+
version: 0.11.1
1919
condition: enableHolmesGPT
2020
repository: "https://robusta-charts.storage.googleapis.com"
-2.71 KB
Binary file not shown.
2.74 KB
Binary file not shown.

playbooks/robusta_playbooks/krr.py

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,14 @@ class KRRSecret(BaseModel):
178178
secret_value: str
179179
command_flag: str
180180

181-
def __init__(self, env_var_name: str, secret_key: str, secret_value: str, command_flag: str):
182-
secret_b64_str = base64.b64encode(bytes(secret_value, "utf-8")).decode("utf-8")
183-
super().__init__(
184-
env_var_name=env_var_name, secret_key=secret_key, secret_value=secret_b64_str, command_flag=command_flag
185-
)
181+
@validator('secret_value', pre=True, always=True, allow_reuse=True)
182+
def encode_secret_value(cls, v: str) -> str:
183+
if isinstance(v, str):
184+
return base64.b64encode(bytes(v, "utf-8")).decode("utf-8")
185+
raise ValueError("secret_value must be a string")
186+
187+
class KRRSecretKeyValuePair(KRRSecret):
188+
arg_key: str
186189

187190

188191
def _generate_krr_job_secret(scan_id: str, krr_secrets: Optional[List[KRRSecret]]) -> Optional[JobSecret]:
@@ -210,7 +213,14 @@ def _generate_krr_env_vars(
210213
def _generate_additional_env_args(krr_secrets: Optional[List[KRRSecret]]) -> str:
211214
if not krr_secrets:
212215
return ""
213-
return " ".join(f"{secret.command_flag} '$({secret.env_var_name})'" for secret in krr_secrets)
216+
additional_args = []
217+
for secret in krr_secrets:
218+
if isinstance(secret, KRRSecretKeyValuePair):
219+
additional_args.append(f"{secret.command_flag} '{secret.arg_key}:$({secret.env_var_name})'")
220+
else:
221+
additional_args.append(f"{secret.command_flag} '$({secret.env_var_name})'")
222+
223+
return " ".join(additional_args)
214224

215225

216226
def _generate_cmd_line_args(prom_config: PrometheusConfig) -> str:
@@ -240,6 +250,22 @@ def _generate_prometheus_secrets(prom_config: PrometheusConfig) -> List[KRRSecre
240250
command_flag="--prometheus-auth-header",
241251
)
242252
)
253+
254+
if prom_config.headers:
255+
for header_name, header_value in prom_config.headers.items():
256+
257+
env_var_name = f"PROMETHEUS_HEADER_{header_name.upper().replace('-', '_')}"
258+
secret_key = f"prometheus-header-{header_name.lower()}"
259+
260+
krr_secrets.append(
261+
KRRSecretKeyValuePair(
262+
env_var_name=env_var_name,
263+
arg_key=header_name,
264+
secret_key=secret_key,
265+
secret_value=header_value,
266+
command_flag="--prometheus-headers",
267+
)
268+
)
243269

244270
if isinstance(prom_config, AWSPrometheusConfig):
245271
krr_secrets.extend(

0 commit comments

Comments
 (0)