77 lines
3.1 KiB
YAML
77 lines
3.1 KiB
YAML
{{- if .Values.ingress.enabled }}
|
|
{{- if .Values.ingress.secrets }}
|
|
{{- range .Values.ingress.secrets }}
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ .name }}
|
|
namespace: {{ $.Release.Namespace }}
|
|
labels: {{- include "common.labels.standard" $ | nindent 4 }}
|
|
{{- if $.Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if $.Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
type: kubernetes.io/tls
|
|
data:
|
|
tls.crt: {{ .certificate | b64enc }}
|
|
tls.key: {{ .key | b64enc }}
|
|
---
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if and .Values.ingress.tls .Values.ingress.selfSigned }}
|
|
{{- $ca := genCA "keycloak-ca" 365 }}
|
|
{{- $cert := genSignedCert .Values.ingress.hostname nil (list .Values.ingress.hostname) 365 $ca }}
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ printf "%s-tls" .Values.ingress.hostname }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
type: kubernetes.io/tls
|
|
data:
|
|
tls.crt: {{ $cert.Cert | b64enc | quote }}
|
|
tls.key: {{ $cert.Key | b64enc | quote }}
|
|
ca.crt: {{ $ca.Cert | b64enc | quote }}
|
|
---
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if (include "keycloak.createTlsSecret" $) }}
|
|
{{- $ca := genCA "keycloak-ca" 365 }}
|
|
{{- $releaseNamespace := .Release.Namespace }}
|
|
{{- $clusterDomain := .Values.clusterDomain }}
|
|
{{- $fullname := include "keycloak.fullname" . }}
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ printf "%s-crt" (include "common.names.fullname" .) }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
app.kubernetes.io/component: keycloak
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
type: Opaque
|
|
data:
|
|
{{- $replicaCount := int .Values.replicaCount }}
|
|
{{- range $i := until $replicaCount }}
|
|
{{- $replicaHost := printf "%s-%d.%s-headless" $fullname $i $fullname }}
|
|
{{- $altNames := list (printf "%s.%s.svc.%s" $replicaHost $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $fullname $releaseNamespace $clusterDomain) (printf "%s.%s" $replicaHost $releaseNamespace) (printf "%s.%s" $fullname $releaseNamespace) $replicaHost $fullname }}
|
|
{{- $crt := genSignedCert $replicaHost nil $altNames 365 $ca }}
|
|
keycloak-{{ $i }}.crt: {{ $crt.Cert | b64enc | quote }}
|
|
keycloak-{{ $i }}.key: {{ $crt.Key | b64enc | quote }}
|
|
{{- end }}
|
|
ca.crt: {{ $ca.Cert | b64enc | quote }}
|
|
{{- end }}
|
|
|