-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(charts/strichlistensystem): add chart, feat(charts/portals): add…
… new env vars (#16) * feat(charts/strichlistensystem): add chart * feat(charts/strichlistensystem): add new env vars and seeder * feat(charts/portals): add new env vars, bump chart version * fix(charts): spaces before comments * fix(charts): helm hook policy * fix(charts): env var names * feat(charts/strichlistensystem): add APP_PUBLIC_URL env var
- Loading branch information
1 parent
5b8729a
commit 932e5c7
Showing
15 changed files
with
422 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v2 | ||
name: strichlistensystem | ||
description: Tally system for the first week of the Department of Electrical Engineering and Information Technology at FH Aachen - University of Applied Sciences. | ||
type: application | ||
version: 0.0.1 | ||
appVersion: "2.0.0" | ||
home: github.com/fsr5-fhaachen/strichlistensystem | ||
maintainers: | ||
- name: fsr5-fhaachen | ||
email: fsr-fb5@fh-aachen.de | ||
url: https://fsr5.de/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Strichlistensystem Helm Chart | ||
|
||
This chart deploys the Strichlistensystem application to a Kubernetes cluster. | ||
|
||
## Install | ||
|
||
You can install the chart with the following command: | ||
|
||
```sh | ||
helm repo add fsr5-fhaachen https://fsr5-fhaachen.github.io/charts/ | ||
helm upgrade --install strichlistensystem fsr5-fhaachen/strichlistensystem --namespace strichlistensystem --create-namespace -f values.yaml | ||
``` | ||
|
||
## Database and Redis | ||
|
||
The chart does not install a database or redis. You have to install them yourself. | ||
|
||
You could use the [postgresql operator](https://cloudnative-pg.io/) and [redis operator](https://ot-container-kit.github.io/redis-operator/) for kubernetes. | ||
|
||
If you want a deployment example, view [our deployment guide](https://github.com/fsr5-fhaachen/portals/blob/main/deploy/README.md) inside the portals repo. (This guide is written for portals but can be adapted for the strichlistensystem because they are both laravel applications installed via helm.) | ||
|
||
## Values | ||
|
||
You can find the default values in the [values.yaml](values.yaml) file. | ||
|
||
You can override the default values but there are some values that need to be changed. The (minimum) required values are: | ||
|
||
```yaml | ||
environment: | ||
APP_NAME: Gerolstein FB5 | ||
APP_KEY: # insert app key here | ||
APP_URL: https://strichlistensystem.fsr5.de | ||
CSV_EXPORT_PW: password # insert secret password here | ||
APP_IS_VPN: false # set to true if app is behind vpn and the general overview should be loaded | ||
APP_PORTALS_URL: https://portals.fsr5.de # insert portals url here | ||
APP_PORTALS_API_SECRET: secret # insert secret password from portals here | ||
APP_PORTALS_IMPORT_PW: 123 # insert secret password here | ||
TELEGRAM_BOT_TOKEN: "" | ||
TELEGRAM_BOT_INFO_CHANNEL_ID: "" | ||
TELEGRAM_BOT_WARNING_CHANNEL_ID: "" | ||
DB_CONNECTION: pgsql | ||
DB_HOST: # insert db host here | ||
DB_PORT: "5432" | ||
DB_DATABASE: postgres | ||
DB_USERNAME: postgres | ||
DB_PASSWORD: # insert db password here | ||
REDIS_HOST: # insert redis host here | ||
REDIS_PASSWORD: # insert redis password here | ||
REDIS_PORT: "6379" | ||
ingress: | ||
enabled: true | ||
className: "nginx" | ||
annotations: | ||
cert-manager.io/issuer: "letsencrypt-prod" | ||
hosts: | ||
- strichlistensystem.fsr5.de | ||
tls: true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Thank you for installing {{ .Chart.Name }}. | ||
|
||
Your release is named {{ .Release.Name }}. | ||
|
||
{{- if .Values.ingress.enabled }} | ||
You can access your site on your configured domain by visiting {{ index .Values.ingress.hosts 0 }}. | ||
{{- else }} | ||
You can access your site by port-forwarding to the service: "kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "strichlistensystem.fullname" . }} 8000:8000" | ||
{{- end }} | ||
|
||
|
||
|
||
Learn more about our "strichlistensystem" at https://github.com/fsr5-fhaachen/strichlistensystem. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "strichlistensystem.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 "strichlistensystem.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 "strichlistensystem.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "strichlistensystem.labels" -}} | ||
helm.sh/chart: {{ include "strichlistensystem.chart" . }} | ||
{{ include "strichlistensystem.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "strichlistensystem.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "strichlistensystem.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "strichlistensystem.fullname" . }} | ||
labels: | ||
{{- include "strichlistensystem.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "strichlistensystem.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "strichlistensystem.selectorLabels" . | nindent 8 }} | ||
spec: | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: 8000 | ||
protocol: TCP | ||
{{- if not .Values.disableLivenessProbe }} | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
{{- end }} | ||
{{- if not .Values.disableReadinessProbe }} | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
{{- end }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
env: | ||
{{- range $key, $value := .Values.environment }} | ||
- name: {{ $key }} | ||
value: {{ $value | quote }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- if .Values.hpa.enabled }} | ||
apiVersion: autoscaling/v2 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: {{ include "strichlistensystem.fullname" . }} | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: {{ include "strichlistensystem.fullname" . }} | ||
minReplicas: {{ .Values.hpa.minReplicas }} | ||
maxReplicas: {{ .Values.hpa.maxReplicas }} | ||
metrics: | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
target: | ||
type: Utilization | ||
averageUtilization: {{ .Values.hpa.averageCPUUtilization }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "strichlistensystem.fullname" . -}} | ||
{{- 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}} | ||
{{- end }} | ||
{{- end }} | ||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1 | ||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1beta1 | ||
{{- else -}} | ||
apiVersion: extensions/v1beta1 | ||
{{- end }} | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "strichlistensystem.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} | ||
ingressClassName: {{ .Values.ingress.className }} | ||
{{- end }} | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
- hosts: | ||
{{- range .Values.ingress.hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ $fullName }}-ingress-tls | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ . | quote }} | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: 8000 | ||
{{- else }} | ||
serviceName: {{ $fullName }} | ||
servicePort: 8000 | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{{- if or .Values.migrateJob.onInstall .Values.migrateJob.onUpgrade -}} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ include "strichlistensystem.fullname" . }}-migrate-job | ||
labels: | ||
{{- include "strichlistensystem.labels" . | nindent 4 }} | ||
annotations: | ||
helm.sh/hook: {{ if .Values.migrateJob.onInstall }}pre-install{{ end }}{{ if and .Values.migrateJob.onInstall .Values.migrateJob.onUpgrade }},{{ end }}{{ if .Values.migrateJob.onUpgrade }}pre-upgrade{{ end }} | ||
helm.sh/hook-weight: "1" | ||
helm.sh/hook-delete-policy: before-hook-creation | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
env: | ||
{{- range $key, $value := .Values.environment }} | ||
- name: {{ $key }} | ||
value: {{ $value | quote }} | ||
{{- end }} | ||
{{- if .Values.migrateJob.seed }} | ||
command: ["php", "artisan", "migrate:fresh", "--seed", "--no-interaction", "--force", "--seeder=ArticleSeeder"] | ||
{{- else }} | ||
command: ["php", "artisan", "migrate", "--no-interaction", "--force"] | ||
{{- end }} | ||
restartPolicy: Never | ||
backoffLimit: 1 | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "strichlistensystem.fullname" . }} | ||
labels: | ||
{{- include "strichlistensystem.labels" . | nindent 4 }} | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8000 | ||
targetPort: http | ||
protocol: TCP | ||
selector: | ||
{{- include "strichlistensystem.selectorLabels" . | nindent 4 }} |
Oops, something went wrong.