Skip to content

Commit

Permalink
feat: add support for configuring Prometheus external labels (#126)
Browse files Browse the repository at this point in the history
Fixes: #125

Signed-off-by: cm891237 <cmwylie19@gmail.com>
  • Loading branch information
cmwylie19 committed May 5, 2022
1 parent b6319a6 commit 02289d1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions deploy/crds/common/monitoring.rhobs_monitoringstacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ spec:
prometheusConfig:
description: Define prometheus config
properties:
externalLabels:
additionalProperties:
type: string
description: Define ExternalLabels for prometheus
type: object
persistentVolumeClaim:
description: Define persistent volume claim for prometheus
properties:
Expand Down
7 changes: 7 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ Define prometheus config
</tr>
</thead>
<tbody><tr>
<td><b>externalLabels</b></td>
<td>map[string]string</td>
<td>
Define ExternalLabels for prometheus<br/>
</td>
<td>false</td>
</tr><tr>
<td><b><a href="#monitoringstackspecprometheusconfigpersistentvolumeclaim">persistentVolumeClaim</a></b></td>
<td>object</td>
<td>
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ type PrometheusConfig struct {
// Define persistent volume claim for prometheus
// +optional
PersistentVolumeClaim *corev1.PersistentVolumeClaimSpec `json:"persistentVolumeClaim,omitempty"`
// Define ExternalLabels for prometheus
// +optional
ExternalLabels map[string]string `json:"externalLabels,omitempty"`
}

// NamespaceSelector is a selector for selecting either all namespaces or a
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pkg/controllers/monitoring-stack/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,9 @@ func newPrometheus(
BaseImage: stringPtr("quay.io/thanos/thanos"),
Version: stringPtr("v0.24.0"),
},
Storage: storageForPVC(config.PersistentVolumeClaim),
RemoteWrite: config.RemoteWrite,
Storage: storageForPVC(config.PersistentVolumeClaim),
RemoteWrite: config.RemoteWrite,
ExternalLabels: config.ExternalLabels,
},
}

Expand Down

0 comments on commit 02289d1

Please sign in to comment.