Skip to content

Commit

Permalink
fix: cleanup and liniting metrics components
Browse files Browse the repository at this point in the history
Signed-off-by: WrenIX <[email protected]>
  • Loading branch information
wrenix committed Nov 20, 2023
1 parent e5c7e61 commit 1bc1970
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion charts/nextcloud/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: nextcloud
version: 4.5.3
version: 4.5.4
appVersion: 27.1.3
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.metrics.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -18,20 +19,21 @@ spec:
app.kubernetes.io/component: metrics
template:
metadata:
annotations: {{- toYaml .Values.metrics.podAnnotations | nindent 8 }}
annotations:
{{- toYaml .Values.metrics.podAnnotations | nindent 8 }}
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: metrics
{{- if .Values.metrics.podLabels }}
{{ toYaml .Values.metrics.podLabels | indent 8 }}
{{- end }}
{{- with .Values.metrics.podLabels }}
{{- toYaml . | indent 8 }}
{{- end }}
spec:
{{- if .Values.metrics.image.pullSecrets }}
{{- with .Values.metrics.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.metrics.image.pullSecrets }}
{{- range . }}
- name: {{ . }}
{{- end}}
{{- end}}
{{- end }}
containers:
- name: metrics-exporter
Expand Down Expand Up @@ -66,8 +68,9 @@ spec:
ports:
- name: metrics
containerPort: 9205
{{- if .Values.metrics.resources }}
resources: {{- toYaml .Values.metrics.resources | nindent 10 }}
{{- with .Values.metrics.resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
securityContext:
runAsUser: 1000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.metrics.enabled }}
---
apiVersion: v1
kind: Service
metadata:
Expand All @@ -9,18 +10,18 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: metrics
{{- if .Values.metrics.service.labels -}}
{{ toYaml .Values.metrics.service.labels | nindent 4 }}
{{- end -}}
{{- if .Values.metrics.service.annotations }}
annotations: {{ toYaml .Values.metrics.service.annotations | nindent 4 }}
{{- with .Values.metrics.service.labels }}
{{- toYaml .Values.metrics.service.labels | nindent 4 }}
{{- end }}
{{- with .Values.metrics.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.metrics.service.type }}
{{ if eq .Values.metrics.service.type "LoadBalancer" -}} {{ if .Values.metrics.service.loadBalancerIP }}
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
{{ end -}}
{{- end -}}
{{- end }}
ports:
- name: metrics
port: 9205
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "nextcloud.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace | quote }}
{{- with .Values.metrics.serviceMonitor.namespace }}
namespace: {{ . | quote }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
Expand All @@ -14,8 +15,8 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: metrics
{{- if .Values.metrics.serviceMonitor.labels -}}
{{ toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }}
{{- with .Values.metrics.serviceMonitor.labels }}
{{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }}
Expand All @@ -30,10 +31,10 @@ spec:
endpoints:
- port: metrics
path: "/"
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- end }}

0 comments on commit 1bc1970

Please sign in to comment.