Skip to content

Commit

Permalink
feat: add option to pass EnableRemoteWriteReceiver to Prometheus CR
Browse files Browse the repository at this point in the history
Fixes: #160

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
  • Loading branch information
jan--f committed Jul 15, 2022
1 parent beb0c8c commit 37c777e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions deploy/crds/common/monitoring.rhobs_monitoringstacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ spec:
replicas: 2
description: Define prometheus config
properties:
enableRemoteWriteReceiver:
description: Enable Prometheus to be used as a receiver for the
Prometheus remote write protocol. Defaults to the value of `false`.
type: boolean
externalLabels:
additionalProperties:
type: string
Expand Down
7 changes: 7 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ Define prometheus config
</tr>
</thead>
<tbody><tr>
<td><b>enableRemoteWriteReceiver</b></td>
<td>boolean</td>
<td>
Enable Prometheus to be used as a receiver for the Prometheus remote write protocol. Defaults to the value of `false`.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>externalLabels</b></td>
<td>map[string]string</td>
<td>
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/monitoring/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ type PrometheusConfig struct {
// Define ExternalLabels for prometheus
// +optional
ExternalLabels map[string]string `json:"externalLabels,omitempty"`
// Enable Prometheus to be used as a receiver for the Prometheus remote write protocol. Defaults to the value of `false`.
// +optional
EnableRemoteWriteReceiver bool `json:"enableRemoteWriteReceiver,omitempty"`
}

// NamespaceSelector is a selector for selecting either all namespaces or a
Expand Down
5 changes: 3 additions & 2 deletions pkg/controllers/monitoring/monitoring-stack/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ func newPrometheus(
RunAsNonRoot: pointer.Bool(true),
RunAsUser: pointer.Int64(PrometheusUserFSGroupID),
},
RemoteWrite: config.RemoteWrite,
ExternalLabels: config.ExternalLabels,
RemoteWrite: config.RemoteWrite,
ExternalLabels: config.ExternalLabels,
EnableRemoteWriteReceiver: config.EnableRemoteWriteReceiver,
},
Retention: ms.Spec.Retention,
RuleSelector: prometheusSelector,
Expand Down

0 comments on commit 37c777e

Please sign in to comment.