feat(common): Release common v4.1.0 (#416)

This commit is contained in:
Bernd Schorgers 2025-06-11 16:09:46 +02:00 committed by GitHub
parent f3660654f4
commit db552e2dee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 705 additions and 129 deletions

View file

@ -9,6 +9,19 @@
($serviceMonitorObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
{{ $service := dict -}}
{{ $serviceName := "" -}}
{{ if $serviceMonitorObject.serviceName -}}
{{ $serviceName = tpl $serviceMonitorObject.serviceName $rootContext -}}
{{ else if not (empty (dig "service" "name" nil $serviceMonitorObject)) -}}
{{ $serviceName = tpl $serviceMonitorObject.service.name $rootContext -}}
{{ else if not (empty (dig "service" "identifier" nil $serviceMonitorObject)) -}}
{{ $service = (include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" $serviceMonitorObject.service.identifier) | fromYaml ) -}}
{{ if not $service -}}
{{fail (printf "No enabled Service found with this identifier. (serviceMonitor: '%s', identifier: '%s')" $serviceMonitorObject.identifier $serviceMonitorObject.service.identifier)}}
{{ end -}}
{{ $serviceName = $service.name -}}
{{ end -}}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
@ -37,7 +50,7 @@ spec:
{{- tpl ($serviceMonitorObject.selector | toYaml) $rootContext | nindent 4}}
{{- else }}
matchLabels:
app.kubernetes.io/service: {{ tpl $serviceMonitorObject.serviceName $rootContext }}
app.kubernetes.io/service: {{ $serviceName }}
{{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
{{- end }}
endpoints: {{- tpl (toYaml $serviceMonitorObject.endpoints) $rootContext | nindent 4 }}

View file

@ -47,7 +47,15 @@ spec:
matchLabels:
app.kubernetes.io/controller: {{ $statefulsetObject.identifier }}
{{- include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | nindent 6 }}
serviceName: {{ include "bjw-s.common.lib.chart.names.fullname" $rootContext }}
{{- $serviceName := include "bjw-s.common.lib.chart.names.fullname" $rootContext }}
{{- with (dig "statefulset" "serviceName" nil $statefulsetObject) }}
{{- if kindIs "map" . }}
{{- $serviceName = (include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" .identifier) | fromYaml ).name }}
{{- else }}
{{- $serviceName = tpl . $rootContext }}
{{- end }}
{{- end }}
serviceName: {{ $serviceName }}
{{- with (dig "statefulset" "persistentVolumeClaimRetentionPolicy" nil $statefulsetObject) }}
persistentVolumeClaimRetentionPolicy: {{ . | toYaml | nindent 4 }}
{{- end }}