Compare commits

..

2 Commits

Author SHA1 Message Date
kolaente bf50b61398
fix: update dependencies before packaging
continuous-integration/drone/pr Build is passing Details
2023-03-10 22:27:37 +01:00
kolaente b475c64b41
feat: add ci config
continuous-integration/drone/pr Build is failing Details
2023-03-10 18:39:18 +01:00
27 changed files with 982 additions and 450 deletions

View File

@ -42,10 +42,9 @@ steps:
commands:
- helm dependency update
- helm package .
- echo $${HELM_PASSWORD} | helm registry login -u frederick --password-stdin kolaente.dev/vikunja
- helm push vikunja-*.tgz oci://kolaente.dev/vikunja
- curl --user "frederick:$HELM_PASSWORD" -X POST --upload-file './<archive>.tgz' https://kolaente.dev/api/packages/vikunja/helm/api/charts
---
kind: signature
hmac: 0f07e164aa169160b10e2813884d8de17a207ac10d4b3f03026e0a9a175acb83
hmac: 6255e5bec10e3e6eeaf92a8b523e04e03a191c13822b829d3361a861c9845fce
...

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
charts/*.tgz
*.tgz
output.yaml

View File

@ -1,12 +1,9 @@
dependencies:
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 17.11.6
version: 17.5.1
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.1.9
- name: common
repository: https://bjw-s.github.io/helm-charts
version: 1.5.1
digest: sha256:efadd6fed4908e6062d0d227177d5d650e5fe5b9c94f1cc99feb33ce3a1d0916
generated: "2023-10-05T14:21:22.588364801-07:00"
digest: sha256:32d64f09a27c0f9ae04893871166a0eaed21f1575219aa1d5f8cf0cdd076492b
generated: "2023-01-27T08:31:13.211732638+02:00"

View File

@ -10,29 +10,24 @@ description: |-
the high alpine areas of the Andes and a relative of the llama.
annotations:
category: TaskTracker
version: 0.4.3
appVersion: 0.21.0
version: 0.1.2
appVersion: unstable
kubeVersion: ">= 1.19"
dependencies:
- name: redis
version: 17.5.1
repository: https://charts.bitnami.com/bitnami
version: 17.11.6
condition: redis.enabled
condition: redisEnabled
- name: postgresql
version: 12.1.9
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: common
repository: https://bjw-s.github.io/helm-charts
version: 1.5.1
condition: postgresqlEnabled
keywords:
- vikunja
- todo
- to-do
- task
- tack-tracker
- project-management
- self-hosted
maintainers:
- name: Vikunja
url: https://vikunja.io

262
README.md
View File

@ -1,184 +1,132 @@
Vikunja Helm Chart
===
This Helm Chart deploys both the Vikunja [frontend](https://hub.docker.com/r/vikunja/frontend) and Vikunja [api](https://hub.docker.com/r/vikunja/api) containers, in addition to other Kubernetes resources so that you'll have a fully functioning Vikunja deployment quickly. Also, you can deploy Bitnami's [PostgreSQL](https://github.com/bitnami/charts/tree/main/bitnami/postgresql) and [Redis](https://github.com/bitnami/charts/tree/main/bitnami/redis) as subcharts if you want, as Vikunja can utilize them as its database and caching mechanism (respectively).
Deployes both frontend and backend. Also, you can deploy bitnami's PostgreSQL and Redis as subcharts if you want.
See https://artifacthub.io/packages/helm/vikunja/vikunja for version information and installation instructions.
## Requirements
Kubernetes >= 1.19
Helm >= 3
## Quickstart
Define ingress settings according to your controller (for both API and Frontend) to access the application.
You can set all Vikunja API options as yaml under `api.configMaps.config.data.config.yml`: https://vikunja.io/docs/config-options
For example, you can disable registration (if you do not with to allow others to register on your Vikunja), by providing the following values in your `values.yaml`:
Default settings should work for you and if you define ingress settings according to your controller (for both API and Frontend), you will be able to access the frontend. Anyway, it won't have any default credentials. In order to create a user, you **have to enable registration** and register a new user.
```yaml
api:
configMaps:
config:
enabled: true
data:
config.yml:
service:
enableregistration: false
config:
service:
enableregistration: true
```
You can still create new users by executing the following command in the `api` container:
Once you have registered, you can disable registration back if you do not need it.
```bash
./vikunja user create --email <user@email.com> --user <user1> --password <password123>
```
## Advanced features
## Advanced Features
### Raw resources
### Replicas
Often happens, that you have to deploy some cloud-specific resources that are not a part of the application chart itself. You have to either create an extra chart for that, or manage them with other tools (kustomize, plain manifests etc.). That is painful. We have a solution. If you want to create anything that is not present in the chart, *just add it in raw*!
To effectively run multiple replicas of the API,
make sure to set up the redis cache as well
by setting `api.configMaps.config.data.config.yml.keyvalue.type` to `redis`,
configuring the redis subchart (see [values.yaml](./values.yaml#L119))
and the connection [in Vikunja](https://vikunja.io/docs/config-options/#redis)
### Use an existing file volume claim
In the `values.yaml` file, you can either define your own existing Persistent Volume Claim (PVC)
or have the chart create one on your behalf.
To have the chart use your pre-existing PVC:
```yaml
api:
persistence:
data:
enabled: true
existingClaim: <your-claim>
```
To have the chart create one on your behalf:
```yaml
# You can find the default values
api:
enabled: true
persistence:
data:
enabled: true
accessMode: ReadWriteOnce
size: 10Gi
mountPath: /app/vikunja/files
storageClass: storage-class
```
### Utilizing environment variables from Kubernetes secrets
Each environment variable that is "injected" into a pod can be sourced from a Kubernetes secret.
This is useful when you wish to add values that you would rather keep as secrets in your GitOps repo
as environment variables in the pods.
Assuming that you had a Kubernetes secret named `vikunja-env`,
this is how you would add the value stored at key `VIKUNJA_DATABASE_PASSWORD` as the environment variable named `VIKUNJA_DATABASE_PASSWORD`:
```yaml
api:
env:
VIKUNJA_DATABASE_PASSWORD:
valueFrom:
secretKeyRef:
name: vikunja-env
key: VIKUNJA_DATABASE_PASSWORD
VIKUNJA_DATABASE_USERNAME: "db-user"
```
If the keys within the secret are the names of environment variables,
you can simplify passing multiple values to this:
```yaml
api:
envFrom:
- secretRef:
name: vikunja-secret-env
env:
VIKUNJA_DATABASE_USERNAME: "db-user"
```
This will add all keys within the Kubernetes secret named `vikunja-secret-env` as environment variables to the `api` pod. Additionally, if you did not have the key `VIKUNJA_DATABASE_USERNAME` in the `vikunja-secret-env` secret, you could still define it as an environment variable seen above.
How the `envFrom` key works can be seen [here](https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L155).
### Utilizing a Kubernetes secret as the `config.yml` file instead of a ConfigMap
If you did not wish to use the ConfigMap provided by the chart, and instead wished to mount your own Kubernetes secret as the `config.yml` file in the `api` pod, you could provide values such as the following (assuming `asdf-my-custom-secret1` was the name of the secret that had the `config.yml` file):
```yaml
api:
persistence:
config:
type: secret
name: asdf-my-custom-secret1
```
Then your secret should look something like the following so that it will mount properly:
```yaml
apiVersion: v1
kind: Secret
metadata:
name: asdf-my-custom-secret1
namespace: vikunja
type: Opaque
stringData:
config.yml: |
key1: value1
key2: value2
key3: value3
```
### Modifying Deployed Resources
Oftentimes, modifications need to be made to a Helm chart to allow it to operate in your Kubernetes cluster.
Anything you see [in bjw-s' `common` library](https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml),
including the top-level keys, can be added and subtracted from this chart's `values.yaml`,
underneath the `api`, `frontend`, and (optionally) `typesense` key.
For example, if you wished to create a `serviceAccount` as can be seen [here](https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L85-L87) for the `api` pod:
```yaml
api:
serviceAccount:
create: true
```
Then, (for some reason), if you wished to deploy the `frontend` as a `DaemonSet` ([as can be seen here](https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L12-L17)), you could do the following:
Let's say, you are hosted in [GKE](https://cloud.google.com/kubernetes-engine) and want to use Google-managed TLS certificates. In order to do that, you have to create a ManagedCertificate resource. It can be done this way.
```yaml
frontend:
controller:
type: daemonset
```
enabled: true
annotations:
kubernetes.io/ingress.class: gce
networking.gke.io/managed-certificates: gmc-example-com
hosts:
- host: example.com
paths:
- path: /
pathType: Prefix
## Publishing
raw:
- apiVersion: networking.gke.io/v1
kind: ManagedCertificate
metadata:
name: gmc-example-com
spec:
domains:
- example.com
```
The following steps are automatically performed when a git tag for a new version is pushed to the repository.
They are only listed here for reference.
Or, let's say, you have decided to use Google SQL database instead of self-hosted, and placed credentials in Google Secret Manager. You plan to use [ExternalSecrets](https://external-secrets.io/v0.7.2/) to get that credentials. These can be easily integrated as well.
1. Pull all dependencies before packaging.
```yaml
# Disable embedded database
postgresqlEnabled: false
```shell
helm dependency update
```
api:
config:
database:
# Use PostgreSQL database anyway
type: postgresql
envFrom:
# Bind env variables from the secret
- name: VIKUNJA_DATABASE_USER
valueFrom:
secretKeyRef:
name: postgresql-credentials
key: username
- name: VIKUNJA_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: postgresql-credentials
key: password
- name: VIKUNJA_DATABASE_HOST
valueFrom:
secretKeyRef:
name: postgresql-credentials
key: hostname
- name: VIKUNJA_DATABASE_DATABASE
valueFrom:
secretKeyRef:
name: postgresql-credentials
key: database
2. In order to publish the chart, you have to either use curl or helm cm-push.
raw:
- apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
name: gcpsm
spec:
refreshInterval: 300
provider:
gcpsm:
projectID: my-google-project-id
```shell
helm package .
curl --user '<username>:<password>' -X POST --upload-file './<archive>.tgz' https://kolaente.dev/api/packages/vikunja/helm/api/charts
```
- apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: postgresql-credentials
spec:
secretStoreRef:
kind: SecretStore
name: gcpsm
target:
deletionPolicy: Delete
refreshInterval: 5m
dataFrom:
- extract:
key: cloud-sql-credentials
```
```shell
helm package .
helm repo add --username '<username>' --password '<password>' vikunja https://kolaente.dev/api/packages/vikunja/helm
helm cm-push './<archive>.tgz' vikunja
```
Enjoy!
As you can see, you do not have to specify the name of the repository, just the name of the organization.
## Contributing
In order to publish the chart, you have to either use curl or helm cm-push.
```shell
helm package .
curl --user '<username>:<password>' -X POST --upload-file './<archive>.tgz' https://kolaente.dev/api/packages/vikunja/helm/api/charts
```
```shell
helm package .
helm repo add --username '<username>' --password '<password>' vikunja https://kolaente.dev/api/packages/vikunja/helm
helm cm-push './<archive>.tgz' vikunja
```
As you can see, you do not have to specify the name of the repository, just the name of the organization.

View File

@ -1,9 +0,0 @@
# Artifact Hub repository metadata file
# https://artifacthub.io/docs/topics/repositories/helm-charts/#oci-support
# publish via:
# oras push kolaente.dev/vikunja/vikunja:artifacthub.io --config artifacthub.config.json:application/vnd.cncf.artifacthub.config.v1+yaml artifacthub-repo.yml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml
repositoryID: 14bd8402-9829-4f9b-b71e-e496fc1307f5
owners: # (optional, used to claim repository ownership)
- name: kolaente
email: artifacthub@kolaente.de

View File

@ -1 +0,0 @@
{}

0
templates/NOTES.txt Normal file
View File

95
templates/_helpers.tpl Normal file
View File

@ -0,0 +1,95 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "vikunja.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 "vikunja.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 "vikunja.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "vikunja.labels" -}}
helm.sh/chart: {{ include "vikunja.chart" . }}
{{ include "vikunja.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "vikunja.selectorLabels" -}}
app.kubernetes.io/name: {{ include "vikunja.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.extraLabels }}
{{- toYaml . | nindent 0 }}
{{- end }}
{{- end }}
{{/*
Selector labels for API
*/}}
{{- define "vikunja.apiSelectorLabels" -}}
{{ include "vikunja.selectorLabels" . }}
app.kubernetes.io/component: api
{{- end }}
{{/*
Selector labels for frontend
*/}}
{{- define "vikunja.frontendSelectorLabels" -}}
{{ include "vikunja.selectorLabels" . }}
app.kubernetes.io/component: frontend
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "vikunja.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vikunja.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
API fullname
*/}}
{{- define "vikunja.apiFullname" -}}
{{- include "vikunja.fullname" . | printf "%s-api" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Frontend fullname
*/}}
{{- define "vikunja.frontendFullname" -}}
{{- include "vikunja.fullname" . | printf "%s-frontend" | trunc 63 | trimSuffix "-" }}
{{- end }}

