Skip to content

Commit 012e3cb

Browse files
committed
feat: add EnableAdminAPI field to PrometheusConfig API
Add the EnableAdminAPI boolean field to the PrometheusConfig struct to allow users to configure whether the Prometheus Admin API should be enabled. This commit only adds the API definition without implementing its usage in the controller. The field includes appropriate validation and documentation warning about security implications. Signed-off-by: morenod <[email protected]>
1 parent ed8af0f commit 012e3cb

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

bundle/manifests/monitoring.rhobs_monitoringstacks.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ spec:
199199
replicas: 2
200200
description: Define prometheus config
201201
properties:
202+
enableAdminAPI:
203+
description: |-
204+
Enable Prometheus Admin API
205+
Default to the value of `false`.
206+
type: boolean
202207
enableOtlpHttpReceiver:
203208
description: |-
204209
Enable Prometheus to accept OpenTelemetry Metrics via the otlp/http protocol.

deploy/crds/common/monitoring.rhobs_monitoringstacks.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ spec:
199199
replicas: 2
200200
description: Define prometheus config
201201
properties:
202+
enableAdminAPI:
203+
description: |-
204+
Enable Prometheus Admin API.
205+
Defaults to the value of `false`.
206+
WARNING: Enabling the admin APIs enables mutating endpoints, to delete data,
207+
shutdown Prometheus, and more. Enabling this should be done with care and the
208+
user is advised to add additional authentication authorization via a proxy to
209+
ensure only clients authorized to perform these actions can do so.
210+
type: boolean
202211
enableOtlpHttpReceiver:
203212
description: |-
204213
Enable Prometheus to accept OpenTelemetry Metrics via the otlp/http protocol.

docs/api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,18 @@ Define prometheus config
470470
</tr>
471471
</thead>
472472
<tbody><tr>
473+
<td><b>enableAdminAPI</b></td>
474+
<td>boolean</td>
475+
<td>
476+
Enable Prometheus Admin API.
477+
Defaults to the value of `false`.
478+
WARNING: Enabling the admin APIs enables mutating endpoints, to delete data,
479+
shutdown Prometheus, and more. Enabling this should be done with care and the
480+
user is advised to add additional authentication authorization via a proxy to
481+
ensure only clients authorized to perform these actions can do so.<br/>
482+
</td>
483+
<td>false</td>
484+
</tr><tr>
473485
<td><b>enableOtlpHttpReceiver</b></td>
474486
<td>boolean</td>
475487
<td>

pkg/apis/monitoring/v1alpha1/types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,14 @@ type PrometheusConfig struct {
236236
// Configure TLS options for the Prometheus web server.
237237
// +optional
238238
WebTLSConfig *WebTLSConfig `json:"webTLSConfig,omitempty"`
239+
// Enable Prometheus Admin API.
240+
// Defaults to the value of `false`.
241+
// WARNING: Enabling the admin APIs enables mutating endpoints, to delete data,
242+
// shutdown Prometheus, and more. Enabling this should be done with care and the
243+
// user is advised to add additional authentication authorization via a proxy to
244+
// ensure only clients authorized to perform these actions can do so.
245+
// +optional
246+
EnableAdminAPI bool `json:"enableAdminAPI,omitempty"`
239247
}
240248

241249
type AlertmanagerConfig struct {

0 commit comments

Comments
 (0)