Skip to content

Commit

Permalink
feat(serviceMonitor): add multiple settings for ServiceMonitor resource
Browse files Browse the repository at this point in the history
* feat(serviceMonitor): add multiple additional settings for ServiceMonitor resource
   Signed-off-by: Jan Kejř <[email protected]>
* fix(serviceMonitor): remove tlsconfig and scheme due to http only
   Signed-off-by: Jan Kejř <[email protected]>
* fix(serviceMonitor): disable as default option
   Signed-off-by: Jan Kejř <[email protected]>
* refactor(serviceMonitor): remove tlsconfig and scheme from Service Monitor resource
   Signed-off-by: Jan Kejř <[email protected]>
* refactor(serviceMonitor): adjust field descriptions
  Signed-off-by: Eric Weber <[email protected]>
* refactor(serviceMonitor): default interval to empty
   Signed-off-by: Eric Weber <[email protected]>

Longhorn 8142

Signed-off-by: Jan Kejř <[email protected]>
Signed-off-by: Eric Weber <[email protected]>
Co-authored-by: Eric Weber <[email protected]>
  • Loading branch information
kejrak and ejweber authored Jul 11, 2024
1 parent 40b4207 commit 1106675
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
10 changes: 8 additions & 2 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ The `values.yaml` contains items used to tweak a deployment of this chart.
| persistence.defaultClass | bool | `true` | Setting that allows you to specify the default Longhorn StorageClass. |
| persistence.defaultClassReplicaCount | int | `3` | Replica count of the default Longhorn StorageClass. |
| persistence.defaultDataLocality | string | `"disabled"` | Data locality of the default Longhorn StorageClass. (Options: "disabled", "best-effort") |
| persistence.defaultFsType | string | `"ext4"` | Filesystem type of the default Longhorn StorageClass. |
| persistence.defaultMkfsParams | string | `""` | mkfs parameters of the default Longhorn StorageClass. |
| persistence.defaultDiskSelector.enable | bool | `false` | Setting that allows you to enable the disk selector for the default Longhorn StorageClass. |
| persistence.defaultDiskSelector.selector | string | `""` | Disk selector for the default Longhorn StorageClass. Longhorn uses only disks with the specified tags for storing volume data. (Examples: "nvme,sata") |
| persistence.defaultFsType | string | `"ext4"` | Filesystem type of the default Longhorn StorageClass. |
| persistence.defaultMkfsParams | string | `""` | mkfs parameters of the default Longhorn StorageClass. |
| persistence.defaultNodeSelector.enable | bool | `false` | Setting that allows you to enable the node selector for the default Longhorn StorageClass. |
| persistence.defaultNodeSelector.selector | string | `""` | Node selector for the default Longhorn StorageClass. Longhorn uses only nodes with the specified tags for storing volume data. (Examples: "storage,fast") |
| persistence.disableRevisionCounter | string | `"true"` | Setting that disables the revision counter and thereby prevents Longhorn from tracking all write operations to a volume. When salvaging a volume, Longhorn uses properties of the volume-head-xxx.img file (the last file size and the last time the file was modified) to select the replica to be used for volume recovery. |
Expand Down Expand Up @@ -248,7 +248,13 @@ For more details, see the [ocp-readme](https://github.com/longhorn/longhorn/blob
| annotations | `{}` | Annotation for the Longhorn Manager DaemonSet pods. This setting is optional. |
| enableGoCoverDir | `false` | Setting that allows Longhorn to generate code coverage profiles. |
| enablePSP | `false` | Setting that allows you to enable pod security policies (PSPs) that allow privileged Longhorn pods to start. This setting applies only to clusters running Kubernetes 1.25 and earlier, and with the built-in Pod Security admission controller enabled. |
| metrics.serviceMonitor.additionalLabels | `{}` | Setting that adds additional labels to the Prometheus ServiceMonitor. |
| metrics.serviceMonitor.annotations | `{}` | Setting that adds annotations to the Prometheus ServiceMonitor. |
| metrics.serviceMonitor.enabled | `false` | Setting that allows the creation of a Prometheus ServiceMonitor resource for Longhorn Manager components. |
| metrics.serviceMonitor.interval | `""` | Interval at which Prometheus scrapes the metrics from the target. |
| metrics.serviceMonitor.metricRelabelings | `[]` | Configures the relabeling rules to apply to the samples before ingestion. See Prometheus operator documentation for format. |
| metrics.serviceMonitor.relabelings | `[]` | Configures the relabeling rules to apply the target’s metadata labels. See Prometheus operator documentation for format. |
| metrics.serviceMonitor.scrapeTimeout | `""` | Timeout after which Prometheus considers the scrape to be failed. |
| namespaceOverride | `""` | Specify override namespace, specifically this is useful for using longhorn as sub-chart and its release namespace is not the `longhorn-system`. |
| preUpgradeChecker.jobEnabled | `true` | Setting that allows Longhorn to perform pre-upgrade checks. Disable this setting when installing Longhorn using Argo CD or other GitOps solutions. |
| preUpgradeChecker.upgradeVersionCheck | `true` | Setting that allows Longhorn to perform upgrade version checks after starting the Longhorn Manager DaemonSet Pods. Disabling this setting also disables `preUpgradeChecker.jobEnabled`. Longhorn recommends keeping this setting enabled. |
Expand Down
21 changes: 21 additions & 0 deletions chart/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ metadata:
labels:
{{- include "longhorn.labels" . | nindent 4 }}
name: longhorn-prometheus-servicemonitor
{{- with .Values.metrics.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand All @@ -16,4 +23,18 @@ spec:
- {{ include "release_namespace" . }}
endpoints:
- port: manager
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,20 @@ metrics:
serviceMonitor:
# -- Setting that allows the creation of a Prometheus ServiceMonitor resource for Longhorn Manager components.
enabled: false
# -- Setting that adds additional labels to the Prometheus ServiceMonitor.
additionalLabels: {}
# -- Setting that adds annotations to the Prometheus ServiceMonitor.
annotations: {}
# -- Interval at which Prometheus scrapes the metrics from the target.
interval: ""
# -- Timeout after which Prometheus considers the scrape to be failed.
scrapeTimeout: ""
# -- Configures the relabeling rules to apply the target’s metadata labels. See Prometheus operator documentation
# for format.
relabelings: []
# -- Configures the relabeling rules to apply to the samples before ingestion. See Prometheus operator documentation
# for format.
metricRelabelings: []

## openshift settings
openshift:
Expand Down

0 comments on commit 1106675

Please sign in to comment.