diff --git a/stable/nextcloud/Chart.yaml b/stable/nextcloud/Chart.yaml index 17323dc3f585..381f9a2411c7 100644 --- a/stable/nextcloud/Chart.yaml +++ b/stable/nextcloud/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: nextcloud -version: 1.11.0 +version: 1.12.0 appVersion: 17.0.0 description: A file sharing server that puts the control and security of your own data back into your hands. keywords: diff --git a/stable/nextcloud/README.md b/stable/nextcloud/README.md index 7b9fdfe64553..c7516d1492f4 100644 --- a/stable/nextcloud/README.md +++ b/stable/nextcloud/README.md @@ -150,6 +150,19 @@ The following table lists the configurable parameters of the nextcloud chart and | `hpa.maxPods` | Max. pods for the Nextcloud HorizontalPodAutoscaler | `10` | | `deploymentAnnotations` | Annotations to be added at 'deployment' level | not set | | `podAnnotations` | Annotations to be added at 'pod' level | not set | +| `metrics.enabled` | Start Prometheus metrics exporter | `false` | +| `metrics.https` | Defines if https is used to connect to nextcloud | `false` (uses http) | +| `metrics.timeout` | When the scrape times out | `5s` | +| `metrics.image.repository` | Nextcloud metrics exporter image name | `xperimental/nextcloud-exporter` | +| `metrics.image.tag` | Nextcloud metrics exporter image tag | `v0.3.0` | +| `metrics.image.pullPolicy` | Nextcloud metrics exporter image pull policy | `IfNotPresent` | +| `metrics.podAnnotations` | Additional annotations for metrics exporter | not set | +| `metrics.podLabels` | Additional labels for metrics exporter | not set | +| `metrics.service.type` | Metrics: Kubernetes Service type | `ClusterIP` | +| `metrics.service.loadBalancerIP` | Metrics: LoadBalancerIp for service type LoadBalancer | `nil` | +| `metrics.service.nodePort` | Metrics: NodePort for service type NodePort | `nil` | +| `metrics.service.annotations` | Additional annotations for service metrics exporter | `{prometheus.io/scrape: "true", prometheus.io/port: "9205"}` | +| `metrics.service.labels` | Additional labels for service metrics exporter | `{}` | > **Note**: > diff --git a/stable/nextcloud/templates/metrics-deployment.yaml b/stable/nextcloud/templates/metrics-deployment.yaml new file mode 100644 index 000000000000..5e6a0c9270ed --- /dev/null +++ b/stable/nextcloud/templates/metrics-deployment.yaml @@ -0,0 +1,54 @@ +{{- if .Values.metrics.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "nextcloud.fullname" . }}-metrics + 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 +spec: + replicas: {{ .Values.metrics.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + 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 }} + spec: + containers: + - name: metrics-exporter + image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}" + imagePullPolicy: {{ .Values.metrics.image.pullPolicy }} + env: + - name: NEXTCLOUD_USERNAME + valueFrom: + secretKeyRef: + name: {{ template "nextcloud.fullname" . }} + key: nextcloud-username + - name: NEXTCLOUD_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "nextcloud.fullname" . }} + key: nextcloud-password + - name: NEXTCLOUD_SERVER + value: http{{ if .Values.metrics.https }}s{{ end }}://{{ .Values.nextcloud.host }} + - name: NEXTCLOUD_TIMEOUT + value: {{ .Values.metrics.timeout }} + ports: + - name: metrics + containerPort: 9205 + {{- if .Values.metrics.resources }} + resources: {{- toYaml .Values.metrics.resources | nindent 10 }} + {{- end }} +{{- end }} diff --git a/stable/nextcloud/templates/metrics-service.yaml b/stable/nextcloud/templates/metrics-service.yaml new file mode 100644 index 000000000000..b349751cf20f --- /dev/null +++ b/stable/nextcloud/templates/metrics-service.yaml @@ -0,0 +1,31 @@ +{{- if .Values.metrics.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "nextcloud.fullname" . }}-metrics + labels: + 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 }} + {{- 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 }} + {{- 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 -}} + ports: + - name: metrics + port: 9205 + targetPort: metrics + selector: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/stable/nextcloud/values.yaml b/stable/nextcloud/values.yaml index 70a360c21b39..1d65695a0758 100644 --- a/stable/nextcloud/values.yaml +++ b/stable/nextcloud/values.yaml @@ -345,3 +345,39 @@ nodeSelector: {} tolerations: [] affinity: {} + + +## Prometheus Exporter / Metrics +## +metrics: + enabled: false + + replicaCount: 1 + # The metrics exporter needs to know how you serve Nextcloud either http or https + https: false + timeout: 5s + + image: + repository: xperimental/nextcloud-exporter + tag: v0.3.0 + pullPolicy: IfNotPresent + + ## Metrics exporter resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + # resources: {} + + ## Metrics exporter pod Annotation and Labels + # podAnnotations: {} + + # podLabels: {} + + service: + type: ClusterIP + ## Use serviceLoadBalancerIP to request a specific static IP, + ## otherwise leave blank + # loadBalancerIP: + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9205" + labels: {}