This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] add helmchart for deploying Kimai on Kubernetes (#198)
* initial commit for Apache/MySQL/Prod * add documentation, remove values which should not be accessible * add paragraph about the Helm chart to the central README.md * refactorings ftom code review * changes from review
- Loading branch information
Showing
13 changed files
with
399 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: kimai-helmchart | ||
description: A Helm chart for Kubernetes | ||
type: application | ||
version: "0.1.0" | ||
appVersion: "0.1.0" |
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,42 @@ | ||
# kimai-helmchart | ||
|
||
In order to allow an easy deployment on Kubernetes, we provide a Helm chart (https://helm.sh). The chart allows a parameterized deployment of Kimai on Kubernetes, using the Docker images also used for the standard docker deployment. This Helm chart only allows the deployment with Apache and MySQL. | ||
|
||
# Chart Documentation | ||
|
||
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square) | ||
|
||
A Helm chart for Kubernetes | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| default.storageClass | string | `nil` | Possibility to override the storage class. If left empty, your default storage class will be used | | ||
| images.mysql.name | string | `"mysql"` | Image name for MySQL | | ||
| images.mysql.tag | string | `"5.7"` | Image tag for MySQL | | ||
| ingress.defaultDomain | string | `"local"` | Default domain for ingress definitions. Can be overridden by the component specific settings | | ||
| ingress.kimai.domain | string | `nil` | Optional possibility to declare a specific domain for Kimai | | ||
| ingress.kimai.hostName | string | `nil` | Host name for Kimai. Defaults to kimai | | ||
| ingress.kimai.tlsSecret | string | `"add-you-own-here"` | Certificate for Kimai | | ||
| kimai.database | object | `{"databaseName":"kimai","kimaiPassword":"kimai","kimaiUser":"kimai"}` | Configuration of the database for Kimai | | ||
| kimai.database.databaseName | string | `"kimai"` | MySQL database name for Kimai | | ||
| kimai.database.kimaiPassword | string | `"kimai"` | MySQL database password for Kimai | | ||
| kimai.database.kimaiUser | string | `"kimai"` | MySQL database user for Kimai | | ||
| kimai.initialization.admin.email | string | `"admin@kimai.local"` | Email for the superadmin account | | ||
| kimai.initialization.admin.password | string | `"changemeplease"` | Password for the superadmin account | | ||
| kimai.nameOverride | string | `nil` | Possibility to override the name of the Kimai component | | ||
| kimai.pvc.var.size | string | `"4Gi"` | Size for the PVC var for Kimai | | ||
| kimai.resources.limits.cpu | string | `"1000m"` | | | ||
| kimai.resources.limits.memory | string | `"512Mi"` | | | ||
| kimai.resources.requests.cpu | string | `"500m"` | | | ||
| kimai.resources.requests.memory | string | `"256Mi"` | | | ||
| kimai.version | string | `"master"` | Kimai version. This is used to determine which tag should be used for Kimai itself. If you change this, ensure, that the corresponding tag already exists at Docker Hub. The tag is formed following the pattern `apache-debian-<kimai.version>-prod`. | | ||
| metadata.applicationName | string | `"kimai"` | Name for the whole application. Used at different places for labels and naming of components. | | ||
| mysql.nameOverride | string | `nil` | Possibility to override the name of the Kimai components | | ||
| mysql.pvc.data.size | string | `"4Gi"` | Size for the PVC data for MySQL | | ||
| mysql.resources.limits.cpu | string | `"2000m"` | | | ||
| mysql.resources.limits.memory | string | `"4096Mi"` | | | ||
| mysql.resources.requests.cpu | string | `"1000m"` | | | ||
| mysql.resources.requests.memory | string | `"512Mi"` | | | ||
| mysql.rootPassword | string | `"changemeplease"` | Password for the MySQL root user | |
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,21 @@ | ||
# kimai-helmchart | ||
|
||
In order to allow an easy deployment on Kubernetes, we provide a Helm chart (https://helm.sh). The chart allows a parameterized deployment of Kimai on Kubernetes, using the Docker images also used for the standard docker deployment. This Helm chart only allows the deployment with Apache and MySQL. | ||
|
||
# Chart Documentation | ||
|
||
{{ template "chart.deprecationWarning" . }} | ||
|
||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} | ||
|
||
{{ template "chart.description" . }} | ||
|
||
{{ template "chart.homepageLine" . }} | ||
|
||
{{ template "chart.maintainersSection" . }} | ||
|
||
{{ template "chart.sourcesSection" . }} | ||
|
||
{{ template "chart.requirementsSection" . }} | ||
|
||
{{ template "chart.valuesSection" . }} |
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,36 @@ | ||
{{/* | ||
Expand the name of the Kimai component. | ||
*/}} | ||
{{- define "kimai.name" -}} | ||
{{- default "kimai" .Values.kimai.nameOverride }} | ||
{{- end }} | ||
|
||
{{/* | ||
Expand the name of the MySQL component. | ||
*/}} | ||
{{- define "mysql.name" -}} | ||
{{- default "mysql" .Values.mysql.nameOverride }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the database URL. For the time being, this supports only an integrated MySQL | ||
*/}} | ||
{{- define "application.databaseUrl" -}} | ||
mysql://{{ .Values.kimai.database.kimaiUser }}:{{ .Values.kimai.database.kimaiPassword }}@additional-{{ include "mysql.name" . }}/{{ .Values.kimai.database.databaseName }} | ||
{{- end }} | ||
|
||
{{/* | ||
Tag name for Kimai image | ||
*/}} | ||
{{- define "kimai.imageTag" -}} | ||
apache-debian-{{ .Values.kimai.version }}-prod | ||
{{- end }} | ||
|
||
|
||
{{- define "kimai-helmchart.ingress.fqdn.kimai" -}} | ||
{{- if .Values.ingress.kimai.domain -}} | ||
{{ default "kimai" .Values.ingress.kimai.name }}.{{ .Values.ingress.kimai.domain }} | ||
{{- else -}} | ||
{{ default "kimai" .Values.ingress.kimai.name }}.{{ .Values.ingress.defaultDomain }} | ||
{{- 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,51 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: additional-{{ include "mysql.name" . }} | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: additional-{{ include "mysql.name" . }} | ||
app.kubernetes.io/component: additional-{{ include "mysql.name" . }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: additional-{{ include "mysql.name" . }} | ||
app.kubernetes.io/component: additional-{{ include "mysql.name" . }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: additional-{{ include "mysql.name" . }} | ||
app.kubernetes.io/component: additional-{{ include "mysql.name" . }} | ||
spec: | ||
containers: | ||
- env: | ||
- name: MYSQL_DATABASE | ||
value: {{ .Values.kimai.database.databaseName }} | ||
- name: MYSQL_USER | ||
value: {{ .Values.kimai.database.kimaiUser }} | ||
- name: MYSQL_PASSWORD | ||
value: {{ .Values.kimai.database.kimaiPassword }} | ||
- name: MYSQL_ROOT_PASSWORD | ||
value: {{ .Values.mysql.rootPassword }}{{ .Values.mysql.foo }} | ||
image: {{ .Values.images.mysql.name }}:{{ .Values.images.mysql.tag }} | ||
name: additional-{{ include "mysql.name" . }} | ||
ports: | ||
- containerPort: 3306 | ||
name: mysql | ||
resources: | ||
requests: | ||
memory: {{ .Values.mysql.resources.requests.memory }} | ||
cpu: {{ .Values.mysql.resources.requests.cpu }} | ||
limits: | ||
memory: {{ .Values.mysql.resources.limits.memory }} | ||
cpu: {{ .Values.mysql.resources.limits.cpu }} | ||
volumeMounts: | ||
- mountPath: /var/lib/mysql | ||
name: mysql-data | ||
volumes: | ||
- name: mysql-data | ||
persistentVolumeClaim: | ||
claimName: additional-{{ include "mysql.name" .}}-data |
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,53 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: core-{{ include "kimai.name" . }} | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: core-{{ include "kimai.name" . }} | ||
app.kubernetes.io/component: core-{{ include "kimai.name" . }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: core-{{ include "kimai.name" . }} | ||
app.kubernetes.io/component: core-{{ include "kimai.name" . }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: core-{{ include "kimai.name" . }} | ||
app.kubernetes.io/component: core-{{ include "kimai.name" . }} | ||
spec: | ||
containers: | ||
- env: | ||
- name: ADMINMAIL | ||
value: {{ .Values.kimai.initialization.admin.email }} | ||
- name: ADMINPASS | ||
value: {{ .Values.kimai.initialization.admin.password }} | ||
- name: APP_ENV | ||
value: {{ .Values.kimai.environment }} | ||
- name: DATABASE_URL | ||
value: {{ include "application.databaseUrl" . }} | ||
- name: TRUSTED_HOSTS | ||
value: localhost,{{ include "kimai-helmchart.ingress.fqdn.kimai" . }} | ||
image: kimai/kimai2:{{ include "kimai.imageTag" . }} | ||
name: core-{{ include "kimai.name" . }} | ||
ports: | ||
- containerPort: 8001 | ||
name: kimai | ||
resources: | ||
requests: | ||
memory: {{ .Values.kimai.resources.requests.memory }} | ||
cpu: {{ .Values.kimai.resources.requests.cpu }} | ||
limits: | ||
memory: {{ .Values.kimai.resources.limits.memory }} | ||
cpu: {{ .Values.kimai.resources.limits.cpu }} | ||
volumeMounts: | ||
- mountPath: /opt/kimai/var | ||
name: kimai-var | ||
volumes: | ||
- name: kimai-var | ||
persistentVolumeClaim: | ||
claimName: core-{{ include "kimai.name" .}}-var |
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,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: core-{{ include "kimai.name" . }} | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: core-{{ include "kimai.name" . }} | ||
spec: | ||
{{ if .Values.ingress.kimai.tlsSecret }} | ||
tls: | ||
- hosts: | ||
- {{ include "kimai-helmchart.ingress.fqdn.kimai" . }} | ||
secretName: {{ .Values.ingress.kimai.tlsSecret }} | ||
{{ end }} | ||
rules: | ||
- host: {{ include "kimai-helmchart.ingress.fqdn.kimai" . }} | ||
http: | ||
paths: | ||
- path: / | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: core-{{ include "kimai.name" . }} | ||
port: | ||
name: kimai-http |
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,16 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: additional-{{ include "mysql.name" .}}-data | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: additional-{{ include "mysql.name" .}}-data | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
{{ if .Values.default.storageClass }} | ||
storageClassName: {{ .Values.default.storageClass }} | ||
{{ end }} | ||
resources: | ||
requests: | ||
storage: {{ .Values.mysql.pvc.data.size }} |
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,16 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: core-{{ include "kimai.name" .}}-var | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: core-{{ include "kimai.name" . }}-var | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
{{ if .Values.default.storageClass }} | ||
storageClassName: {{ .Values.default.storageClass }} | ||
{{ end }} | ||
resources: | ||
requests: | ||
storage: {{ .Values.kimai.pvc.var.size }} |
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,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: additional-{{ include "mysql.name" .}} | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: additional-{{ include "mysql.name" .}} | ||
app.kubernetes.io/component: additional-{{ include "mysql.name" .}} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 3306 | ||
protocol: TCP | ||
targetPort: mysql | ||
name: mysql | ||
selector: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: additional-{{ include "mysql.name" .}} | ||
app.kubernetes.io/component: additional-{{ include "mysql.name" .}} |
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,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: core-{{ include "kimai.name" .}} | ||
labels: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: core-{{ include "kimai.name" .}} | ||
app.kubernetes.io/component: core-{{ include "kimai.name" .}} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 8001 | ||
protocol: TCP | ||
targetPort: kimai-http | ||
name: kimai-http | ||
selector: | ||
app.kubernetes.io/part-of: {{ .Values.metadata.applicationName }} | ||
app.kubernetes.io/name: core-{{ include "kimai.name" .}} | ||
app.kubernetes.io/component: core-{{ include "kimai.name" .}} |
Oops, something went wrong.