Skip to content

Commit

Permalink
👷 Added Helm-Chart
Browse files Browse the repository at this point in the history
  • Loading branch information
LNA-DEV committed Nov 23, 2024
1 parent d773a61 commit 565c2f6
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 82 deletions.
23 changes: 23 additions & 0 deletions helm/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: fi-vorbereitung
description: A Helm chart for Kubernetes
type: application
version: 0.0.1
appVersion: 0.0.1
27 changes: 27 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fi-pv-deployment
namespace: {{ .Values.namespace }}
spec:
selector:
matchLabels:
app: fi-pv
template:
metadata:
labels:
app: fi-pv
spec:
containers:
- name: fi-pv
image: lnadev/fi-pv:{{ .Values.runNumber }}
imagePullPolicy: Always
resources:
requests:
memory: "128Mi"
cpu: "50m"
limits:
memory: "128Mi"
ports:
- containerPort: 80
name: port-http
Original file line number Diff line number Diff line change
@@ -1,58 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fi-pv-deployment
spec:
selector:
matchLabels:
app: fi-pv
template:
metadata:
labels:
app: fi-pv
spec:
containers:
- name: fi-pv
image: lnadev/fi-pv:{{RUN_NUMBER}}
imagePullPolicy: Always
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80
name: port-http

---
apiVersion: v1
kind: Service
metadata:
name: fi-pv-service
spec:
selector:
app: fi-pv
ports:
- port: 80
targetPort: port-http
name: http

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: fi-pv-ingress
namespace: {{ .Values.namespace }}
annotations:
cert-manager.io/cluster-issuer: letsencrypt
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: default-redirectscheme@kubernetescrd
spec:
tls:
- hosts:
- "fachinformatikerpruefungsvorbereitung.de"
- "www.fachinformatikerpruefungsvorbereitung.de"
- "{{ .Values.domain }}"
- "www.{{ .Values.domain }}"
secretName: fi-pv-cert
rules:
- host: fachinformatikerpruefungsvorbereitung.de
- host: "{{ .Values.domain }}"
http:
paths:
- path: /
Expand All @@ -62,7 +24,7 @@ spec:
name: fi-pv-service
port:
number: 80
- host: www.fachinformatikerpruefungsvorbereitung.de
- host: www.{{ .Values.domain }}
http:
paths:
- path: /
Expand All @@ -74,22 +36,18 @@ spec:
number: 80

---
# Needed because of HTTP to HTTPS redirecting
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: fi-pv-redirection-ingress
name: fi-pv-ingress-http
namespace: {{ .Values.namespace }}
annotations:
cert-manager.io/cluster-issuer: letsencrypt
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: default-redirectschemefipv@kubernetescrd
traefik.ingress.kubernetes.io/router.entrypoints: web
traefik.ingress.kubernetes.io/router.middlewares: default-redirectscheme@kubernetescrd
spec:
tls:
- hosts:
- "xn--fachinformatiker-prfungsvorbereitung-w0d.de"
- "fi.lna-dev.net"
secretName: fi-pv-cert-fipv
rules:
- host: xn--fachinformatiker-prfungsvorbereitung-w0d.de
- host: "{{ .Values.domain }}"
http:
paths:
- path: /
Expand All @@ -99,7 +57,7 @@ spec:
name: fi-pv-service
port:
number: 80
- host: fi.lna-dev.net
- host: www.{{ .Values.domain }}
http:
paths:
- path: /
Expand All @@ -110,15 +68,49 @@ spec:
port:
number: 80

---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirectscheme
namespace: {{ .Values.namespace }}
spec:
redirectRegex:
regex: '^https?://(?:www\.)?(.+)'
replacement: "https://${1}"
permanent: true

---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirectschemefipv
namespace: {{ .Values.namespace }}
spec:
redirectRegex:
regex: '.*'
replacement: "https://{{ .Values.domain }}"
permanent: true



{{- if .Values.production }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: fi-pv-redirection-ingress-http
name: fi-pv-redirection-ingress
namespace: {{ .Values.namespace }}
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
cert-manager.io/cluster-issuer: letsencrypt
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.middlewares: default-redirectschemefipv@kubernetescrd
spec:
tls:
- hosts:
- "xn--fachinformatiker-prfungsvorbereitung-w0d.de"
- "fi.lna-dev.net"
secretName: fi-pv-cert-fipv
rules:
- host: xn--fachinformatiker-prfungsvorbereitung-w0d.de
http:
Expand All @@ -142,17 +134,17 @@ spec:
number: 80

---
# Needed because of HTTP to HTTPS redirecting
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: fi-pv-ingress-http
name: fi-pv-redirection-ingress-http
namespace: {{ .Values.namespace }}
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
traefik.ingress.kubernetes.io/router.middlewares: default-redirectscheme@kubernetescrd
traefik.ingress.kubernetes.io/router.middlewares: default-redirectschemefipv@kubernetescrd
spec:
rules:
- host: fachinformatikerpruefungsvorbereitung.de
- host: xn--fachinformatiker-prfungsvorbereitung-w0d.de
http:
paths:
- path: /
Expand All @@ -162,7 +154,7 @@ spec:
name: fi-pv-service
port:
number: 80
- host: www.fachinformatikerpruefungsvorbereitung.de
- host: fi.lna-dev.net
http:
paths:
- path: /
Expand All @@ -173,24 +165,4 @@ spec:
port:
number: 80

---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirectscheme
spec:
redirectRegex:
regex: '^https?://(?:www\.)?(.+)'
replacement: "https://${1}"
permanent: true

---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: redirectschemefipv
spec:
redirectRegex:
regex: '.*'
replacement: "https://fachinformatikerpruefungsvorbereitung.de"
permanent: true
{{- end }}
4 changes: 4 additions & 0 deletions helm/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.namespace }}
12 changes: 12 additions & 0 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: fi-pv-service
namespace: {{ .Values.namespace }}
spec:
selector:
app: fi-pv
ports:
- port: 80
targetPort: port-http
name: http
4 changes: 4 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
runNumber: 0
domain: fachinformatikerpruefungsvorbereitung.de
namespace: fi-pv
production: true

0 comments on commit 565c2f6

Please sign in to comment.