View File

@ -1,68 +0,0 @@
{{- define "vikunja.api.hardcodedValues" -}}
global:
nameOverride: api
service:
main:
enabled: true
primary: true
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 3456
protocol: HTTP
persistence:
config:
enabled: true
type: configMap
name: "{{ .Release.Name }}-api-config"
mountPath: /etc/vikunja/config.yml
subPath: config.yml
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /api/v1/info
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
startup:
enabled: false
env:
{{ if .Values.redis.enabled }}
VIKUNJA_REDIS_ENABLED: "true"
{{ end }}
{{ if .Values.typesense.enabled }}
VIKUNJA_TYPESENSE_ENABLED: "true"
{{ end }}
{{ if and .Values.frontend.ingress.enabled .Values.api.configMaps.config.enabled}}
# The configuration for Vikunja's api.
# https://vikunja.io/docs/config-options/
VIKUNJA_SERVICE_FRONTENDURL: "http://{{ index .Values.frontend.ingress.main.hosts 0 "host" }}{{ index .Values.frontend.ingress.main.hosts 0 "path" }}"
{{ end }}
# Logic to decide what the api URL should be
{{ if .Values.frontend.ingress.enabled }}
VIKUNJA_FRONTEND_URL: "http://{{ index .Values.frontend.ingress.main.hosts 0 "host" }}{{ index .Values.frontend.ingress.main.hosts 0 "path" }}"
{{ end }}
{{ end }}
{{ if .Values.api.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "api" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "vikunja.api.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}

View File

@ -0,0 +1,126 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "vikunja.apiFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
{{- if not .Values.api.autoscaling.enabled }}
replicas: {{ .Values.api.replicaCount }}
{{- end }}
{{- with .Values.api.extraDeploymentSpec }}
{{- toYaml . | nindent 2 }}
{{- end }}
selector:
matchLabels:
{{- include "vikunja.apiSelectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- with .Values.api.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "vikunja.apiSelectorLabels" . | nindent 8 }}
spec:
{{- with .Values.api.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "vikunja.serviceAccountName" . }}
{{- with .Values.api.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
{{- with .Values.api.sidecarContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: api
{{- with .Values.api.securityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- $image := required ".image.repository is not set" .Values.api.image.repository }}
{{- $tag := default .Chart.AppVersion .Values.api.image.tag | toString }}
image: {{ printf "%s:%s" $image $tag | quote }}
imagePullPolicy: {{ .Values.api.image.pullPolicy }}
ports:
- name: http
containerPort: {{ (.Values.api.config.service.interface | split ":")._1 | int }}
protocol: TCP
{{- with .Values.api.env }}
env:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.envFrom }}
envFrom:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.api.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.api.startupProbe }}
startupProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.api.resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
volumeMounts:
- name: tmp
mountPath: /tmp
- name: api-config
subPath: api-config.yaml
mountPath: /etc/vikunja/config.yaml
{{- if .Values.api.persistence.enabled }}
- name: storage
subPath: files
mountPath: {{ quote .Values.api.config.files.basepath }}
{{- if eq .Values.api.config.database.type "sqlite" }}
- name: storage
subPath: sqlite
mountPath: {{ dir .Values.api.config.database.path | quote }}
{{- end }}
{{- end }}
{{- with .Values.api.extraVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: tmp
emptyDir: {}
- name: api-config
secret:
secretName: {{ include "vikunja.fullname" . }}
defaultMode: 0644
{{- if .Values.api.persistence.enabled }}
- name: storage
persistentVolumeClaim:
claimName: {{ include "vikunja.apiFullname" . }}
{{- end }}
{{- with .Values.api.extraVolumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.api.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.api.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

32
templates/api/hpa.yaml Normal file
View File

@ -0,0 +1,32 @@
{{- if .Values.api.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "vikunja.apiFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "vikunja.apiFullname" . }}
minReplicas: {{ int .Values.api.autoscaling.minReplicas }}
maxReplicas: {{ int .Values.api.autoscaling.maxReplicas }}
metrics:
{{- if .Values.api.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ int .Values.api.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.api.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ int .Values.api.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,41 @@
{{- if .Values.api.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "vikunja.apiFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
{{- with .Values.api.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.api.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
{{- if .Values.api.ingress.tls }}
tls:
{{- range .Values.api.ingress.tls }}
- secretName: {{ quote .secretName }}
hosts:
{{- toYaml .hosts | nindent 8 }}
{{- end }}
{{- end }}
rules:
{{- range .Values.api.ingress.hosts }}
- host: {{ quote .host }}
http:
paths:
{{- range .paths }}
- path: {{ quote .path }}
{{- with .pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ include "vikunja.apiFullname" $ }}
port:
name: http
{{- end }}
{{- end }}
{{- end }}

18
templates/api/pdb.yaml Normal file
View File

@ -0,0 +1,18 @@
{{- if .Values.api.pdb.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "vikunja.apiFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
{{- with .Values.api.pdb.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- with .Values.api.pdb.minAvailable }}
minAvailable: {{ . }}
{{- end }}
selector:
matchLabels:
{{- include "vikunja.apiSelectorLabels" . | nindent 6 }}
{{- end }}

10
templates/api/pvc.yaml Normal file
View File

@ -0,0 +1,10 @@
{{- if .Values.api.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "vikunja.apiFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
{{- toYaml .Values.api.persistence.spec | nindent 2 }}
{{- end }}

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "vikunja.apiFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
type: {{ .Values.api.service.type }}
ports:
- port: {{ int .Values.api.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "vikunja.apiSelectorLabels" . | nindent 4 }}
{{- with .Values.api.service.extraSpec }}
{{- toYaml . | nindent 2 }}
{{- end }}

View File

@ -1,29 +0,0 @@
{{- define "vikunja.frontend.hardcodedValues" -}}
global:
nameOverride: frontend
service:
main:
enabled: true
primary: true
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 80
protocol: HTTP
env:
{{- if .Values.api.ingress.main.enabled }}
VIKUNJA_API_URL: "http://{{ index .Values.api.ingress.main.hosts 0 "host" }}{{ index .Values.api.ingress.main.hosts 0 "path" }}"
{{ end }}
{{ end }}
{{ if .Values.frontend.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "frontend" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "vikunja.frontend.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}

View File

@ -0,0 +1,107 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "vikunja.frontendFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
{{- if not .Values.frontend.autoscaling.enabled }}
replicas: {{ .Values.frontend.replicaCount }}
{{- end }}
{{- with .Values.frontend.extraDeploymentSpec }}
{{- toYaml . | nindent 2 }}
{{- end }}
selector:
matchLabels:
{{- include "vikunja.frontendSelectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.frontend.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "vikunja.frontendSelectorLabels" . | nindent 8 }}
spec:
{{- with .Values.frontend.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "vikunja.serviceAccountName" . }}
{{- with .Values.frontend.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.frontend.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
{{- with .Values.frontend.sidecarContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: frontend
{{- with .Values.frontend.securityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- $image := required ".image.repository is not set" .Values.frontend.image.repository }}
{{- $tag := default .Chart.AppVersion .Values.frontend.image.tag | toString }}
image: {{ printf "%s:%s" $image $tag | quote }}
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: VIKUNJA_API_URL
value: {{ quote .Values.frontend.apiUrl }}
- name: VIKUNJA_HTTP_PORT
value: "8080"
{{- with .Values.frontend.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.frontend.envFrom }}
envFrom:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.frontend.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.frontend.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.frontend.startupProbe }}
startupProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.frontend.resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
volumeMounts:
- name: tmp
mountPath: /tmp
{{- with .Values.frontend.extraVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.frontend.extraVolumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.frontend.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.frontend.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.frontend.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,32 @@
{{- if .Values.frontend.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "vikunja.frontendFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "vikunja.frontendFullname" . }}
minReplicas: {{ int .Values.frontend.autoscaling.minReplicas }}
maxReplicas: {{ int .Values.frontend.autoscaling.maxReplicas }}
metrics:
{{- if .Values.frontend.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ int .Values.frontend.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.frontend.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ int .Values.frontend.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,41 @@
{{- if .Values.frontend.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "vikunja.frontendFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
{{- with .Values.frontend.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.frontend.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
{{- if .Values.frontend.ingress.tls }}
tls:
{{- range .Values.frontend.ingress.tls }}
- secretName: {{ quote .secretName }}
hosts:
{{- toYaml .hosts | nindent 8 }}
{{- end }}
{{- end }}
rules:
{{- range .Values.frontend.ingress.hosts }}
- host: {{ quote .host }}
http:
paths:
{{- range .paths }}
- path: {{ quote .path }}
{{- with .pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ include "vikunja.frontendFullname" $ }}
port:
name: http
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,18 @@
{{- if .Values.frontend.pdb.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "vikunja.frontendFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
{{- with .Values.frontend.pdb.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- with .Values.frontend.pdb.minAvailable }}
minAvailable: {{ . }}
{{- end }}
selector:
matchLabels:
{{- include "vikunja.frontendSelectorLabels" . | nindent 6 }}
{{- end }}

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "vikunja.frontendFullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
spec:
type: {{ .Values.frontend.service.type }}
ports:
- port: {{ int .Values.frontend.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "vikunja.frontendSelectorLabels" . | nindent 4 }}
{{- with .Values.frontend.service.extraSpec }}
{{- toYaml . | nindent 2 }}
{{- end }}

5
templates/raw.yaml Normal file
View File

@ -0,0 +1,5 @@
{{- range .Values.vikunja }}
{{- $manifest := include "vikunja.labels" $ | fromYaml | dict "labels" | dict "metadata" | mergeOverwrite . }}
{{- toYaml $manifest }}
---
{{- end }}

9
templates/secret.yaml Normal file
View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "vikunja.fullname" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
type: Opaque
data:
api-config.yaml: {{ toYaml .Values.api.config | b64enc }}

View File

@ -0,0 +1,15 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "vikunja.serviceAccountName" . }}
labels:
{{- include "vikunja.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View File

@ -1,39 +0,0 @@
{{- define "vikunja.typesense.hardcodedValues" -}}
global:
nameOverride: typesense
service:
main:
enabled: true
primary: true
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 8108
protocol: HTTP
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /health
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
startup:
enabled: false
{{- end }}
{{ if .Values.typesense.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "typesense" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "vikunja.typesense.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}

View File

@ -1,151 +1,306 @@
## This chart relies on the common library chart from bjw-s
## You can find it and the values you can provide and modify, at https://github.com/bjw-s/helm-charts/tree/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common
## Here's the link to the values.yaml file: https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml
## Refer there for more detail about the supported values.
## Any values that you find in the above `values.yaml` can be provided to this chart and are then rendered.
# ┐ ┬o┬┌ ┬ ┐┌┐┐ ┬┬─┐
# │┌┘│├┴┐│ ││││┌ ││─┤
# └┘ ┘┘ ┘┘─┘┘└┘└─┘┘ ┘
image:
tag: 0.21.0
nameOverride: ""
fullnameOverride: ""
######################
# VIKUNJA COMPONENTS #
######################
# You can find the default values that this `values.yaml` overrides, in the comment at the top of this file.
api:
enabled: true
image:
repository: vikunja/api
tag: 0.21.0
pullPolicy: IfNotPresent
persistence:
# This is your Vikunja data will live, you can either let
# the chart create a new PVC for you or provide an existing one.
data:
enabled: true
# existingClaim: # your-claim
accessMode: ReadWriteOnce
size: 10Gi
mountPath: /app/vikunja/files
# storageClass: storage-class
ingress:
main:
enabled: true
annotations:
# proxy-body-size is set to 0 to remove the body limit on file uploads
nginx.ingress.kubernetes.io/proxy-body-size: "0"
hosts:
- host: vikunja.local
paths:
- path: "/api/v1"
tls: []
configMaps:
# The configuration for Vikunja's api.
# https://vikunja.io/docs/config-options/
config:
enabled: true
data:
config.yml: |
# Vikunja needs to know the frontend URL for password reset emails.
# So you might need to provide its value, if you're not using an ingress.
# service:
# frontendUrl: http://vikunja.local
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# Extra labels
extraLabels: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
typesense:
# Typesense will only work if it is enabled below (typesense.enabled).
url: "{{ printf "%s-typesense" .Release.Name }}:8108"
apiKey: "{{ .Values.typesense.env.TYPESENSE_API_KEY }}"
redis:
# Redis will only work if it is enabled below (redis.enabled).
host: "{{ printf "%s-redis-master" .Release.Name }}:6379"
db: "{{ .Release.Name }}"
env:
# To utilize a secret in the environment variables, you can do something like the following: https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L141-L145
# You could also use MySQL or SQLite, but we recommend PostgreSQL.
# https://vikunja.io/docs/config-options/#type
VIKUNJA_DATABASE_TYPE: "postgres"
VIKUNJA_DATABASE_USER: "{{ .Values.postgresql.global.postgresql.auth.username }}"
VIKUNJA_DATABASE_PASSWORD: "{{ .Values.postgresql.global.postgresql.auth.password }}"
VIKUNJA_DATABASE_NAME: "{{ .Values.postgresql.global.postgresql.auth.database }}"
# Extra labels that will be added to all resources
extraLabels: {}
# ┬─┐┬─┐┌─┐┌┐┐┌┐┐┬─┐┌┐┐┬─┐
# ├─ │┬┘│ ││││ │ ├─ ││││ │
# ┘ ┘└┘┘─┘┘└┘ ┘ ┴─┘┘└┘┘─┘
frontend:
enabled: true
# You can add any of the top-level keys in the common chart's `values.yaml` to override them here.
# For example, this values.yaml file overrides the image values, located here:
# https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L63-L69
# Public API URL that client's browser will reach
apiUrl: ""
replicaCount: 1
image:
repository: vikunja/frontend
tag: 0.21.0
pullPolicy: IfNotPresent
# You can use either a `service` or an `ingress` to interact with Vikunja's frontend.
# `Ingress` is the recommended option, but you can still set the `service` to
# `LoadBalancer` or another service type.
# https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L294-L354
# Overrides the image tag whose default is the chart appVersion.
tag: ""
podSecurityContext: {}
# fsGroup: 1000
securityContext:
capabilities:
drop:
- ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
main:
type: ClusterIP
type: ClusterIP
port: 80
# If you want to set other fields, like externalName, externalTrafficPolicy, etc.
extraSpec: {}
# https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L393-L436
ingress:
main:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
initContainers: []
sidecarContainers: []
# Extra keys to set in deployment.spec.
# Useful if you want to set minReadySeconds, progressDeadlineSeconds, strategy
extraDeploymentSpec: {}
pdb:
enabled: false
# maxUnavailable: 50%
minAvailable: 50%
imagePullSecrets: []
podAnnotations: {}
nodeSelector: {}
tolerations: []
affinity: {}
extraVolumes: []
extraVolumeMounts: []
livenessProbe: {}
# httpGet:
# path: /ready
# port: http
readinessProbe: {}
# httpGet:
# path: /ready
# port: http
startupProbe: {}
# httpGet:
# path: /
# port: http
env: {}
envFrom: {}
# ┬─┐┬─┐o
# │─┤│─┘│
# ┘ ┘┘ ┘
api:
# Values for this config are described here https://vikunja.io/docs/config-options/
config:
service:
JWTSecret: ""
interface: ":3456"
frontendurl: ""
enableregistration: false
timezone: GMT
database:
type: sqlite
path: /sqlite/vikunja.db
cache:
enabled: true
annotations:
# proxy-body-size is set to 0 to remove the body limit on file uploads
nginx.ingress.kubernetes.io/proxy-body-size: "0"
hosts:
# This is just an example. You should change this to your own domain.
- host: vikunja.local
paths:
- path: "/"
tls: []
# You only need to provide the URL to the API as environment variable here if you deviate from the "built-in" ingress in the api section.
#env:
# VIKUNJA_API_URL: http://vikunja.local/api
type: redis
redis:
enabled: false
host: ""
password: ""
db: 0
cors:
enable: false
origins: []
mailer:
enabled: false
log:
path: null
files:
basepath: /files
defaultsettings:
avatar_provider: gravatar
discoverable_by_name: true
discoverable_by_email: true
week_start: 1
persistence:
enabled: false
spec: {}
# accessModes: ["ReadWriteOnce"]
# resources:
# requests:
# storage: 1Gi
# storageClassName: openebs-hostpath
##########################
# END VIKUNJA COMPONENTS #
##########################
replicaCount: 1
# Optional Dependencies
image:
repository: vikunja/api
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
# ┬─┐┌─┐┐─┐┌┐┐┌─┐┬─┐┬─┐┐─┐┐─┐┬
# │─┘│ │└─┐ │ │ ┬│┬┘├─ └─┐│ ││
securityContext:
capabilities:
add: [CAP_CHOWN]
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
# If you want to set other fields, like externalName, externalTrafficPolicy, etc.
extraSpec: {}
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
initContainers: []
sidecarContainers: []
# Extra keys to set in deployment.spec.
# Useful if you want to set minReadySeconds, progressDeadlineSeconds, strategy
extraDeploymentSpec: {}
pdb:
enabled: false
# maxUnavailable: 50%
minAvailable: 50%
imagePullSecrets: []
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 1000
nodeSelector: {}
tolerations: []
affinity: {}
extraVolumes: []
extraVolumeMounts: []
livenessProbe: {}
# httpGet:
# path: /ready
# port: http
readinessProbe: {}
# httpGet:
# path: /ready
# port: http
startupProbe: {}
# httpGet:
# path: /
# port: http
env: {}
envFrom: {}
# ┬─┐┌─┐┐─┐┌┐┐┌─┐┬─┐┬─┐┐─┐┐─┐┬
# │─┘│ │└─┐ │ │ ┬│┬┘├─ └─┐│ ││
# ┘ ┘─┘──┘ ┘ ┘─┘┘└┘┴─┘──┘└─\┘─┘
postgresqlEnabled: false
# Please refer to PostgreSQL subchart for a full list of possible values
# https://github.com/bitnami/charts/tree/main/bitnami/postgresql/#parameters
postgresql:
enabled: true
global:
postgresql:
auth:
username: vikunja
database: vikunja
password: vikunja
postgresql: {}
# ┬─┐┬─┐┬─┐o┐─┐
# │┬┘├─ │ ││└─┐
# ┘└┘┴─┘┘─┘┘──┘
redisEnabled: false
# Please refer to Redis subchart for a full list of possible values
# https://github.com/bitnami/charts/tree/main/bitnami/redis/#parameters
redis:
enabled: false
architecture: standalone
auth:
enabled: false
redis: {}
typesense:
enabled: true
env:
TYPESENSE_DATA_DIR: /data
TYPESENSE_API_KEY: typesense
persistence:
data:
# Enabling typesense persistence is recommended to avoid slow reindexing
enabled: true
accessMode: ReadWriteOnce
size: 1Gi
# storageClass: storage-class
# ┬─┐┬─┐┐ ┬
# │┬┘│─┤│││
# ┘└┘┘ ┘└┴┘
image:
repository: docker.io/typesense/typesense
tag: 0.25.1
pullPolicy: IfNotPresent
# You can create custom resources from the plaintext definition
raw: []