File tree Expand file tree Collapse file tree
playbooks/robusta_playbooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,3 +21,5 @@ skaffold.dev.yaml
2121tests /last_used_tag.txt
2222pytest.ini
2323gen-config-test
24+
25+ ** /.claude /settings.local.json
Original file line number Diff line number Diff line change @@ -230,6 +230,7 @@ def _generate_prometheus_secrets(prom_config: PrometheusConfig) -> List[KRRSecre
230230 # needed for custom bearer token or Azure
231231 headers = PrometheusAuthorization .get_authorization_headers (prom_config )
232232 auth_header = headers ["Authorization" ] if "Authorization" in headers else ""
233+ additional_headers = prom_config ["headers" ] if "headers" in prom_config else None
233234
234235 if auth_header :
235236 krr_secrets .append (
@@ -240,6 +241,21 @@ def _generate_prometheus_secrets(prom_config: PrometheusConfig) -> List[KRRSecre
240241 command_flag = "--prometheus-auth-header" ,
241242 )
242243 )
244+
245+ if additional_headers :
246+ for header_name , header_value in prom_config .headers .items ():
247+
248+ env_var_name = f"PROMETHEUS_HEADER_{ header_name .upper ().replace ('-' , '_' )} "
249+ secret_key = f"prometheus-header-{ header_name .lower ()} "
250+
251+ krr_secrets .append (
252+ KRRSecret (
253+ env_var_name = env_var_name ,
254+ secret_key = secret_key ,
255+ secret_value = header_value ,
256+ command_flag = f"--prometheus-header { header_name } :" ,
257+ )
258+ )
243259
244260 if isinstance (prom_config , AWSPrometheusConfig ):
245261 krr_secrets .extend (
Original file line number Diff line number Diff line change @@ -310,6 +310,7 @@ class PrometheusParams(ActionParams):
310310 :var prometheus_url: Prometheus url. If omitted, we will try to find a prometheus instance in the same cluster
311311 :var prometheus_auth: Prometheus auth header to be used in Authorization header. If omitted, we will not add any auth header
312312 :var prometheus_url_query_string: Additional query string parameters to be appended to the Prometheus connection URL
313+ :var prometheus_additional_headers: additional HTTP headers (if defined) to add to every prometheus query
313314 :var prometheus_additional_labels: A dictionary of additional labels needed for multi-cluster prometheus
314315 :var add_additional_labels: adds the additional labels (if defined) to the query
315316
@@ -325,6 +326,7 @@ class PrometheusParams(ActionParams):
325326 prometheus_url : Optional [str ] = None
326327 prometheus_auth : Optional [SecretStr ] = None
327328 prometheus_url_query_string : Optional [str ] = None
329+ prometheus_additional_headers : Optional [Dict [str , str ]] = None
328330 prometheus_additional_labels : Optional [Dict [str , str ]] = None
329331 add_additional_labels : bool = True
330332 prometheus_graphs_overrides : Optional [List [OverrideGraph ]] = None
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ def generate_prometheus_config(prometheus_params: PrometheusParams) -> Prometheu
4949 "disable_ssl" : not PROMETHEUS_SSL_ENABLED ,
5050 "additional_labels" : prometheus_params .prometheus_additional_labels ,
5151 "prometheus_url_query_string" : prometheus_params .prometheus_url_query_string ,
52+ "headers" : prometheus_params .prometheus_additional_headers
5253 }
5354 if prometheus_params .prometheus_auth :
5455 baseconfig ["prometheus_auth" ] = prometheus_params .prometheus_auth .get_secret_value ()
Original file line number Diff line number Diff line change @@ -56,11 +56,13 @@ def to_list(self) -> List[str]:
5656class AlertManagerParams (ActionParams ):
5757 """
5858 :var alertmanager_url: Alternative Alert Manager url to send requests.
59+ :var alertmanager_additional_headers: additional HTTP headers (if defined) to add to every alertmanager request
5960 """
6061
6162 alertmanager_flavor : str = None # type: ignore
6263 alertmanager_url : Optional [str ]
6364 alertmanager_auth : Optional [SecretStr ] = None
65+ alertmanager_additional_headers : Optional [Dict [str , str ]] = None
6466 grafana_api_key : str = None # type: ignore
6567
6668 @validator ("alertmanager_url" , allow_reuse = True )
@@ -143,6 +145,9 @@ def gen_alertmanager_headers(params: AlertManagerParams) -> Dict:
143145
144146 elif params .alertmanager_auth :
145147 headers .update ({"Authorization" : params .alertmanager_auth .get_secret_value ()})
148+
149+ if params .alertmanager_additional_headers :
150+ headers .update (params .alertmanager_additional_headers )
146151
147152 return headers
148153
You can’t perform that action at this time.
0 commit comments