Compare commits

..

2 Commits
main ... main

Author SHA1 Message Date
CAMPION Hugo 1583ce39c8
Update README: add instructions for the use of secrets
Signed-off-by: CAMPION Hugo <h.campion@geco-it.fr>
2023-11-16 15:38:11 +01:00
CAMPION Hugo 9bb51e1666
Fix wrong mountPath for default PVC in value.yaml
Signed-off-by: CAMPION Hugo <h.campion@geco-it.fr>
2023-11-16 11:16:35 +01:00
6 changed files with 66 additions and 134 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 vikunja-*.tgz https://kolaente.dev/api/packages/vikunja/helm/api/charts
---
kind: signature
hmac: 0f07e164aa169160b10e2813884d8de17a207ac10d4b3f03026e0a9a175acb83
hmac: 993135e828384d9938343750ed3164c2ae702b87118d28b74ae3e1f522403f61
...

View File

@ -10,7 +10,7 @@ description: |-
the high alpine areas of the Andes and a relative of the llama.
annotations:
category: TaskTracker
version: 0.4.3
version: 0.3.0
appVersion: 0.21.0
kubeVersion: ">= 1.19"
dependencies:

165
README.md
View File

@ -3,46 +3,20 @@ 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).
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
The majority of default values defined in `values.yaml` should be compatible for your deployment. Additionally, if you utilize an Ingress for both the API and Frontend, you will be able to access the frontend out of the box. However, it won't have any default credentials. So, you'll need to create an account using the registration button.
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`:
```yaml
api:
configMaps:
config:
enabled: true
data:
config.yml:
service:
enableregistration: false
```
You can still create new users by executing the following command in the `api` container:
```bash
./vikunja user create --email <user@email.com> --user <user1> --password <password123>
```
## Advanced Features
### Replicas
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)
That should be it!
### 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.
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:
@ -57,7 +31,7 @@ api:
To have the chart create one on your behalf:
```yaml
# You can find the default values
# You can find the default values
api:
enabled: true
persistence:
@ -65,87 +39,20 @@ api:
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.
Often times, modifications need to be made to a Helm chart to allow it to operate in your Kubernetes cluster. By utilizing bjw-s's `common` library, there are quite a few options that can be easily modified.
Anything you see [here](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:
serviceAccount:
create: true
```
@ -155,7 +62,53 @@ Then, (for some reason), if you wished to deploy the `frontend` as a `DaemonSet`
frontend:
controller:
type: daemonset
```
```
### Another Example of Modifying `config.yml` (Enabling Registration)
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`:
```yaml
api:
configMaps:
config:
enabled: true
data:
config.yml:
service:
enableregistration: false
```
If you need to create another user, you could opt to execute the following command on the `api` container:
```bash
./vikunja user create --email <user@email.com> --user <user1> --password <password123>
```
### Utilizing secrets for `env` and `config.yml`
Each env in the stack can be sourced from a secret in your `values.yaml`:
```yaml
api:
env:
VIKUNJA_DATABASE_PASSWORD:
valueFrom:
secretKeyRef:
name: vikunja-env
key: VIKUNJA_DATABASE_PASSWORD
```
If your vikunja config needs to contain sensible data, like oauth config, you can source it from a secret in your `values.yaml`:
```yaml
api:
persistence:
config:
enabled: true
type: secret
mountPath: /etc/vikunja/config.yml
# Warning, you can not choose the secret name here, it will search for {{ Release.Name }}-api-config ! So please create your secret accordingly !
```
## Publishing

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 @@
{}

View File

@ -97,21 +97,16 @@ frontend:
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
# If you've used the "built-in" ingress in the api section, you don't need to specify VIKUNJA_API_URL as an environment variable here.
# If you've used something else, you'll need to provide the URL to the API here.
# env:
# VIKUNJA_API_URL: http://vikunja.local/api
##########################
# END VIKUNJA COMPONENTS #
##########################
# Optional Dependencies
# ┬─┐┌─┐┐─┐┌┐┐┌─┐┬─┐┬─┐┐─┐┐─┐┬
# │─┘│ │└─┐ │ │ ┬│┬┘├─ └─┐│ ││
# ┘ ┘─┘──┘ ┘ ┘─┘┘└┘┴─┘──┘└─\┘─┘
# 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:
@ -121,11 +116,6 @@ postgresql:
database: vikunja
password: vikunja
# ┬─┐┬─┐┬─┐o┐─┐
# │┬┘├─ │ ││└─┐
# ┘└┘┴─┘┘─┘┘──┘
# 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