Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
feat(helm): add extra labels for servicemonitor and ingress (#512)
Browse files Browse the repository at this point in the history
* add extra labels for servicemonitor and ingress

* set default servicemonitor labels

---------

Co-authored-by: rla <rla@n-side.com>
  • Loading branch information
raoudhalagha and rla authored Oct 1, 2023
1 parent 5d94285 commit 8041165
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
28 changes: 28 additions & 0 deletions charts/kubeclarity/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,31 @@ Sets extra Kubeclarity server Service annotations
{{- end }}
{{- end }}
{{- end -}}

{{/*
Sets extra labels for service monitor
*/}}
{{- define "kubeclarity.prometheus.serviceMonitor.labels" -}}
{{- if .Values.kubeclarity.prometheus.serviceMonitor.labels }}
{{- $tp := typeOf .Values.kubeclarity.prometheus.serviceMonitor.labels }}
{{- if eq $tp "string" }}
{{- tpl .Values.kubeclarity.prometheus.serviceMonitor.labels . | nindent 4 }}
{{- else }}
{{- toYaml .Values.kubeclarity.prometheus.serviceMonitor.labels | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}

{{/*
Sets extra ingress labels
*/}}
{{- define "kubeclarity.ingress.labels" -}}
{{- if .Values.kubeclarity.ingress.labels }}
{{- $tp := typeOf .Values.kubeclarity.ingress.labels }}
{{- if eq $tp "string" }}
{{- tpl .Values.kubeclarity.ingress.labels . | nindent 4 }}
{{- else }}
{{- toYaml .Values.kubeclarity.ingress.labels | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}
1 change: 1 addition & 0 deletions charts/kubeclarity/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ metadata:
namespace: '{{ .Release.Namespace }}'
labels:
{{- include "kubeclarity.labels" . | nindent 4 }}
{{- template "kubeclarity.ingress.labels" . }}
{{- template "kubeclarity.ingress.annotations" . }}
spec:
{{- if .Values.kubeclarity.ingress.tls }}
Expand Down
3 changes: 2 additions & 1 deletion charts/kubeclarity/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "kubeclarity.labels" . | nindent 4 }}
{{- include "kubeclarity.labels" . | nindent 4 }}
{{- template "kubeclarity.prometheus.serviceMonitor.labels" . }}
spec:
selector:
matchLabels:
Expand Down
1 change: 1 addition & 0 deletions charts/kubeclarity/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ kubeclarity:
enabled: false
interval: 30s
annotations: {}
labels: {}
refreshIntervalSeconds: 300

podAnnotations: {}
Expand Down

0 comments on commit 8041165

Please sign in to comment.