Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix namespace selector #349

Closed
wants to merge 9 commits into from
Closed
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: 3.5.3
version: 3.5.4
jessebot marked this conversation as resolved.
Show resolved Hide resolved
appVersion: 25.0.4
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
Expand Down
7 changes: 7 additions & 0 deletions charts/nextcloud/templates/metrics-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ metadata:
{{- end }}
spec:
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }}
namespaceSelector:
matchNames:
{{- if .Values.metrics.serviceMonitor.namespace }}
- {{ .Values.metrics.serviceMonitor.namespace | quote }}
{{- else }}
- {{ .Release.Namespace | quote }}
{{- end }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with this whole block, it might need to be moved left two spaces to line up with matchNames.

    matchNames:
    {{- if .Values.metrics.serviceMonitor.namespace }}
    - {{ .Values.metrics.serviceMonitor.namespace | quote }}
    {{- else }}
    - {{ .Release.Namespace | quote }}
    {{- end }}

This would match the way we're doing the gotemplates everywhere else like:

    - port: metrics
      path: "/"
      {{- if .Values.metrics.serviceMonitor.interval }}
      interval: {{ .Values.metrics.serviceMonitor.interval }}
      {{- end }}
      {{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
      scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
      {{- end }}

It's been a long week, @provokateurin can you just confirm I'm making sense here? I don't have time to test the helm chart directly for this specific issue right this second, but I will be tackling metrics probably in another month or two for a work project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @jessebot,
I offset the list by two fewer spaces. At the moment, it seems that it is not uniform across the project. I created another MR to tweak this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this ages ago and now your other PR makes sense :) this was also before I realized you have a bit more freedom when using gotemplating :)

selector:
matchLabels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
Expand Down