Skip to content

Commit cd6b11b

Browse files
committed
feat: add parameter enableAdminAPI to prometheus configuration
Signed-off-by: morenod <[email protected]>
1 parent 6e9572d commit cd6b11b

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

bundle/manifests/monitoring.rhobs_monitoringstacks.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ spec:
205205
Defaults to the value of `false`.
206206
The resulting endpoint is /api/v1/otlp/v1/metrics.
207207
type: boolean
208+
enableAdminAPI:
209+
description: |-
210+
Enable Prometheus admin API. Defaults to the value of `false`.
211+
type: boolean
208212
enableRemoteWriteReceiver:
209213
description: Enable Prometheus to be used as a receiver for the
210214
Prometheus remote write protocol. Defaults to the value of `false`.

deploy/crds/common/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.

docs/api.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,13 +478,22 @@ Defaults to the value of `false`.
478478
The resulting endpoint is /api/v1/otlp/v1/metrics.<br/>
479479
</td>
480480
<td>false</td>
481+
</tr><tr>
482+
<td><b>enableAdminAPI</b></td>
483+
<td>boolean</td>
484+
<td>
485+
Enable Prometheus Admin API. Defaults to the value of `false`.<br/>
486+
</td>
487+
<td>false</td>
481488
</tr><tr>
482489
<td><b>enableRemoteWriteReceiver</b></td>
483490
<td>boolean</td>
484491
<td>
485492
Enable Prometheus to be used as a receiver for the Prometheus remote write protocol. Defaults to the value of `false`.<br/>
486493
</td>
487494
<td>false</td>
495+
496+
488497
</tr><tr>
489498
<td><b>externalLabels</b></td>
490499
<td>map[string]string</td>

pkg/apis/monitoring/v1alpha1/types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ type PrometheusConfig struct {
222222
// Define ExternalLabels for prometheus
223223
// +optional
224224
ExternalLabels map[string]string `json:"externalLabels,omitempty"`
225+
// Enable Prometheus Admin API
226+
// Default to the value of `false`.
227+
// +optional
228+
EnableAdminAPI bool `json:"enableAdminAPI,omitempty"`
225229
// Enable Prometheus to be used as a receiver for the Prometheus remote write protocol. Defaults to the value of `false`.
226230
// +optional
227231
EnableRemoteWriteReceiver bool `json:"enableRemoteWriteReceiver,omitempty"`

pkg/controllers/monitoring/monitoring-stack/components.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ func newPrometheus(
201201
},
202202
RemoteWrite: config.RemoteWrite,
203203
ExternalLabels: config.ExternalLabels,
204+
EnableAdminAPI: config.EnableAdminAPI,
204205
EnableRemoteWriteReceiver: config.EnableRemoteWriteReceiver,
205206
EnableFeatures: func() []monv1.EnableFeature {
206207
if config.EnableOtlpHttpReceiver != nil && *config.EnableOtlpHttpReceiver {

test/e2e/monitoring_stack_controller_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ func assertPrometheusManagedFields(t *testing.T) {
741741
ExternalLabels: map[string]string{
742742
"key": "value",
743743
},
744+
EnableAdminAPI: true,
744745
EnableRemoteWriteReceiver: true,
745746
EnableOtlpHttpReceiver: func(b bool) *bool { return &b }(true),
746747
WebTLSConfig: &stack.WebTLSConfig{
@@ -947,6 +948,7 @@ const oboManagedFieldsJson = `
947948
"f:alertmanagers": {}
948949
},
949950
"f:arbitraryFSAccessThroughSMs": {},
951+
"f:enableAdminAPI": {},
950952
"f:enableRemoteWriteReceiver": {},
951953
"f:externalLabels": {
952954
"f:key": {}

0 commit comments

Comments
 (0)