Compare commits
2 Commits
869a756e4b
...
d52444b21c
Author | SHA1 | Date | |
---|---|---|---|
|
d52444b21c | ||
|
15806b7ab7 |
@ -6,6 +6,8 @@ type: library
|
|||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
kubeVersion: ">=1.27.0"
|
kubeVersion: ">=1.27.0"
|
||||||
home: git.rre.nu
|
home: git.rre.nu
|
||||||
|
sources:
|
||||||
|
- https://git.rre.nu/jonas/common-helm-lib
|
||||||
maintainers:
|
maintainers:
|
||||||
- name: Jonas Forsberg
|
- name: Jonas Forsberg
|
||||||
email: barregargamel@gmail.com
|
email: barregargamel@gmail.com
|
||||||
|
@ -4,11 +4,18 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
|||||||
{{- define "lib.all" -}}
|
{{- define "lib.all" -}}
|
||||||
{{- include "lib.values.setup" . }}
|
{{- include "lib.values.setup" . }}
|
||||||
{{- if .Values.serviceAccount.create -}}
|
{{- 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 -}}
|
{{- end -}}
|
||||||
{{ include "lib.service" . | nindent 0 }}
|
{{ include "lib.service" . | nindent 0 }}
|
||||||
{{ if eq .Values.controller.type "statefulset" }}
|
{{ include "lib.secrets" . | nindent 0 }}
|
||||||
{{- include "lib.statefulset" . | 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 -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
@ -61,7 +61,9 @@ Create the name of the service account to use
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- 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" -}}
|
{{- define "lib.values.setup" -}}
|
||||||
{{- if .Values.lib -}}
|
{{- if .Values.lib -}}
|
||||||
{{- $defaultValues := deepCopy .Values.lib -}}
|
{{- $defaultValues := deepCopy .Values.lib -}}
|
||||||
@ -70,3 +72,54 @@ Create the name of the service account to use
|
|||||||
{{- $_ := set . "Values" (deepCopy $mergedValues) -}}
|
{{- $_ := set . "Values" (deepCopy $mergedValues) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- 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" . -}}
|
{{- $fullName := include "lib.fullname" . -}}
|
||||||
{{- $svcName := .Values.ingress.service -}}
|
|
||||||
{{- $svcPort := .Values.ingress.servicePort -}}
|
{{- $svcPort := .Values.ingress.servicePort -}}
|
||||||
|
{{- $svcName := .Values.ingress.service -}}
|
||||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||||
@ -17,9 +17,11 @@ apiVersion: extensions/v1beta1
|
|||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ $fullName }}
|
name: {{ $fullName }}
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "lib.labels" . | nindent 4 }}
|
{{- include "lib.labels" . | nindent 4 }}
|
||||||
{{- with .Values.ingress.annotations }}
|
{{- with .Values.ingressingresstservicePort }}
|
||||||
|
{{- $svcName := .Values.ingress.service -}}
|
||||||
annotations:
|
annotations:
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@ -50,11 +52,11 @@ spec:
|
|||||||
backend:
|
backend:
|
||||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||||
service:
|
service:
|
||||||
name: {{ $fullName }}
|
name: {{ $fullName }}-${{ $svcName }}
|
||||||
port:
|
port:
|
||||||
number: {{ $svcPort }}
|
number: {{ $svcPort }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
serviceName: {{ $fullName }}
|
serviceName: {{ $fullName }}-${{ $svcName }}
|
||||||
servicePort: {{ $svcPort }}
|
servicePort: {{ $svcPort }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -50,6 +50,8 @@ spec:
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
env:
|
||||||
|
{{- include "lib.environmentVariables" . | default "{}" | nindent 12 }}
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
|
107
values.yaml
107
values.yaml
@ -1,24 +1,12 @@
|
|||||||
---
|
---
|
||||||
# Namespace to deploy to, if not set it targets default namespace
|
|
||||||
namespace: default
|
namespace: default
|
||||||
|
|
||||||
controller:
|
controller:
|
||||||
# -- enable the controller
|
# -- enable the controller
|
||||||
enabled: true
|
enabled: true
|
||||||
# type of controller
|
# type of controller
|
||||||
# valid options are deployment, statefulset, job
|
# valid options are deployment, statefulset, job
|
||||||
type: deployment
|
type: deployment
|
||||||
annotations: {}
|
|
||||||
labels: {}
|
|
||||||
replicas: 1
|
replicas: 1
|
||||||
podSecurityContext: {}
|
|
||||||
securityContext: {}
|
|
||||||
# capabilities:
|
|
||||||
# drop:
|
|
||||||
# - ALL
|
|
||||||
# readOnlyRootFilesystem: true
|
|
||||||
# runAsNonRoot: true
|
|
||||||
# runAsUser: 1000
|
|
||||||
|
|
||||||
image:
|
image:
|
||||||
repository:
|
repository:
|
||||||
@ -26,29 +14,15 @@ image:
|
|||||||
# Overrides the image tag whose default is the chart appVersion.
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
tag: ""
|
tag: ""
|
||||||
|
|
||||||
imagePullSecrets: []
|
|
||||||
nameOverride: ""
|
|
||||||
fullnameOverride: ""
|
fullnameOverride: ""
|
||||||
|
|
||||||
serviceAccount:
|
|
||||||
# Specifies whether a service account should be created
|
|
||||||
create: true
|
|
||||||
# Automatically mount a ServiceAccount's API credentials?
|
|
||||||
automount: true
|
|
||||||
# Annotations to add to the service account
|
|
||||||
annotations: {}
|
|
||||||
# The name of the service account to use.
|
|
||||||
# If not set and create is true, a name is generated using the fullname template
|
|
||||||
name: ""
|
|
||||||
|
|
||||||
|
|
||||||
service:
|
service:
|
||||||
main:
|
main:
|
||||||
enabled: false
|
enabled: true
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
annotations: {}
|
annotations: {}
|
||||||
labels: {}
|
labels: {}
|
||||||
ports: {}
|
ports:
|
||||||
# http:
|
# http:
|
||||||
# # -- Enables or disables the port
|
# # -- Enables or disables the port
|
||||||
# enabled: false#
|
# enabled: false#
|
||||||
@ -70,27 +44,28 @@ service:
|
|||||||
# # [[ref]](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport)
|
# # [[ref]](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport)
|
||||||
# nodePort:
|
# nodePort:
|
||||||
|
|
||||||
|
|
||||||
ingress:
|
ingress:
|
||||||
main:
|
enabled: false
|
||||||
enabled: false
|
service: main
|
||||||
className: ""
|
#Service to target
|
||||||
annotations: {}
|
servicePort: 80
|
||||||
# kubernetes.io/ingress.class: nginx
|
className: ""
|
||||||
# kubernetes.io/tls-acme: "true"
|
annotations:
|
||||||
service: main
|
{}
|
||||||
servicePort: 80
|
# kubernetes.io/ingress.class: nginx
|
||||||
hosts:
|
# kubernetes.io/tls-acme: "true"
|
||||||
- host: chart-example.local
|
hosts:
|
||||||
paths:
|
- host: chart-example.local
|
||||||
- path: /
|
paths:
|
||||||
pathType: ImplementationSpecific
|
- path: /
|
||||||
tls: []
|
pathType: ImplementationSpecific
|
||||||
# - secretName: chart-example-tls
|
tls: []
|
||||||
# hosts:
|
# - secretName: chart-example-tls
|
||||||
# - chart-example.local
|
# hosts:
|
||||||
|
# - chart-example.local
|
||||||
|
|
||||||
resources: {}
|
resources:
|
||||||
|
{}
|
||||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
# choice for the user. This also increases chances charts run on environments with little
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
@ -109,6 +84,29 @@ autoscaling:
|
|||||||
targetCPUUtilizationPercentage: 80
|
targetCPUUtilizationPercentage: 80
|
||||||
# targetMemoryUtilizationPercentage: 80
|
# targetMemoryUtilizationPercentage: 80
|
||||||
|
|
||||||
|
# Secrets that needs to be created
|
||||||
|
secrets: {}
|
||||||
|
# secrets:
|
||||||
|
# <name>:
|
||||||
|
# type: #default Opaque
|
||||||
|
# annotations: {}
|
||||||
|
# labels: {}
|
||||||
|
# env: false #should template load each key in the seacret as
|
||||||
|
# data:
|
||||||
|
# KEY: VALUE
|
||||||
|
|
||||||
|
# ConfigMaps that needs to be created
|
||||||
|
configs: {}
|
||||||
|
# configs:
|
||||||
|
# <name>:
|
||||||
|
# annotations: {}
|
||||||
|
# labels: {}
|
||||||
|
# env: false #should template load each key in the seacret as
|
||||||
|
# data:
|
||||||
|
# KEY: VALUE
|
||||||
|
|
||||||
|
env: {}
|
||||||
|
|
||||||
# Additional volumes on the output Deployment definition.
|
# Additional volumes on the output Deployment definition.
|
||||||
volumes: []
|
volumes: []
|
||||||
# - name: foo
|
# - name: foo
|
||||||
@ -122,6 +120,21 @@ volumeMounts: []
|
|||||||
# mountPath: "/etc/foo"
|
# mountPath: "/etc/foo"
|
||||||
# readOnly: true
|
# readOnly: true
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# Specifies whether a service account should be created
|
||||||
|
create: true
|
||||||
|
# Automatically mount a ServiceAccount's API credentials?
|
||||||
|
automount: true
|
||||||
|
# Annotations to add to the service account
|
||||||
|
annotations: {}
|
||||||
|
# The name of the service account to use.
|
||||||
|
# If not set and create is true, a name is generated using the fullname template
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
livenessProbe: {}
|
||||||
|
|
||||||
|
readinessProbe: {}
|
||||||
|
|
||||||
nodeSelector: {}
|
nodeSelector: {}
|
||||||
|
|
||||||
tolerations: []
|
tolerations: []
|
||||||
|
Loading…
Reference in New Issue
Block a user