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 for additional labels for falco-exporter servicemonitor #64

Closed
rcompos opened this issue Jul 30, 2020 · 2 comments · Fixed by #65
Closed

Fix for additional labels for falco-exporter servicemonitor #64

rcompos opened this issue Jul 30, 2020 · 2 comments · Fixed by #65
Labels
area/falco-chart kind/bug Something isn't working

Comments

@rcompos
Copy link

rcompos commented Jul 30, 2020

Describe the bug

When deploying falco-exporter Helm chart with servicemonitor.additionallabels in values.yaml, the chart fails unless the value is a string, in which case the label is not created.

How to reproduce it

Edit values.yaml and add some servicemonitor additionallabels as map value(s).

serviceMonitor:
  # Enable the deployment of a Service Monitor for the Prometheus Operator.
  enabled: true
  additionalLabels:
    release: prom
⇒ helm upgrade --install falco-exporter . -f values.yaml -n falco
Error: UPGRADE FAILED: YAML parse error on falco-exporter/templates/servicemonitor.yaml: error converting YAML to JSON: yaml: line 10: mapping values are not allowed in this context

Expected behaviour

The additionallables should be created in the servicemonitor. In this case "release: prom".

⇒ kctl -n falco get servicemonitors falco-exporter -o yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
...
  labels:
  ...
    release: prom
  ...

Screenshots

N/A

Environment

  • Falco version:
    Falco version: 0.24.0
    Driver version: 85c88952b018fdbce2464222c3303229f5bfcfad

  • System info:

  • Cloud provider or hardware configuration:
    GCP GKE Kubernetes v1.16.12

  • OS:
    "machine": "x86_64",
    "nodename": "gke-yolo-infra-dev-default-node-pool-4754cdf8-1s69",
    "release": "4.19.112+",
    "sysname": "Linux",
    "version": "Pull falco chart from helm/charts #1 SMP Thu May 21 12:32:38 PDT 2020"

  • Installation method:
    Helm chart

Additional context

Here is the fix:

File: falco-exporter/templates/servicemonitor.yaml
see lines 8-10 under metadata.labels.

{{ if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ include "falco-exporter.fullname" . }}
  labels:
    {{- include "falco-exporter.labels" . | nindent 4 }}
    {{- range $key, $value := .Values.serviceMonitor.additionalLabels }}
    {{ $key }}: {{ $value | quote }}
    {{- end }}
  namespace: {{ .Release.Namespace }}
spec:
  endpoints:
  - port: metrics
    {{- if .Values.serviceMonitor.interval }}
    interval: {{ .Values.serviceMonitor.interval }}
    {{- end }}
    {{- if .Values.serviceMonitor.scrapeTimeout }}
    scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
    {{- end }}
  selector:
    matchLabels:
      {{- include "falco-exporter.selectorLabels" . | nindent 6 }}
{{- end }}
@rcompos rcompos added the kind/bug Something isn't working label Jul 30, 2020
@rcompos rcompos changed the title Fix for additional labels for falco-exporter helm templates Fix for additional labels for falco-exporter servicemonitor Jul 30, 2020
@leogr
Copy link
Member

leogr commented Jul 31, 2020

Hi @rcompos

Good catch!

Could you open a PR to fix it?

@rcompos
Copy link
Author

rcompos commented Aug 3, 2020

I tried to open a PR but I don't have the privileges. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/falco-chart kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants