This commit is contained in:
2022-05-12 15:14:17 +02:00
commit 8b6d2727ad
12 changed files with 242 additions and 0 deletions

24
template-app/.helmignore Normal file
View File

@ -0,0 +1,24 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
node_modules/
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

24
template-app/Chart.yaml Normal file
View File

@ -0,0 +1,24 @@
apiVersion: v2
name: template-app
description: Template helm chart for a classical app
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.0.1"

View File

@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.app.name }}
labels:
app: {{ .Values.app.name }}
resources:
requests:
cpu: {{ .Values.container.resources.requests.cpu }}
memory: {{ .Values.container.resources.requests.memory }}
{{ if .Values.container.resources.limits.enabled }}
limits:
cpu: {{ .Values.container.resources.limits.cpu }}
memory: {{ .Values.container.resources.limits.memory }}
{{ end }}
spec:
replicas: {{ .Values.container.replicas }}
selector:
matchLabels:
app: {{ .Values.app.name }}
template:
metadata:
annotations:
rollme: {{ randAlphaNum 5 | quote }}
labels:
app: {{ .Values.app.name }}
spec:
containers:
- name: {{ .Values.app.name }}
image: {{ .Values.container.image }}
ports:
- containerPort: {{ .Values.container.port }}
env:
{{- range $env := .Values.container.env }}
- name: {{ $env.name }}
value: {{ $env.value }}
{{- end}}
imagePullSecrets:
- name: docker-registry-cred

View File

@ -0,0 +1,27 @@
{{ if default false .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt
name: {{ .Values.app.name }}-ingress
namespace: {{ .Release.Namespace }}
spec:
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- backend:
service:
name: {{ .Values.app.name }}-service
port:
number: {{ .Values.container.port }}
path: /
pathType: Prefix
{{ if .Values.ingress.tlsEnabled }}
tls:
- hosts:
- {{ .Values.ingress.host }}
secretName: {{ .Values.app.name }}-cert
{{ end }}
{{ end }}

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.app.name }}-service
spec:
selector:
app: {{ .Values.app.name }}
ports:
- protocol: TCP
port: {{ .Values.container.port }}
targetPort: {{ .Values.container.port }}

22
template-app/values.yaml Normal file
View File

@ -0,0 +1,22 @@
app:
name: "template-app"
version: "0.0.1"
ingress:
enabled: true
tlsEnabled: true
host: "test.mumme-it.de"
container:
replicas: 1
env:
- name: SPRING_PROFILES_ACTIVE
value: prod
port: 8080
image: docker.mumme-it.de/Mumme-IT/template-app
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
enabled: true
cpu: 250m
memory: 256Mi

View File

@ -0,0 +1,24 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
node_modules/
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,6 @@
apiVersion: v2
name: template-postgres
description: Template helm chart for a postgres-database
type: application
version: 0.1.0
appVersion: "0.0.1"

View File

@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.database.name }}
labels:
app: {{ .Values.database.name }}
spec:
replicas: {{ .Values.container.replicas }}
selector:
matchLabels:
app: {{ .Values.database.name }}
template:
metadata:
labels:
app: {{ .Values.database.name }}
spec:
containers:
- name: {{ .Values.database.name }}
image: bitnami/postgresql:latest
ports:
containerPort: 5432
volumeMounts:
- mountPath: /bitnami/postgresql
env:
- name: POSTGRESQL_USERNAME
value: {{ .Values.database.auth.user }}
- name: POSTGRESQL_PASSWORD
value: {{ .Values.database.auth.password }}
- name: POSTGRESQL_DATABASE
value: {{ .Values.database.createdDatabase }}

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Values.database.name }}-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: {{ .Values.database.size }}
accessModes:
- ReadWriteOnce
hostPath:
path: {{ .Values.database.mountPath }}

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.database.name }}-pvc
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.database.size }}

View File

@ -0,0 +1,10 @@
container:
replicas: 1
database:
createdDatabase: postgres
name: template-postgres
mountPath: /mnt/postgres/data
size: 10Gi
auth:
user: postgres
password: super