feat: add template common.serviceMonitor.secret
This commit is contained in:
27
templates/_servicemonitor-secret.yaml
Normal file
27
templates/_servicemonitor-secret.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{- define "common.serviceMonitor.secret.tpl" -}}
|
||||
{{- $basicAuth := .Values.serviceMonitor.basicAuth | default (dict) -}}
|
||||
metadata:
|
||||
name: {{ $basicAuth.secretName | default (include "common.fullname" .) }}
|
||||
{{- with .Values.serviceMonitor.namespace }}
|
||||
namespace: {{ . }}
|
||||
{{- end }}
|
||||
{{- if $basicAuth.enabled }}
|
||||
data:
|
||||
{{ $basicAuth.usernameKey | default "username" }}: {{ $basicAuth.username | toString | b64enc | quote }}
|
||||
{{ $basicAuth.passwordKey | default "password" }}: {{ $basicAuth.password | toString | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "common.serviceMonitor.secret.if" -}}
|
||||
{{- $top := first . -}}
|
||||
{{- $serviceMonitor := $top.Values.serviceMonitor | default (dict) -}}
|
||||
{{- if $serviceMonitor.enabled -}}
|
||||
{{- include "common.secret" (append . "common.serviceMonitor.secret.tpl") -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "common.serviceMonitor.secret" -}}
|
||||
{{- include "common.utils.flattenCall" (list "common.serviceMonitor.secret.if" .) -}}
|
||||
{{- end -}}
|
Reference in New Issue
Block a user