Skip to content

Commit 6130562

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

File tree

7 files changed

+39
-1
lines changed

7 files changed

+39
-1
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.

bundle/manifests/observability-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ metadata:
4242
categories: Monitoring
4343
certified: "false"
4444
containerImage: observability-operator:1.2.0
45-
createdAt: "2025-10-02T08:35:53Z"
45+
createdAt: "2025-10-21T15:48:01Z"
4646
description: A Go based Kubernetes operator to setup and manage highly available
4747
Monitoring Stack using Prometheus, Alertmanager and Thanos Querier.
4848
operatorframework.io/cluster-monitoring: "true"

deploy/crds/common/monitoring.rhobs_monitoringstacks.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ spec:
131131
- CreateClusterRoleBindings
132132
- NoClusterRoleBindings
133133
type: string
134+
enableAdminAPI:
135+
description: |-
136+
Enable Prometheus Admin API.
137+
Defaults to the value of `false`.
138+
WARNING: Enabling the admin APIs enables mutating endpoints, to delete data,
139+
shutdown Prometheus, and more. Enabling this should be done with care and the
140+
user is advised to add additional authentication authorization via a proxy to
141+
ensure only clients authorized to perform these actions can do so.
142+
type: boolean
134143
logLevel:
135144
default: info
136145
description: Loglevel set log levels of configured components

docs/api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ so that endpoint discovery works as expected.<br/>
116116
<i>Default</i>: CreateClusterRoleBindings<br/>
117117
</td>
118118
<td>false</td>
119+
</tr><tr>
120+
<td><b>enableAdminAPI</b></td>
121+
<td>boolean</td>
122+
<td>
123+
Enable Prometheus Admin API.
124+
Defaults to the value of `false`.
125+
WARNING: Enabling the admin APIs enables mutating endpoints, to delete data,
126+
shutdown Prometheus, and more. Enabling this should be done with care and the
127+
user is advised to add additional authentication authorization via a proxy to
128+
ensure only clients authorized to perform these actions can do so.<br/>
129+
</td>
130+
<td>false</td>
119131
</tr><tr>
120132
<td><b>logLevel</b></td>
121133
<td>enum</td>

pkg/apis/monitoring/v1alpha1/types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ type MonitoringStackSpec struct {
108108
// +kubebuilder:default="120h"
109109
Retention monv1.Duration `json:"retention,omitempty"`
110110

111+
// Enable Prometheus Admin API.
112+
// Defaults to the value of `false`.
113+
// WARNING: Enabling the admin APIs enables mutating endpoints, to delete data,
114+
// shutdown Prometheus, and more. Enabling this should be done with care and the
115+
// user is advised to add additional authentication authorization via a proxy to
116+
// ensure only clients authorized to perform these actions can do so.
117+
// +optional
118+
EnableAdminAPI bool `json:"enableAdminAPI,omitempty"`
119+
111120
// Define resources requests and limits for Monitoring Stack Pods.
112121
// +optional
113122
// +kubebuilder:default={requests:{cpu: "100m", memory: "256Mi"}, limits:{memory: "512Mi", cpu: "500m"}}

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: ms.Spec.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
@@ -758,6 +758,7 @@ func assertPrometheusManagedFields(t *testing.T) {
758758
},
759759
},
760760
}
761+
ms.Spec.EnableAdminAPI = true
761762
ms.Spec.NamespaceSelector = &metav1.LabelSelector{
762763
MatchLabels: map[string]string{
763764
"label": "label-value",
@@ -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)