Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(charts/strichlistensystem): add chart, feat(charts/portals): add new env vars #16

Merged
merged 7 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ The portals chart is located in the [`charts/portals`](./charts/portals/) folder

See more about the chart in the [README](./charts/portals/README.md) of the chart.

### Strichlistensystem

The strichlistensystem chart is located in the [`charts/strichlistensystem`](./charts/strichlistensystem/) folder. It contains our [tally system](github.com/fsr5-fhaachen/strichlistensystem).

See more about the chart in the [README](./charts/strichlistensystem/README.md) of the chart.

## Authors

👤 **Simon Ostendorf**
Expand Down
4 changes: 2 additions & 2 deletions charts/portals/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: portals
description: Portals is a group allocation tool for the first week of the Department of Electrical Engineering and Information Technology at the FH Aachen - University of Applied Sciences.
type: application
version: 0.0.3
appVersion: "2.1.0"
version: 0.0.4
appVersion: "2.3.0"
home: github.com/fsr5-fhaachen/portals
maintainers:
- name: fsr5-fhaachen
Expand Down
10 changes: 8 additions & 2 deletions charts/portals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This chart deploys the Portals application to a Kubernetes cluster.
You can install the chart with the following command:

```sh
helm repo add portals https://fsr5-fhaachen.github.io/portals/
helm upgrade --install portals portals/portals --namespace portals --create-namespace -f values.yaml
helm repo add fsr5-fhaachen https://fsr5-fhaachen.github.io/charts/
helm upgrade --install portals fsr5-fhaachen/portals --namespace portals --create-namespace -f values.yaml
```

## Database and Redis
Expand All @@ -32,6 +32,12 @@ environment:
APP_URL: https://portals.fsr5.de
TUTOR_PASSWORD: password # insert secret password here
ADMIN_PASSWORD: admin # insert secret password here
APP_PUBLIC_API_SECRET: secret # insert secret password here
AWS_ACCESS_KEY_ID: secret # insert aws data here
AWS_SECRET_ACCESS_KEY: secret # insert aws data here
AWS_DEFAULT_REGION: eu-central-1 # insert aws region here
AWS_BUCKET: fsr5-fhaachen-portals # insert bucket name here
AWS_USE_PATH_STYLE_ENDPOINT: false
DB_CONNECTION: pgsql
DB_HOST: # insert db host here
DB_PORT: "5432"
Expand Down
2 changes: 1 addition & 1 deletion charts/portals/templates/seed-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
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: hook-succeeded
helm.sh/hook-delete-policy: before-hook-creation
spec:
template:
spec:
Expand Down
6 changes: 6 additions & 0 deletions charts/portals/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ environment:
APP_URL: https://portals.fsr5.de
TUTOR_PASSWORD: password # insert secret password here
ADMIN_PASSWORD: admin # insert secret password here
PUBLIC_API_SECRET: secret # insert secret password here
AWS_ACCESS_KEY_ID: secret # insert aws data here
AWS_SECRET_ACCESS_KEY: secret # insert aws data here
AWS_DEFAULT_REGION: eu-central-1 # insert aws region here
AWS_BUCKET: fsr5-fhaachen-portals # insert bucket name here
AWS_USE_PATH_STYLE_ENDPOINT: false
DB_CONNECTION: pgsql
DB_HOST: # insert db host here
DB_PORT: "5432"
Expand Down
11 changes: 11 additions & 0 deletions charts/strichlistensystem/Chart.yaml
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: [email protected]
url: https://fsr5.de/
58 changes: 58 additions & 0 deletions charts/strichlistensystem/README.md
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
```
13 changes: 13 additions & 0 deletions charts/strichlistensystem/templates/NOTES.txt
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.
51 changes: 51 additions & 0 deletions charts/strichlistensystem/templates/_helpers.tpl
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 }}
59 changes: 59 additions & 0 deletions charts/strichlistensystem/templates/deployment.yaml
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 }}
20 changes: 20 additions & 0 deletions charts/strichlistensystem/templates/hpa.yaml
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 }}
54 changes: 54 additions & 0 deletions charts/strichlistensystem/templates/ingress.yaml
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 }}
33 changes: 33 additions & 0 deletions charts/strichlistensystem/templates/seed-job.yaml
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 }}
14 changes: 14 additions & 0 deletions charts/strichlistensystem/templates/service.yaml
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 }}
Loading
Loading