secrets/configmaps added
This commit is contained in:
@@ -4,11 +4,18 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
||||
{{- define "lib.all" -}}
|
||||
{{- include "lib.values.setup" . }}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{- include "lib.serviceaccount" . | nindent 0 }}
|
||||
{{- include "lib.serviceaccount" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- include "lib.ingress" . | nindent 0}}
|
||||
{{- end -}}
|
||||
{{ include "lib.service" . | nindent 0 }}
|
||||
{{ if eq .Values.controller.type "statefulset" }}
|
||||
{{- include "lib.statefulset" . | nindent 0}}
|
||||
{{ include "lib.secrets" . | nindent 0 }}
|
||||
{{ include "lib.configs" . | nindent 0 }}
|
||||
{{ if .Values.controller.enabled }}
|
||||
{{ if eq .Values.controller.type "statefulset" }}
|
||||
{{- include "lib.statefulset" . | nindent 0}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
@@ -61,7 +61,9 @@ Create the name of the service account to use
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Merge the local chart values and the library chart defaults */}}
|
||||
{{/*
|
||||
Merge the local chart values and the library chart defaults
|
||||
*/}}
|
||||
{{- define "lib.values.setup" -}}
|
||||
{{- if .Values.lib -}}
|
||||
{{- $defaultValues := deepCopy .Values.lib -}}
|
||||
@@ -70,3 +72,54 @@ Create the name of the service account to use
|
||||
{{- $_ := set . "Values" (deepCopy $mergedValues) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get all environment variables and
|
||||
secrets that should be mounted as environment variables
|
||||
*/}}
|
||||
{{- define "lib.environmentVariables" -}}
|
||||
{{- $envIncluded := "false" -}}
|
||||
{{- $fullName := include "lib.fullname" . -}}
|
||||
{{- range $name, $settings := .Values.secrets -}}
|
||||
{{- if $settings.enabled -}}
|
||||
{{- if $settings.env -}}
|
||||
{{- $envIncluded := "true" -}}
|
||||
{{- range $key, $value := $settings.data }}
|
||||
- name: {{ $key }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $fullName }}-{{ $name }}
|
||||
key: {{ $key }}
|
||||
{{- end -}}
|
||||
{{- range $key, $value := $settings.stringData }}
|
||||
- name: {{ $key }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $fullName }}-{{ $name }}
|
||||
key: {{ $key }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- range $name, $settings := .Values.configs -}}
|
||||
{{- if $settings.enabled -}}
|
||||
{{- if $settings.env -}}
|
||||
{{- $envIncluded := "true" -}}
|
||||
{{- range $key, $value := $settings.data }}
|
||||
- name: {{ $key }}
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: {{ $fullName }}-{{ $name }}
|
||||
key: {{ $key }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $envIncluded = "true" -}}
|
||||
{{- if .Values.env -}}
|
||||
{{- toYaml .Values.env | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- toYaml .Values.env | nindent 0 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@@ -1,7 +1,7 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{ define "lib.ingress" }}
|
||||
{{- $fullName := include "lib.fullname" . -}}
|
||||
{{- $svcName := .Values.ingress.service -}}
|
||||
{{- $svcPort := .Values.ingress.servicePort -}}
|
||||
{{- $svcName := .Values.ingress.service -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
@@ -17,9 +17,11 @@ apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "lib.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
{{- with .Values.ingressingresstservicePort }}
|
||||
{{- $svcName := .Values.ingress.service -}}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -50,11 +52,11 @@ spec:
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
name: {{ $fullName }}-${{ $svcName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
serviceName: {{ $fullName }}-${{ $svcName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@@ -50,6 +50,8 @@ spec:
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- include "lib.environmentVariables" . | default "{}" | nindent 12 }}
|
||||
livenessProbe:
|
||||
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
||||
readinessProbe:
|
||||
|
Reference in New Issue
Block a user