added praktikum chart

This commit is contained in:
titver968
2025-04-23 10:38:17 +02:00
parent 67dc9041ca
commit e13da21e75
8 changed files with 324 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
apiVersion: v2
name: praktikum
description: A Helm chart for Kubernetes
type: application
version: "0.0.1"
appVersion: "0.0.1"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "praktikum.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "praktikum.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "praktikum.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "praktikum.labels" -}}
helm.sh/chart: {{ include "praktikum.chart" . }}
{{ include "praktikum.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "praktikum.selectorLabels" -}}
app.kubernetes.io/name: {{ include "praktikum.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "praktikum.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "praktikum.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,78 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "praktikum.fullname" . }}
labels:
app: {{ template "praktikum.name" . }}
chart: {{ template "praktikum.chart" . }}
component: praktikum
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.deploymentLabels }}
{{- toYaml .Values.deploymentLabels | nindent 4 }}
{{- end }}
spec:
strategy:
{{ toYaml .Values.updateStrategy | nindent 4 }}
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "praktikum.name" . }}
component: praktikum
release: {{ .Release.Name }}
template:
metadata:
annotations:
labels:
app: {{ template "praktikum.name" . }}
component: praktikum
release: {{ .Release.Name }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
serviceAccountName: {{ template "praktikum.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
terminationMessagePolicy: FallbackToLogsOnError
ports:
- name: http
containerPort: {{ .Values.service.port }}
env:
{{- range $key := .Values.env }}
{{- if .value }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
{{- end }}
{{- range $key := .Values.secretEnv }}
- name: {{ .name }}
valueFrom:
secretKeyRef:
name: {{ template "praktikum.fullname" $ }}-secret
key: {{ .name }}
{{- end }}
envFrom:
{{- with .Values.extraEnvFrom }}
{{- tpl . $ | nindent 10 }}
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}

View File

@@ -0,0 +1,18 @@
{{- if .Values.autoscaling.enabled -}}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "praktikum.fullname" . }}
labels:
app: {{ template "praktikum.name" . }}
chart: {{ template "praktikum.chart" . }}
component: praktikum
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "praktikum.fullname" . }}
{{ toYaml .Values.autoscaling.config | indent 2 }}
{{- end -}}

View File

@@ -0,0 +1,45 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "praktikum.fullname" . -}}
{{- $servicePort := .Values.service.port -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $ingressPathType := .Values.ingress.pathtype -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app: {{ template "praktikum.name" . }}
chart: {{ template "praktikum.chart" . }}
component: praktikum
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
pathType: {{ $ingressPathType }}
backend:
service:
name: {{ $fullName }}
port:
number: 3000
{{- end }}
{{- end }}

View File

@@ -0,0 +1,26 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
name: {{ template "praktikum.fullname" . }}
labels:
app: {{ template "praktikum.name" . }}
chart: {{ template "praktikum.chart" . }}
component: praktikum
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 3000
protocol: TCP
name: npm
selector:
app: {{ template "praktikum.name" . }}
component: praktikum
release: {{ .Release.Name }}

View File

@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "praktikum.serviceAccountName" . }}
labels:
{{- include "praktikum.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}

View File

@@ -0,0 +1,76 @@
platform: kubernetes
serviceAccount:
create: true
name: ""
annotations: ""
automount: false
image:
repository: gitea.innovation-hub-niedersachsen.de/innohub/praktikum
tag: v0.3.1
pullPolicy: IfNotPresent
insecure: true
replicaCount: 1
service:
type: ClusterIP
port: 3000
annotations: {}
endpoint: praktikum.local
ingress:
enabled: false
annotations: {}
path: /
pathtype: ImplementationSpecific
hosts:
- praktikum.innohub.local
tls:
route:
enabled: false
resources:
requests:
memory: 128Mi
cpu: 300m
limits:
memory: 1Gi
cpu: 500m
nodeSelector: {}
tolerations: []
affinity: {}
autoscaling:
enabled: true
config:
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 80
deploymentLabels: {}
podLabels: {}
sharedDataFolder:
enabled: true
path: /daten
accessMode: ReadWriteOnce
storageClass:
resources:
requests:
storage: 5Gi
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
podSecurityContext: {}
securityContext: {}
extraDeploy: []