{{- if .Values.controller.secretClaims -}}
{{- $root := . -}}
{{- $namespace := include "jenkins.namespace" . -}}
{{- $serviceName := include "jenkins.fullname" . -}}
{{ range .Values.controller.secretClaims }}
---
kind: SecretClaim
apiVersion: vaultproject.io/v1
metadata:
  name: {{ $serviceName }}-{{ .name | default .path | lower }}
  namespace: {{ $namespace }}
  labels:
    {{- $baseLabels := include "jenkins.labels" $root | fromYaml }}
    {{- $overrideLabels := dict "app.kubernetes.io/name" $serviceName }}
    {{- toYaml (merge $overrideLabels $baseLabels) | nindent 4 }}
spec:
  type: {{ .type | default "Opaque" }}
  path: {{ .path }}
{{- if .renew }}
  renew: {{ .renew }}
{{- end }}
{{- end }}
{{- end }}
