Merge pull request #12960 from rook/mergify/bp/release-1.12/pr-12926
mgr: adding support for prometheus endpoint configuration (backport #12926)
This commit is contained in:
7 files changed
+83
No files matched your search
@@ -4982,6 +4982,30 @@ bool
|
||||
<p>SSL determines whether SSL should be used</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>prometheusEndpoint</code><br/>
|
||||
<em>
|
||||
string
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Endpoint for the Prometheus host</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>prometheusEndpointSSLVerify</code><br/>
|
||||
<em>
|
||||
bool
|
||||
</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>(Optional)</em>
|
||||
<p>Whether to verify the ssl endpoint for prometheus. Set to false for a self-signed cert.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3 id="ceph.rook.io/v1.Device">Device
|
||||
|
||||
@@ -63,6 +63,27 @@ Ensure that the Prometheus server pod gets created and advances to the `Running`
|
||||
kubectl -n rook-ceph get pod prometheus-rook-prometheus-0
|
||||
```
|
||||
|
||||
### Dashboard config
|
||||
|
||||
Configure the Prometheus endpoint so the dashboard can retrieve metrics from Prometheus with two settings:
|
||||
- `prometheusEndpoint`: The url of the Prometheus instance
|
||||
- `prometheusEndpointSSLVerify`: Whether SSL should be verified if the Prometheus server is using https
|
||||
|
||||
The following command can be used to get the Prometheus url:
|
||||
|
||||
```console
|
||||
echo "http://$(kubectl -n rook-ceph -o jsonpath={.status.hostIP} get pod prometheus-rook-prometheus-0):30900"
|
||||
```
|
||||
|
||||
Following is an example to configure the Prometheus endpoint in the CephCluster CR.
|
||||
|
||||
```YAML
|
||||
spec:
|
||||
dashboard:
|
||||
prometheusEndpoint: http://192.168.61.204:30900
|
||||
prometheusEndpointSSLVerify: true
|
||||
```
|
||||
|
||||
!!! note
|
||||
It is not recommended to consume storage from the Ceph cluster for Prometheus.
|
||||
If the Ceph cluster fails, Prometheus would become unresponsive and thus not alert you of the failure.
|
||||
|
||||
@@ -974,6 +974,12 @@ spec:
|
||||
maximum: 65535
|
||||
minimum: 0
|
||||
type: integer
|
||||
prometheusEndpoint:
|
||||
description: Endpoint for the Prometheus host
|
||||
type: string
|
||||
prometheusEndpointSSLVerify:
|
||||
description: Whether to verify the ssl endpoint for prometheus. Set to false for a self-signed cert.
|
||||
type: boolean
|
||||
ssl:
|
||||
description: SSL determines whether SSL should be used
|
||||
type: boolean
|
||||
|
||||
@@ -70,6 +70,10 @@ spec:
|
||||
# port: 8443
|
||||
# serve the dashboard using SSL
|
||||
ssl: true
|
||||
# The url of the Prometheus instance
|
||||
# prometheusEndpoint: <protocol>://<prometheus-host>:<port>
|
||||
# Whether SSL should be verified if the Prometheus server is using https
|
||||
# prometheusEndpointSSLVerify: false
|
||||
# enable prometheus alerting for cluster
|
||||
monitoring:
|
||||
# requires Prometheus to be pre-installed
|
||||
|
||||
@@ -972,6 +972,12 @@ spec:
|
||||
maximum: 65535
|
||||
minimum: 0
|
||||
type: integer
|
||||
prometheusEndpoint:
|
||||
description: Endpoint for the Prometheus host
|
||||
type: string
|
||||
prometheusEndpointSSLVerify:
|
||||
description: Whether to verify the ssl endpoint for prometheus. Set to false for a self-signed cert.
|
||||
type: boolean
|
||||
ssl:
|
||||
description: SSL determines whether SSL should be used
|
||||
type: boolean
|
||||
|
||||
@@ -318,6 +318,12 @@ type DashboardSpec struct {
|
||||
// SSL determines whether SSL should be used
|
||||
// +optional
|
||||
SSL bool `json:"ssl,omitempty"`
|
||||
// Endpoint for the Prometheus host
|
||||
// +optional
|
||||
PrometheusEndpoint string `json:"prometheusEndpoint,omitempty"`
|
||||
// Whether to verify the ssl endpoint for prometheus. Set to false for a self-signed cert.
|
||||
// +optional
|
||||
PrometheusEndpointSSLVerify bool `json:"prometheusEndpointSSLVerify,omitempty"`
|
||||
}
|
||||
|
||||
// MonitoringSpec represents the settings for Prometheus based Ceph monitoring
|
||||
|
||||
@@ -129,6 +129,22 @@ func (c *Cluster) configureDashboardModuleSettings(daemonID string) (bool, error
|
||||
}
|
||||
hasChanged = hasChanged || changed
|
||||
|
||||
// Prometheus host end point
|
||||
prometheusEndpoint := c.spec.Dashboard.PrometheusEndpoint
|
||||
changed, err = monStore.SetIfChanged(daemonID, "mgr/dashboard/PROMETHEUS_API_HOST", prometheusEndpoint)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
hasChanged = hasChanged || changed
|
||||
|
||||
// Prometheus host end point ssl verify
|
||||
prometheusEndpointSSLVerify := strconv.FormatBool(c.spec.Dashboard.PrometheusEndpointSSLVerify)
|
||||
changed, err = monStore.SetIfChanged(daemonID, "mgr/dashboard/PROMETHEUS_API_SSL_VERIFY", prometheusEndpointSSLVerify)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
hasChanged = hasChanged || changed
|
||||
|
||||
// server port
|
||||
port := strconv.Itoa(c.dashboardInternalPort())
|
||||
changed, err = monStore.SetIfChanged(daemonID, "mgr/dashboard/server_port", port)
|
||||
|
||||
Reference in new issue
Block a user