Skip to content

Commit 2e42e2b

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

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,13 @@ 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>
@@ -5724,4 +5731,4 @@ with respect to the current state of the instance.<br/>
57245731
</td>
57255732
<td>false</td>
57265733
</tr></tbody>
5727-
</table>
5734+
</table>

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
@@ -209,6 +209,7 @@ func newPrometheus(
209209
return []monv1.EnableFeature{}
210210
}(),
211211
},
212+
EnableAdminAPI: config.EnableAdminAPI,
212213
Retention: ms.Spec.Retention,
213214
RuleSelector: prometheusSelector,
214215
RuleNamespaceSelector: ms.Spec.NamespaceSelector,

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)