Skip to content

Commit

Permalink
Merge pull request #518 from wrenix/chore/metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin committed Feb 4, 2024
2 parents 9e51e9c + f13e1cd commit 0ffea21
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 75 deletions.
2 changes: 1 addition & 1 deletion charts/nextcloud/Chart.yaml
@@ -1,6 +1,6 @@
apiVersion: v2
name: nextcloud
version: 4.5.17
version: 4.5.18
appVersion: 28.0.2
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
Expand Down
8 changes: 4 additions & 4 deletions charts/nextcloud/templates/deployment.yaml
Expand Up @@ -63,13 +63,13 @@ spec:
postStart:
exec:
command:
{{- toYaml . | nindent 18 -}}
{{- toYaml . | nindent 18 }}
{{- end }}
{{- with .preStopCommand }}
preStop:
exec:
command:
{{- toYaml . | nindent 18 -}}
{{- toYaml . | nindent 18 }}
{{- end }}
{{- end }}
env:
Expand Down Expand Up @@ -245,13 +245,13 @@ spec:
postStart:
exec:
command:
{{- toYaml . | nindent 18 -}}
{{- toYaml . | nindent 18 }}
{{- end }}
{{- with .preStopCommand }}
preStop:
exec:
command:
{{- toYaml . | nindent 18 -}}
{{- toYaml . | nindent 18 }}
{{- end }}
{{- end }}
env:
Expand Down
12 changes: 7 additions & 5 deletions charts/nextcloud/templates/hpa.yaml
@@ -1,4 +1,4 @@
{{- if .Values.hpa.enabled -}}
{{- if .Values.hpa.enabled }}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
Expand All @@ -14,7 +14,9 @@ spec:
kind: Deployment
apiVersion: apps/v1
name: {{ template "nextcloud.fullname" . }}
minReplicas: {{ .Values.hpa.minPods }}
maxReplicas: {{ .Values.hpa.maxPods }}
targetCPUUtilizationPercentage: {{ .Values.hpa.cputhreshold }}
{{- end }}
{{- with .Values.hpa }}
minReplicas: {{ .minPods }}
maxReplicas: {{ .maxPods }}
targetCPUUtilizationPercentage: {{ .cputhreshold }}
{{- end }}{{/* end-with .hpa */}}
{{- end }}
16 changes: 8 additions & 8 deletions charts/nextcloud/templates/ingress.yaml
Expand Up @@ -9,16 +9,16 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: app
{{- if .Values.ingress.labels }}
{{ toYaml .Values.ingress.labels | indent 4 }}
{{- with .Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.ingress.annotations }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
rules:
- host: {{ .Values.nextcloud.host }}
Expand All @@ -38,8 +38,8 @@ spec:
serviceName: {{ template "nextcloud.fullname" . }}
servicePort: {{ .Values.service.port }}
{{- end }}
{{- if .Values.ingress.tls }}
{{- with .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
10 changes: 5 additions & 5 deletions charts/nextcloud/templates/metrics/deployment.yaml
Expand Up @@ -23,13 +23,13 @@ spec:
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 . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.metrics.image.pullSecrets }}
{{- with .Values.metrics.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.metrics.image.pullSecrets }}
{{- range . }}
- name: {{ . }}
{{- end}}
{{- end }}
Expand Down
18 changes: 10 additions & 8 deletions charts/nextcloud/templates/metrics/service.yaml
Expand Up @@ -9,18 +9,20 @@ 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 }}
{{- with .Values.metrics.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end -}}
{{- if .Values.metrics.service.annotations }}
annotations: {{ toYaml .Values.metrics.service.annotations | nindent 4 }}
{{- 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 }}
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
{{ end -}}
{{- end -}}
{{- if eq .Values.metrics.service.type "LoadBalancer" }}
{{- with .Values.metrics.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- end }}
ports:
- name: metrics
port: 9205
Expand Down
18 changes: 7 additions & 11 deletions charts/nextcloud/templates/metrics/servicemonitor.yaml
Expand Up @@ -3,19 +3,15 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "nextcloud.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace | quote }}
{{- else }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
namespace: {{ .Values.metrics.serviceMonitor.namespace | default .Release.Namespace | quote }}
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
helm.sh/chart: {{ include "nextcloud.chart" . }}
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 . | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }}
Expand All @@ -30,10 +26,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 }}
16 changes: 7 additions & 9 deletions charts/nextcloud/templates/nextcloud-data-pvc.yaml
@@ -1,5 +1,4 @@
{{- if and .Values.persistence.enabled .Values.persistence.nextcloudData.enabled -}}
{{- if not .Values.persistence.nextcloudData.existingClaim -}}
{{- if and .Values.persistence.enabled .Values.persistence.nextcloudData.enabled (not .Values.persistence.nextcloudData.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand All @@ -10,22 +9,21 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: app
{{- if .Values.persistence.nextcloudData.annotations }}
{{- with .Values.persistence.nextcloudData.annotations }}
annotations:
{{ toYaml .Values.persistence.nextcloudData.annotations | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.nextcloudData.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.nextcloudData.size | quote }}
{{- if .Values.persistence.nextcloudData.storageClass }}
{{- if (eq "-" .Values.persistence.nextcloudData.storageClass) }}
{{- with .Values.persistence.nextcloudData.storageClass }}
{{- if (eq "-" .) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.nextcloudData.storageClass }}"
storageClassName: "{{ . }}"
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
{{- end }}
16 changes: 7 additions & 9 deletions charts/nextcloud/templates/nextcloud-pvc.yaml
@@ -1,5 +1,4 @@
{{- if .Values.persistence.enabled -}}
{{- if not .Values.persistence.existingClaim -}}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand All @@ -10,22 +9,21 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: app
{{- if .Values.persistence.annotations }}
{{- with .Values.persistence.annotations }}
annotations:
{{ toYaml .Values.persistence.annotations | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
{{- with .Values.persistence.storageClass }}
{{- if (eq "-" .) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
storageClassName: "{{ . }}"
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}
{{- end }}
14 changes: 7 additions & 7 deletions charts/nextcloud/templates/secrets.yaml
Expand Up @@ -11,19 +11,19 @@ metadata:
type: Opaque
data:
nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }}
{{- if .Values.nextcloud.password }}
nextcloud-password: {{ .Values.nextcloud.password | b64enc | quote }}
{{- with .Values.nextcloud.password }}
nextcloud-password: {{ . | b64enc | quote }}
{{- else }}
nextcloud-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if .Values.metrics.token }}
nextcloud-token: {{ .Values.metrics.token | b64enc | quote }}
{{- with .Values.metrics.token }}
nextcloud-token: {{ . | b64enc | quote }}
{{- else }}
nextcloud-token: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if .Values.nextcloud.mail.enabled }}
smtp-username: {{ default "" .Values.nextcloud.mail.smtp.name | b64enc | quote }}
smtp-password: {{ default "" .Values.nextcloud.mail.smtp.password | b64enc | quote }}
smtp-host: {{ default "" .Values.nextcloud.mail.smtp.host | b64enc | quote }}
smtp-username: {{ .Values.nextcloud.mail.smtp.name | default "" | b64enc | quote }}
smtp-password: {{ .Values.nextcloud.mail.smtp.password | default "" | b64enc | quote }}
smtp-host: {{ .Values.nextcloud.mail.smtp.host | default "" | b64enc | quote }}
{{- end }}
{{- end }}
12 changes: 6 additions & 6 deletions charts/nextcloud/templates/service.yaml
Expand Up @@ -11,22 +11,22 @@ metadata:
spec:
type: {{ .Values.service.type }}
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerIP }}
loadBalancerIP: {{ default "" .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP | default "" }}
{{- end }}
{{- if .Values.service.ipFamilies }}
{{- with .Values.service.ipFamilies }}
ipFamilies:
{{- toYaml .Values.service.ipFamilies | nindent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ .Values.service.ipFamilyPolicy }}
{{- with .Values.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ . }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.nextcloud.containerPort }}
protocol: TCP
name: http
{{- if eq .Values.service.type "NodePort" }}
nodePort: {{ default "" .Values.service.nodePort}}
nodePort: {{ .Values.service.nodePort | default "" }}
{{- end }}
selector:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
Expand Down
4 changes: 2 additions & 2 deletions charts/nextcloud/templates/serviceaccount.yaml
Expand Up @@ -3,8 +3,8 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.rbac.serviceaccount.name }}
{{- if .Values.rbac.serviceaccount.annotations }}
{{- with .Values.rbac.serviceaccount.annotations }}
annotations:
{{- toYaml .Values.rbac.serviceaccount.annotations | nindent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

0 comments on commit 0ffea21

Please sign in to comment.