From c45922a3b36559697d8dc102efde04384993034d Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 11:38:02 +0000 Subject: [PATCH 01/22] Update dependencies --- LICENSE.md | 2 +- charts/monica/Chart.lock | 14 +++++++------- charts/monica/Chart.yaml | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 3f66dd0..d031ccb 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -628,7 +628,7 @@ the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. The software is called Monica and is a personal relationship management system. - Copyright (C) 2016-2022 asbiin + Copyright (C) 2016-2024 asbiin This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as diff --git a/charts/monica/Chart.lock b/charts/monica/Chart.lock index 37c6431..0bb105b 100644 --- a/charts/monica/Chart.lock +++ b/charts/monica/Chart.lock @@ -1,18 +1,18 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami - version: 11.6.26 + version: 16.0.3 - name: mariadb repository: https://charts.bitnami.com/bitnami - version: 11.0.14 + version: 19.1.0 - name: redis repository: https://charts.bitnami.com/bitnami - version: 16.12.3 + version: 20.2.1 - name: memcached repository: https://charts.bitnami.com/bitnami - version: 6.3.2 + version: 7.5.1 - name: meilisearch repository: https://meilisearch.github.io/meilisearch-kubernetes - version: 0.1.44 -digest: sha256:b8d4730508ccfcd8a121dc1f729468f476114c7bc3da8b8e4309d4b60849a88d -generated: "2022-12-23T18:39:53.1775839+01:00" + version: 0.10.1 +digest: sha256:4a6e4bcfe5d0d9148a866e294c0c725325af8d28b406dbe3ea908d522b3a8132 +generated: "2024-10-18T11:30:25.190830123Z" diff --git a/charts/monica/Chart.yaml b/charts/monica/Chart.yaml index cb4df76..92ca00c 100644 --- a/charts/monica/Chart.yaml +++ b/charts/monica/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: monica description: A Helm chart for Kubernetes to install Monica type: application -version: 1.0.6 +version: 1.0.7 appVersion: "1.0.0" icon: https://www.monicahq.com/favicon.ico maintainers: @@ -16,22 +16,22 @@ sources: - https://hub.docker.com/_/monica dependencies: - name: postgresql - version: 11.6.* + version: 16.0.* repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled - name: mariadb - version: 11.0.* + version: 19.1.* repository: https://charts.bitnami.com/bitnami condition: mariadb.enabled - name: redis - version: 16.12.* + version: 20.2.* repository: https://charts.bitnami.com/bitnami condition: redis.enabled - name: memcached - version: 6.3.* + version: 7.5.* repository: https://charts.bitnami.com/bitnami condition: memcached.enabled - name: meilisearch - version: 0.1.* + version: 0.10.* repository: https://meilisearch.github.io/meilisearch-kubernetes condition: meilisearch.enabled From 3e0cbd7fa706d9056aa56588ba5e4e2dcd118906 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 11:50:39 +0000 Subject: [PATCH 02/22] update --- .github/workflows/tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 56146e4..83a58b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,8 +4,8 @@ on: types: [opened, synchronize, reopened] env: - helm: v3.6.3 - python-version: 3.7 + helm: v3.16.2 + python-version: 3.x jobs: linter: @@ -17,11 +17,11 @@ jobs: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v3 + uses: azure/setup-helm@v4 with: version: ${{ env.helm }} - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ env.python-version }} @@ -40,11 +40,11 @@ jobs: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v3 + uses: azure/setup-helm@v4 with: version: ${{ env.helm }} - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ env.python-version }} From 6350fdfcd1fccf514e45465525ef7f61c325c5cb Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 12:23:50 +0000 Subject: [PATCH 03/22] fix --- ct.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct.yaml b/ct.yaml index f237d53..b7d59fe 100644 --- a/ct.yaml +++ b/ct.yaml @@ -1,5 +1,5 @@ remote: origin -helm-extra-args: --timeout 600s +helm-extra-args: '--timeout 600s' target-branch: main chart-dirs: - charts From 1a0613b1603ffc5adf679453e94825b3a1178386 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 12:27:24 +0000 Subject: [PATCH 04/22] update --- ct.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ct.yaml b/ct.yaml index b7d59fe..b43f090 100644 --- a/ct.yaml +++ b/ct.yaml @@ -1,5 +1,6 @@ remote: origin -helm-extra-args: '--timeout 600s' +helm-extra-args: --timeout 600s +helm-lint-extra-args: --quiet target-branch: main chart-dirs: - charts From 2099d7fdd099a92274e242bee3eab9c2717cb429 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 12:47:07 +0000 Subject: [PATCH 05/22] update --- .github/workflows/tests.yml | 6 +++--- ct.yaml | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83a58b7..8f6e10a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: uses: helm/chart-testing-action@v2 - name: Run chart-testing (lint) - run: ct lint --config ct.yaml + run: ct lint --target-branch ${{ github.event.repository.default_branch }}) helm-tests: runs-on: ubuntu-latest @@ -54,7 +54,7 @@ jobs: - name: Run chart-testing (list-changed) id: list-changed run: | - changed=$(ct list-changed --config ct.yaml) + changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) if [[ -n "$changed" ]]; then echo "changed=true" >> $GITHUB_OUTPUT fi @@ -64,4 +64,4 @@ jobs: if: steps.list-changed.outputs.changed == 'true' - name: Run chart-testing (install) - run: ct install --config ct.yaml + run: ct install --target-branch ${{ github.event.repository.default_branch }} diff --git a/ct.yaml b/ct.yaml index b43f090..cdaf1ba 100644 --- a/ct.yaml +++ b/ct.yaml @@ -1,7 +1,5 @@ -remote: origin helm-extra-args: --timeout 600s helm-lint-extra-args: --quiet -target-branch: main chart-dirs: - charts chart-repos: From c67597762fb1cc846ae4246b30806abf976c670d Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 13:09:40 +0000 Subject: [PATCH 06/22] update --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8f6e10a..e7197ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: uses: helm/chart-testing-action@v2 - name: Run chart-testing (lint) - run: ct lint --target-branch ${{ github.event.repository.default_branch }}) + run: ct lint --target-branch ${{ github.event.repository.default_branch }} helm-tests: runs-on: ubuntu-latest From bf374c57112d437cae3a843c267f888eea2862c0 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 13:16:58 +0000 Subject: [PATCH 07/22] update --- charts/monica/Chart.yaml | 2 +- ct.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/monica/Chart.yaml b/charts/monica/Chart.yaml index 92ca00c..4ef0fbc 100644 --- a/charts/monica/Chart.yaml +++ b/charts/monica/Chart.yaml @@ -3,7 +3,7 @@ name: monica description: A Helm chart for Kubernetes to install Monica type: application version: 1.0.7 -appVersion: "1.0.0" +appVersion: "5.0.0" icon: https://www.monicahq.com/favicon.ico maintainers: - name: MonicaHQ diff --git a/ct.yaml b/ct.yaml index cdaf1ba..ffa177b 100644 --- a/ct.yaml +++ b/ct.yaml @@ -1,3 +1,5 @@ +remote: origin +target-branch: main helm-extra-args: --timeout 600s helm-lint-extra-args: --quiet chart-dirs: From a84d5fd5c2424d3437bfa9bc77f11ce044b1606c Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 13:36:40 +0000 Subject: [PATCH 08/22] update --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e7197ec..83a58b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: uses: helm/chart-testing-action@v2 - name: Run chart-testing (lint) - run: ct lint --target-branch ${{ github.event.repository.default_branch }} + run: ct lint --config ct.yaml helm-tests: runs-on: ubuntu-latest @@ -54,7 +54,7 @@ jobs: - name: Run chart-testing (list-changed) id: list-changed run: | - changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) + changed=$(ct list-changed --config ct.yaml) if [[ -n "$changed" ]]; then echo "changed=true" >> $GITHUB_OUTPUT fi @@ -64,4 +64,4 @@ jobs: if: steps.list-changed.outputs.changed == 'true' - name: Run chart-testing (install) - run: ct install --target-branch ${{ github.event.repository.default_branch }} + run: ct install --config ct.yaml From 37fc6b94e30d3cba911bb266fea4f751541ac890 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 13:39:35 +0000 Subject: [PATCH 09/22] update --- .github/workflows/tests.yml | 6 +++--- ct.yaml | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83a58b7..40cb903 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: uses: helm/chart-testing-action@v2 - name: Run chart-testing (lint) - run: ct lint --config ct.yaml + run: ct lint --config ct.yaml --target-branch ${{ github.event.repository.default_branch }} helm-tests: runs-on: ubuntu-latest @@ -54,7 +54,7 @@ jobs: - name: Run chart-testing (list-changed) id: list-changed run: | - changed=$(ct list-changed --config ct.yaml) + changed=$(ct list-changed --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }}) if [[ -n "$changed" ]]; then echo "changed=true" >> $GITHUB_OUTPUT fi @@ -64,4 +64,4 @@ jobs: if: steps.list-changed.outputs.changed == 'true' - name: Run chart-testing (install) - run: ct install --config ct.yaml + run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} diff --git a/ct.yaml b/ct.yaml index ffa177b..2a086f8 100644 --- a/ct.yaml +++ b/ct.yaml @@ -1,7 +1,4 @@ remote: origin -target-branch: main -helm-extra-args: --timeout 600s -helm-lint-extra-args: --quiet chart-dirs: - charts chart-repos: From 7f4bb0b737bb46aed864b2f03de50bc5af428df3 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 13:44:40 +0000 Subject: [PATCH 10/22] fix --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 40cb903..7fadfe7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,7 +54,7 @@ jobs: - name: Run chart-testing (list-changed) id: list-changed run: | - changed=$(ct list-changed --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }}) + changed=$(ct list-changed --config ct.yaml --target-branch ${{ github.event.repository.default_branch }}) if [[ -n "$changed" ]]; then echo "changed=true" >> $GITHUB_OUTPUT fi From 0b601d2701be508f1e3fe2dab33f01c4073a95b3 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 14:15:09 +0000 Subject: [PATCH 11/22] add tests --- .github/workflows/tests.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7fadfe7..fa7bdc4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,6 +33,25 @@ jobs: helm-tests: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + test_cases: + # test the plain helm chart with nothing changed + - name: 'Default - no custom values' + + # test the helm chart with postgresql subchart enabled + - name: PostgreSQL Enabled + helm_args: '--helm-extra-set-args "--set=postgresql.enabled=true --set=postgresql.global.postgresql.auth.password=testing123456 --set=internalDatabase.enabled=false --set=externalDatabase.enabled=True --set=externalDatabase.type=postgresql --set=externalDatabase.password=testing12345"' + + # test the helm chart with nginx container enabled + - name: Nginx Enabled + helm_args: '--helm-extra-set-args "--set=image.flavor=fpm --set=nginx.enabled=true"' + + # test the helm chart with horizontal pod autoscaling enabled + - name: Horizontal Pod Autoscaling Enabled + helm_args: '--helm-extra-set-args "--set=hpa.enabled=true --set=hpa.minPods=2 --set=hpa.maxPods=3 --set=hpa.targetCPUUtilizationPercentage=75"' + steps: - name: Checkout uses: actions/checkout@v4 @@ -63,5 +82,5 @@ jobs: uses: helm/kind-action@v1 if: steps.list-changed.outputs.changed == 'true' - - name: Run chart-testing (install) - run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} + - name: Run chart-testing (install ${{ matrix.test_cases.name }}) + run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} ${{ matrix.test_cases.helm_args }} From 6ffae10a0dc8fc8664d022733a2207eaef8a6b62 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Fri, 18 Oct 2024 23:23:34 +0200 Subject: [PATCH 12/22] fixes --- .github/workflows/release.yml | 2 -- .github/workflows/tests.yml | 18 ++++++++++++------ charts/monica/templates/_helpers.tpl | 2 +- charts/monica/templates/deployment.yaml | 2 +- charts/monica/values.yaml | 3 +++ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29596d6..40c5e82 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,5 @@ jobs: - name: Run chart-releaser uses: helm/chart-releaser-action@v1 - with: - charts_repo_url: https://monicahq.github.io/helm env: CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa7bdc4..ecbb142 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,6 +33,8 @@ jobs: helm-tests: runs-on: ubuntu-latest + name: Helm tests (${{ matrix.test_cases.name }}) + strategy: fail-fast: false matrix: @@ -41,15 +43,19 @@ jobs: - name: 'Default - no custom values' # test the helm chart with postgresql subchart enabled - - name: PostgreSQL Enabled - helm_args: '--helm-extra-set-args "--set=postgresql.enabled=true --set=postgresql.global.postgresql.auth.password=testing123456 --set=internalDatabase.enabled=false --set=externalDatabase.enabled=True --set=externalDatabase.type=postgresql --set=externalDatabase.password=testing12345"' + - name: PostgreSQL enabled + helm_args: '--helm-extra-set-args "--set=postgresql.enabled=true --set=internalDatabase.enabled=false"' + + # test the helm chart with mariadb subchart enabled + - name: Mariadb enabled + helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false"' - # test the helm chart with nginx container enabled - - name: Nginx Enabled - helm_args: '--helm-extra-set-args "--set=image.flavor=fpm --set=nginx.enabled=true"' + # test the helm chart with all options + - name: Redis and queue enabled + helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false --set=redis.enabled=true --set=memcached.enabled=true --set=cronjob.enabled=true --set=queue.enabled=true"' # test the helm chart with horizontal pod autoscaling enabled - - name: Horizontal Pod Autoscaling Enabled + - name: Horizontal Pod Autoscaling enabled helm_args: '--helm-extra-set-args "--set=hpa.enabled=true --set=hpa.minPods=2 --set=hpa.maxPods=3 --set=hpa.targetCPUUtilizationPercentage=75"' steps: diff --git a/charts/monica/templates/_helpers.tpl b/charts/monica/templates/_helpers.tpl index 91e1dea..cff5e1b 100644 --- a/charts/monica/templates/_helpers.tpl +++ b/charts/monica/templates/_helpers.tpl @@ -138,7 +138,7 @@ Create environment variables used to configure the monica container as well as t - name: DB_CONNECTION value: pgsql - name: DB_HOST - value: {{ template "postgresql.primary.fullname" .Subcharts.postgresql }} + value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }} - name: DB_DATABASE {{- if .Values.postgresql.auth.database }} value: {{ .Values.postgresql.auth.database | quote }} diff --git a/charts/monica/templates/deployment.yaml b/charts/monica/templates/deployment.yaml index 2cf7a69..6f8b8b3 100644 --- a/charts/monica/templates/deployment.yaml +++ b/charts/monica/templates/deployment.yaml @@ -204,7 +204,7 @@ spec: command: - "sh" - "-c" - - {{ printf "until mysql --host=%s-mariadb --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --execute=\"SELECT 1;\"; do echo waiting for mysql; sleep 2; done;" .Release.Name }} + - {{ printf "until mariadb --host=%s-mariadb --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --execute=\"SELECT 1;\"; do echo waiting for mysql; sleep 2; done;" .Release.Name }} {{- else if .Values.postgresql.enabled }} - name: postgresql-isready image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }} diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index 8e32a80..aec93a9 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -251,9 +251,12 @@ memcached: enabled: false auth: enabled: true + username: monica password: secret # existingSecret # existingSecretPasswordKey + containerSecurityContext: + readOnlyRootFilesystem: false ## ## Meilisearch chart configuration From 4d5b7b4e059d3731d823ba1ab2aaf0e492d762fd Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 19 Oct 2024 09:09:04 +0200 Subject: [PATCH 13/22] update --- .github/workflows/tests.yml | 4 ++-- charts/monica/templates/_helpers.tpl | 12 ++++++++++++ charts/monica/values.yaml | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ecbb142..7f34b86 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,7 +52,7 @@ jobs: # test the helm chart with all options - name: Redis and queue enabled - helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false --set=redis.enabled=true --set=memcached.enabled=true --set=cronjob.enabled=true --set=queue.enabled=true"' + helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false --set=monica.cacheStore=memcached --set=monica.queueConnection=redis --set=redis.enabled=true --set=memcached.enabled=true --set=cronjob.enabled=true --set=queue.enabled=true"' # test the helm chart with horizontal pod autoscaling enabled - name: Horizontal Pod Autoscaling enabled @@ -88,5 +88,5 @@ jobs: uses: helm/kind-action@v1 if: steps.list-changed.outputs.changed == 'true' - - name: Run chart-testing (install ${{ matrix.test_cases.name }}) + - name: Run chart-testing (install) run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} ${{ matrix.test_cases.helm_args }} diff --git a/charts/monica/templates/_helpers.tpl b/charts/monica/templates/_helpers.tpl index cff5e1b..78212f6 100644 --- a/charts/monica/templates/_helpers.tpl +++ b/charts/monica/templates/_helpers.tpl @@ -178,6 +178,18 @@ Create environment variables used to configure the monica container as well as t name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} {{- end }} +{{- if .Values.monica.cacheStore }} +- name: CACHE_STORE + value: {{ .Values.monica.cacheStore | quote }} +{{- end }} +{{- if .Values.monica.queueConnection }} +- name: QUEUE_CONNECTION + value: {{ .Values.monica.queueConnection | quote }} +{{- end }} +{{- if .Values.monica.sessionDriver }} +- name: SESSION_DRIVER + value: {{ .Values.monica.sessionDriver | quote }} +{{- end }} {{- if .Values.monica.mail.enabled }} - name: MAIL_MAILER value: smtp diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index aec93a9..66f059b 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -68,6 +68,9 @@ monica: # If web server is not binding default port, you can define it # containerPort: 8080 storagedir: /var/www/html/storage + cacheStore: # database, file, memcached, redis, dynamodb + queueConnection: # sync, database, beanstalkd, sqs, redis + sessionDriver: # file, cookie, database, apc, memcached, redis, array mail: enabled: false fromAddress: user From ca06f4480c505be1d9b5ab93d350c01acce058f0 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 19 Oct 2024 09:13:40 +0200 Subject: [PATCH 14/22] fix --- charts/monica/values.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index 66f059b..10e0d8c 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -68,9 +68,12 @@ monica: # If web server is not binding default port, you can define it # containerPort: 8080 storagedir: /var/www/html/storage - cacheStore: # database, file, memcached, redis, dynamodb - queueConnection: # sync, database, beanstalkd, sqs, redis - sessionDriver: # file, cookie, database, apc, memcached, redis, array + # Cache store: database, file, memcached, redis, dynamodb + cacheStore: + # Queue connection: sync, database, beanstalkd, sqs, redis + queueConnection: + # Session driver: file, cookie, database, apc, memcached, redis, array + sessionDriver: mail: enabled: false fromAddress: user From 8c8787bc0b2e1ab507468df23fcc0bdbe49360c0 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 19 Oct 2024 21:02:21 +0200 Subject: [PATCH 15/22] update --- .github/tests/default.yaml | 0 .github/tests/mariadb.yaml | 5 + .github/tests/postgresql.yaml | 5 + .github/tests/redis-queue.yaml | 28 ++ .github/workflows/tests.yml | 17 +- charts/monica/ci/.gitignore | 1 + charts/monica/templates/deployment.yaml | 423 +++++++++--------- charts/monica/templates/ingress.yaml | 56 +-- charts/monica/templates/nginx-config.yaml | 6 +- .../monica/templates/persistent-volume.yaml | 6 +- charts/monica/templates/service.yaml | 14 +- charts/monica/templates/tests/unit-tests.yaml | 4 +- charts/monica/values.yaml | 12 +- 13 files changed, 307 insertions(+), 270 deletions(-) create mode 100644 .github/tests/default.yaml create mode 100644 .github/tests/mariadb.yaml create mode 100644 .github/tests/postgresql.yaml create mode 100644 .github/tests/redis-queue.yaml create mode 100644 charts/monica/ci/.gitignore diff --git a/.github/tests/default.yaml b/.github/tests/default.yaml new file mode 100644 index 0000000..e69de29 diff --git a/.github/tests/mariadb.yaml b/.github/tests/mariadb.yaml new file mode 100644 index 0000000..3376aa5 --- /dev/null +++ b/.github/tests/mariadb.yaml @@ -0,0 +1,5 @@ +internalDatabase: + enabled: false + +mariadb: + enabled: true diff --git a/.github/tests/postgresql.yaml b/.github/tests/postgresql.yaml new file mode 100644 index 0000000..afeab0f --- /dev/null +++ b/.github/tests/postgresql.yaml @@ -0,0 +1,5 @@ +internalDatabase: + enabled: false + +postgresql: + enabled: true diff --git a/.github/tests/redis-queue.yaml b/.github/tests/redis-queue.yaml new file mode 100644 index 0000000..83e865c --- /dev/null +++ b/.github/tests/redis-queue.yaml @@ -0,0 +1,28 @@ +internalDatabase: + enabled: false + +mariadb: + enabled: true + +monica: + extraEnv: + - name: QUEUE_CONNECTION + value: redis + - name: CACHE_STORE + value: memcached + +cronjob: + enabled: true + +queue: + enabled: true + +redis: + enabled: true + architecture: standalone + master: + persistence: + enabled: false + +memcached: + enabled: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7f34b86..e47b3d1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,23 +40,22 @@ jobs: matrix: test_cases: # test the plain helm chart with nothing changed - - name: 'Default - no custom values' + - name: Default - no custom values # test the helm chart with postgresql subchart enabled - name: PostgreSQL enabled + file: postgresql.yaml helm_args: '--helm-extra-set-args "--set=postgresql.enabled=true --set=internalDatabase.enabled=false"' # test the helm chart with mariadb subchart enabled - name: Mariadb enabled + file: mariadb.yaml helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false"' # test the helm chart with all options - name: Redis and queue enabled - helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false --set=monica.cacheStore=memcached --set=monica.queueConnection=redis --set=redis.enabled=true --set=memcached.enabled=true --set=cronjob.enabled=true --set=queue.enabled=true"' - - # test the helm chart with horizontal pod autoscaling enabled - - name: Horizontal Pod Autoscaling enabled - helm_args: '--helm-extra-set-args "--set=hpa.enabled=true --set=hpa.minPods=2 --set=hpa.maxPods=3 --set=hpa.targetCPUUtilizationPercentage=75"' + file: redis-queue.yaml + helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false --set=cronjob.enabled=true --set=queue.enabled=true --set=monica.cacheStore=memcached --set=monica.queueConnection=redis --set=redis.enabled=true --set=redis.master.persistence.enabled=false --set=redis.architecture=standalone --set=memcached.enabled=true"' steps: - name: Checkout @@ -88,5 +87,9 @@ jobs: uses: helm/kind-action@v1 if: steps.list-changed.outputs.changed == 'true' + - name: Cp test case file + if: matrix.test_cases.file != '' + run: cp .github/tests/${{ matrix.test_cases.file }} charts/monica/ci/test-values.yaml + - name: Run chart-testing (install) - run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} ${{ matrix.test_cases.helm_args }} + run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} diff --git a/charts/monica/ci/.gitignore b/charts/monica/ci/.gitignore new file mode 100644 index 0000000..1e82fc7 --- /dev/null +++ b/charts/monica/ci/.gitignore @@ -0,0 +1 @@ +*.yaml diff --git a/charts/monica/templates/deployment.yaml b/charts/monica/templates/deployment.yaml index 6f8b8b3..bde45e0 100644 --- a/charts/monica/templates/deployment.yaml +++ b/charts/monica/templates/deployment.yaml @@ -5,16 +5,16 @@ metadata: labels: {{- include "monica.labels" . | nindent 4 }} {{- if .Values.deploymentLabels }} -{{ toYaml .Values.deploymentLabels | indent 4 }} + {{ toYaml .Values.deploymentLabels | indent 4 }} {{- end }} {{- if .Values.deploymentAnnotations }} annotations: -{{ toYaml .Values.deploymentAnnotations | indent 4 }} + {{ toYaml .Values.deploymentAnnotations | indent 4 }} {{- end }} spec: replicas: {{ .Values.replicaCount }} strategy: -{{ toYaml .Values.monica.strategy | indent 4 }} + {{ toYaml .Values.monica.strategy | indent 4 }} selector: matchLabels: {{- include "monica.selectorLabels" . | nindent 6 }} @@ -28,16 +28,16 @@ spec: {{- if .Values.memcached.enabled }} {{ template "monica.memcached.fullname" . }}-client: "true" {{- end }} - {{- if .Values.podLabels }} -{{ toYaml .Values.podLabels | indent 8 }} + {{- with .Values.podLabels }} + {{ toYaml . | indent 8 }} {{- end }} annotations: php-config-hash: {{ toJson .Values.monica.phpConfigs | sha256sum }} {{- if .Values.nginx.enabled }} nginx-config-hash: {{ print .Values.nginx.config.default "-" .Values.nginx.config.custom | sha256sum }} {{- end }} - {{- if .Values.podAnnotations }} -{{ toYaml .Values.podAnnotations | indent 8 }} + {{- with .Values.podAnnotations }} + {{ toYaml . | indent 8 }} {{- end }} spec: {{- if .Values.image.pullSecrets }} @@ -47,136 +47,139 @@ spec: {{- end }} {{- end }} containers: - - name: {{ .Chart.Name }} - image: {{ .Values.image.repository }}:{{ .Values.image.tag }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- if .Values.lifecycle }} - lifecycle: - {{- if .Values.lifecycle.postStartCommand }} - postStart: - exec: - command: - {{- toYaml .Values.lifecycle.postStartCommand | nindent 16 -}} - {{- end }} - {{- if .Values.lifecycle.preStopCommand }} - preStop: - exec: - command: - {{- toYaml .Values.lifecycle.preStopCommand | nindent 16 -}} - {{- end }} - {{- end }} - env: -{{- include "monica.env" . | indent 8 }} - ports: - - name: http - protocol: TCP - containerPort: {{ .Values.monica.containerPort | default "80" }} - resources: -{{ toYaml .Values.resources | indent 10 }} - {{- if .Values.cronjob.enabled }} - - name: {{ .Chart.Name }}-cron - image: {{ .Values.image.repository }}:{{ .Values.image.tag }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - command: [ 'cron.sh' ] - {{- if .Values.cronjob.lifecycle }} - lifecycle: - {{- if .Values.cronjob.lifecycle.postStartCommand }} - postStart: - exec: - command: - {{- toYaml .Values.cronjob.lifecycle.postStartCommand | nindent 16 -}} - {{- end }} - {{- if .Values.cronjob.lifecycle.preStopCommand }} - preStop: - exec: - command: - {{- toYaml .Values.cronjob.lifecycle.preStopCommand | nindent 16 -}} - {{- end }} - {{- end }} - env: -{{- include "monica.env" . | indent 8 }} - resources: -{{ toYaml .Values.resources | indent 10 }} - volumeMounts: -{{- include "monica.volumeMounts" . | trim | nindent 8 }} - {{- end }} - {{- if .Values.queue.enabled }} - - name: {{ .Chart.Name }}-queue - image: {{ .Values.image.repository }}:{{ .Values.image.tag }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - command: [ 'queue.sh' ] - {{- if .Values.queue.lifecycle }} - lifecycle: - {{- if .Values.queue.lifecycle.postStartCommand }} - postStart: - exec: - command: - {{- toYaml .Values.queue.lifecycle.postStartCommand | nindent 16 -}} - {{- end }} - {{- if .Values.queue.lifecycle.preStopCommand }} - preStop: - exec: - command: - {{- toYaml .Values.queue.lifecycle.preStopCommand | nindent 16 -}} - {{- end }} - {{- end }} - env: -{{- include "monica.env" . | indent 8 }} - resources: -{{ toYaml .Values.resources | indent 10 }} - volumeMounts: -{{- include "monica.volumeMounts" . | trim | nindent 8 }} - {{- end }} - {{- if .Values.nginx.enabled }} - - name: {{ .Chart.Name }}-nginx - image: {{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }} - imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} - ports: - - name: http - containerPort: {{ .Values.monica.containerPort | default "80" }} - protocol: TCP - {{- if .Values.livenessProbe.enabled }} - livenessProbe: - httpGet: - path: /status.php - port: http - httpHeaders: - - name: Host - value: {{ .Values.monica.host | quote }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - {{- end }} - {{- if .Values.readinessProbe.enabled }} - readinessProbe: - httpGet: - path: /status.php - port: http - httpHeaders: - - name: Host - value: {{ .Values.monica.host | quote }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - {{- end }} + - name: {{ .Chart.Name }} + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycle }} + lifecycle: + {{- if .Values.lifecycle.postStartCommand }} + postStart: + exec: + command: + {{- toYaml .Values.lifecycle.postStartCommand | nindent 18 -}} + {{- end }} + {{- if .Values.lifecycle.preStopCommand }} + preStop: + exec: + command: + {{- toYaml .Values.lifecycle.preStopCommand | nindent 18 -}} + {{- end }} + {{- end }} + env: + {{- include "monica.env" . | indent 12 }} + ports: + - name: http + protocol: TCP + containerPort: {{ .Values.monica.containerPort | default "80" }} + resources: + {{ toYaml .Values.resources | indent 12 }} + + {{- if .Values.cronjob.enabled }} + - name: {{ .Chart.Name }}-cron + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ 'cron.sh' ] + {{- if .Values.cronjob.lifecycle }} + lifecycle: + {{- if .Values.cronjob.lifecycle.postStartCommand }} + postStart: + exec: + command: + {{- toYaml .Values.cronjob.lifecycle.postStartCommand | nindent 18 -}} + {{- end }} + {{- if .Values.cronjob.lifecycle.preStopCommand }} + preStop: + exec: + command: + {{- toYaml .Values.cronjob.lifecycle.preStopCommand | nindent 18 -}} + {{- end }} + {{- end }}{{/* cronjob.lifecycle */}} + env: + {{- include "monica.env" . | indent 12 }} + resources: + {{ toYaml .Values.resources | indent 12 }} + volumeMounts: + {{- include "monica.volumeMounts" . | trim | nindent 12 }} + {{- end }}{{/* cronjob.enabled */}} + + {{- if .Values.queue.enabled }} + - name: {{ .Chart.Name }}-queue + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ 'queue.sh' ] + {{- if .Values.queue.lifecycle }} + lifecycle: + {{- if .Values.queue.lifecycle.postStartCommand }} + postStart: + exec: + command: + {{- toYaml .Values.queue.lifecycle.postStartCommand | nindent 18 -}} + {{- end }} + {{- if .Values.queue.lifecycle.preStopCommand }} + preStop: + exec: + command: + {{- toYaml .Values.queue.lifecycle.preStopCommand | nindent 18 -}} + {{- end }} + {{- end }} + env: + {{- include "monica.env" . | indent 12 }} + resources: + {{ toYaml .Values.resources | indent 12 }} + volumeMounts: + {{- include "monica.volumeMounts" . | trim | nindent 12 }} + {{- end }}{{/* queue.enabled */}} + + {{- if .Values.nginx.enabled }} + - name: {{ .Chart.Name }}-nginx + image: {{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }} + imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.monica.containerPort | default "80" }} + protocol: TCP + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /status.php + port: http + httpHeaders: + - name: Host + value: {{ .Values.monica.host | quote }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }}{{/* livenessProbe.enabled */}} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /status.php + port: http + httpHeaders: + - name: Host + value: {{ .Values.monica.host | quote }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }}{{/* readinessProbe.enabled */}} + resources: + {{ toYaml .Values.nginx.resources | indent 12 }} + volumeMounts: + {{- if .Values.persistence.enabled }} + - name: monica-storage + mountPath: {{ .Values.monica.datadir }} + {{- end }} + - name: monica-nginx-config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + {{- end }}{{/* nginx.enabled */}} - resources: -{{ toYaml .Values.nginx.resources | indent 10 }} - volumeMounts: - {{- if .Values.persistence.enabled }} - - name: monica-storage - mountPath: {{ .Values.monica.datadir }} - {{- end }} - - name: monica-nginx-config - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - {{- end }} {{- with .Values.monica.extraSidecarContainers }} - {{- toYaml . | nindent 6 }} + {{- toYaml . | nindent 6 }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -184,93 +187,93 @@ spec: {{- end }} {{- if or .Values.monica.extraInitContainers .Values.mariadb.enabled .Values.postgresql.enabled }} initContainers: - {{- if .Values.monica.extraInitContainers }} - {{- toYaml .Values.monica.extraInitContainers | nindent 8 }} - {{- end }} - {{- if .Values.mariadb.enabled }} - - name: mariadb-isalive - image: {{ .Values.mariadb.image.registry }}/{{ .Values.mariadb.image.repository }}:{{ .Values.mariadb.image.tag }} - env: - - name: MYSQL_USER - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - - name: MYSQL_PASSWORD - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} - command: - - "sh" - - "-c" - - {{ printf "until mariadb --host=%s-mariadb --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --execute=\"SELECT 1;\"; do echo waiting for mysql; sleep 2; done;" .Release.Name }} - {{- else if .Values.postgresql.enabled }} - - name: postgresql-isready - image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }} - env: - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - command: - - "sh" - - "-c" - - {{ printf "until pg_isready -h %s-postgresql -U ${POSTGRES_USER} ; do sleep 2 ; done" .Release.Name }} - {{- end }} - {{- end }} - {{- with .Values.affinity }} + {{- with .Values.monica.extraInitContainers }} + {{- toYaml . | nindent 8 }} + {{- end }} + + {{- if .Values.mariadb.enabled }} + - name: mariadb-isalive + image: {{ .Values.mariadb.image.registry | default "docker.io" }}/{{ .Values.mariadb.image.repository }}:{{ .Values.mariadb.image.tag }} + env: + - name: MYSQL_USER + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} + command: + - "sh" + - "-c" + - {{ printf "until mariadb --host=%s-mariadb --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --execute=\"SELECT 1;\"; do echo waiting for mysql; sleep 2; done;" .Release.Name }} + {{- else if .Values.postgresql.enabled }} + - name: postgresql-isready + image: {{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }} + env: + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} + - name: POSTGRES_HOST + value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }} + command: + - "sh" + - "-c" + - "until pg_isready -h ${POSTGRES_HOST} -U ${POSTGRES_USER} ; do sleep 2 ; done" + {{- end }} + {{- end }}{{/* end-if .Values.monica.extraInitContainers .Values.mariadb.enabled .Values.postgresql.enabled */}} + + {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} + {{- end }} + + {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} - volumes: - {{- if .Values.persistence.enabled }} - - name: monica-storage - persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "monica.fullname" . }}-storage{{- end }} - {{- end }} - {{- if .Values.monica.configs }} - - name: monica-config - configMap: - name: {{ template "monica.fullname" . }}-config - {{- end }} - {{- if .Values.monica.phpConfigs }} - - name: monica-phpconfig - configMap: - name: {{ template "monica.fullname" . }}-phpconfig {{- end }} - {{- if .Values.nginx.enabled }} - - name: monica-nginx-config - configMap: - name: {{ template "monica.fullname" . }}-nginxconfig - {{- end }} - {{- if .Values.monica.extraVolumes }} -{{ toYaml .Values.monica.extraVolumes | indent 6 }} - {{- end }} - {{- if .Values.nginx.enabled }} - # Will mount configuration files as www-data (id: 82) for monica - securityContext: - fsGroup: 82 - {{- if .Values.securityContext }} - {{- with .Values.securityContext }} - {{- toYaml . | nindent 8 }} + + volumes: + {{- if .Values.persistence.enabled }} + - name: monica-storage + persistentVolumeClaim: + claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "monica.fullname" . }}-storage{{- end }} + {{- end }} + {{- if .Values.monica.configs }} + - name: monica-config + configMap: + name: {{ template "monica.fullname" . }}-config {{- end }} + {{- if .Values.monica.phpConfigs }} + - name: monica-phpconfig + configMap: + name: {{ template "monica.fullname" . }}-phpconfig {{- end }} - {{- else }} - # Will mount configuration files as www-data (id: 33) for monica + {{- if .Values.nginx.enabled }} + - name: monica-nginx-config + configMap: + name: {{ template "monica.fullname" . }}-nginxconfig + {{- end }} + {{- with .Values.monica.extraVolumes }} + {{ toYaml . | indent 8 }} + {{- end }} + securityContext: - fsGroup: 33 - {{- if .Values.securityContext }} {{- with .Values.securityContext }} {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.nginx.enabled }} + # Will mount configuration files as www-data (id: 82) for monica + fsGroup: 82 + {{- else }} + # Will mount configuration files as www-data (id: 33) for monica + fsGroup: 33 {{- end }} - {{- end }} + {{- if .Values.serviceAccount.create }} serviceAccountName: {{ include "monica.serviceAccountName" . }} {{- end }} diff --git a/charts/monica/templates/ingress.yaml b/charts/monica/templates/ingress.yaml index 0511f8a..22f008e 100644 --- a/charts/monica/templates/ingress.yaml +++ b/charts/monica/templates/ingress.yaml @@ -5,39 +5,39 @@ metadata: name: {{ template "monica.fullname" . }} labels: {{- include "monica.labels" . | nindent 4 }} -{{- if .Values.ingress.labels }} -{{ toYaml .Values.ingress.labels | indent 4 }} -{{- end }} -{{- if .Values.ingress.annotations }} + {{- with .Values.ingress.labels }} + {{ toYaml . | indent 4 }} + {{- end }} + {{- if .Values.ingress.annotations }} annotations: -{{ toYaml .Values.ingress.annotations | indent 4 }} -{{- end }} + {{ toYaml .Values.ingress.annotations | indent 4 }} + {{- end }} spec: {{- if .Values.ingress.className }} ingressClassName: {{ .Values.ingress.className }} {{- end }} rules: - - {{- if .Values.monica.host }} - host: {{ .Values.monica.host }} - {{- end }} - http: - paths: - - path: {{ .Values.ingress.path }} - {{- if eq (include "monica.ingress.apiVersion" $) "networking.k8s.io/v1" }} - pathType: {{ .Values.ingress.pathType }} - {{- end }} - backend: - {{- if eq (include "monica.ingress.apiVersion" $) "networking.k8s.io/v1" }} - service: - name: {{ template "monica.fullname" . }} - port: - number: {{ .Values.service.port }} - {{- else }} - serviceName: {{ template "monica.fullname" . }} - servicePort: {{ .Values.service.port }} - {{- end }} -{{- if .Values.ingress.tls }} + - {{- if .Values.monica.host }} + host: {{ .Values.monica.host }} + {{- end }} + http: + paths: + - path: {{ .Values.ingress.path }} + {{- if eq (include "monica.ingress.apiVersion" $) "networking.k8s.io/v1" }} + pathType: {{ .Values.ingress.pathType }} + {{- end }} + backend: + {{- if eq (include "monica.ingress.apiVersion" $) "networking.k8s.io/v1" }} + service: + name: {{ template "monica.fullname" . }} + port: + number: {{ .Values.service.port }} + {{- else }} + serviceName: {{ template "monica.fullname" . }} + servicePort: {{ .Values.service.port }} + {{- end }} + {{- if .Values.ingress.tls }} tls: -{{ toYaml .Values.ingress.tls | indent 4 }} -{{- end -}} + {{ toYaml .Values.ingress.tls | indent 4 }} + {{- end }} {{- end }} diff --git a/charts/monica/templates/nginx-config.yaml b/charts/monica/templates/nginx-config.yaml index 3692131..8e018f6 100644 --- a/charts/monica/templates/nginx-config.yaml +++ b/charts/monica/templates/nginx-config.yaml @@ -168,7 +168,7 @@ data: } } } -{{- else }} -{{ .Values.nginx.config.custom | indent 4 }} -{{- end }} + {{- else }} + {{ .Values.nginx.config.custom | indent 4 }} + {{- end }} {{- end }} diff --git a/charts/monica/templates/persistent-volume.yaml b/charts/monica/templates/persistent-volume.yaml index 456787e..5c770eb 100644 --- a/charts/monica/templates/persistent-volume.yaml +++ b/charts/monica/templates/persistent-volume.yaml @@ -6,10 +6,10 @@ metadata: name: {{ template "monica.fullname" . }}-storage labels: {{- include "monica.labels" . | nindent 4 }} -{{- if .Values.persistence.annotations }} + {{- if .Values.persistence.annotations }} annotations: -{{ toYaml .Values.persistence.annotations | indent 4 }} -{{- end }} + {{ toYaml .Values.persistence.annotations | indent 4 }} + {{- end }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }} diff --git a/charts/monica/templates/service.yaml b/charts/monica/templates/service.yaml index 8b86d56..8210e19 100644 --- a/charts/monica/templates/service.yaml +++ b/charts/monica/templates/service.yaml @@ -10,12 +10,12 @@ spec: loadBalancerIP: {{ default "" .Values.service.loadBalancerIP }} {{- end }} ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - {{- if eq .Values.service.type "NodePort" }} - nodePort: {{ default "" .Values.service.nodePort}} - {{- end }} + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- if eq .Values.service.type "NodePort" }} + nodePort: {{ default "" .Values.service.nodePort }} + {{- end }} selector: {{- include "monica.selectorLabels" . | nindent 4 }} diff --git a/charts/monica/templates/tests/unit-tests.yaml b/charts/monica/templates/tests/unit-tests.yaml index c35b905..ab725ae 100644 --- a/charts/monica/templates/tests/unit-tests.yaml +++ b/charts/monica/templates/tests/unit-tests.yaml @@ -11,13 +11,13 @@ spec: serviceAccountName: {{ include "monica.serviceAccountName" . }} {{- if .Values.imagePullSecrets }} imagePullSecrets: - - name: {{ .Values.imagePullSecrets }} + - name: {{ .Values.imagePullSecrets }} {{- end }} containers: - name: unit-tests image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} - command: ['entrypoint-unittests.sh'] + command: ['/bin/sh', '-c', 'sleep 20 && entrypoint-unittests.sh'] env: {{- include "monica.env" . | indent 8 }} resources: diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index 10e0d8c..c568cec 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -68,12 +68,6 @@ monica: # If web server is not binding default port, you can define it # containerPort: 8080 storagedir: /var/www/html/storage - # Cache store: database, file, memcached, redis, dynamodb - cacheStore: - # Queue connection: sync, database, beanstalkd, sqs, redis - queueConnection: - # Session driver: file, cookie, database, apc, memcached, redis, array - sessionDriver: mail: enabled: false fromAddress: user @@ -119,8 +113,8 @@ monica: # image: busybox # command: [/bin/sh, -c, 'while ! test -f "/run/monica/data/monica.log"; do sleep 1; done; tail -n+1 -f /run/monica/data/monica.log'] # volumeMounts: - # - name: monica-storage - # mountPath: /run/monica/data + # - name: monica-storage + # mountPath: /run/monica/data # Extra mounts for the pods. Example shown is for connecting a legacy NFS volume # to monica pods in Kubernetes. This can then be configured in External Storage @@ -157,7 +151,6 @@ nginx: resources: {} - ## ## Internal database configuration (SQLite) ## @@ -166,7 +159,6 @@ internalDatabase: ## Database fullpath file name: /var/www/html/database/monica.sqlite - ## ## External database configuration ## From 37910abc5874a6f3e375a318536dd677759e367d Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 19 Oct 2024 23:28:35 +0200 Subject: [PATCH 16/22] update --- charts/monica/Chart.lock | 12 +-- charts/monica/Chart.yaml | 8 +- charts/monica/templates/_helpers.tpl | 42 ++++----- charts/monica/templates/db-secret.yaml | 15 ++-- charts/monica/templates/deployment.yaml | 86 +++++++++++-------- charts/monica/templates/ingress.yaml | 1 + charts/monica/templates/nginx-config.yaml | 1 + .../monica/templates/persistent-volume.yaml | 1 + charts/monica/templates/php-config.yaml | 1 + charts/monica/templates/secrets.yaml | 5 +- charts/monica/templates/service.yaml | 22 ++++- charts/monica/templates/serviceaccount.yaml | 1 + charts/monica/values.yaml | 12 +-- 13 files changed, 115 insertions(+), 92 deletions(-) diff --git a/charts/monica/Chart.lock b/charts/monica/Chart.lock index 0bb105b..b52ee03 100644 --- a/charts/monica/Chart.lock +++ b/charts/monica/Chart.lock @@ -1,18 +1,18 @@ dependencies: - name: postgresql - repository: https://charts.bitnami.com/bitnami + repository: oci://registry-1.docker.io/bitnamicharts version: 16.0.3 - name: mariadb - repository: https://charts.bitnami.com/bitnami + repository: oci://registry-1.docker.io/bitnamicharts version: 19.1.0 - name: redis - repository: https://charts.bitnami.com/bitnami + repository: oci://registry-1.docker.io/bitnamicharts version: 20.2.1 - name: memcached - repository: https://charts.bitnami.com/bitnami + repository: oci://registry-1.docker.io/bitnamicharts version: 7.5.1 - name: meilisearch repository: https://meilisearch.github.io/meilisearch-kubernetes version: 0.10.1 -digest: sha256:4a6e4bcfe5d0d9148a866e294c0c725325af8d28b406dbe3ea908d522b3a8132 -generated: "2024-10-18T11:30:25.190830123Z" +digest: sha256:3fb70271b7f30bc1a3072252b987b1941e768d3eb7bc26aefd0e18c9eaf7b841 +generated: "2024-10-19T23:24:58.299202579+02:00" diff --git a/charts/monica/Chart.yaml b/charts/monica/Chart.yaml index 4ef0fbc..c54af51 100644 --- a/charts/monica/Chart.yaml +++ b/charts/monica/Chart.yaml @@ -17,19 +17,19 @@ sources: dependencies: - name: postgresql version: 16.0.* - repository: https://charts.bitnami.com/bitnami + repository: oci://registry-1.docker.io/bitnamicharts condition: postgresql.enabled - name: mariadb version: 19.1.* - repository: https://charts.bitnami.com/bitnami + repository: oci://registry-1.docker.io/bitnamicharts condition: mariadb.enabled - name: redis version: 20.2.* - repository: https://charts.bitnami.com/bitnami + repository: oci://registry-1.docker.io/bitnamicharts condition: redis.enabled - name: memcached version: 7.5.* - repository: https://charts.bitnami.com/bitnami + repository: oci://registry-1.docker.io/bitnamicharts condition: memcached.enabled - name: meilisearch version: 0.10.* diff --git a/charts/monica/templates/_helpers.tpl b/charts/monica/templates/_helpers.tpl index 78212f6..e7af8dc 100644 --- a/charts/monica/templates/_helpers.tpl +++ b/charts/monica/templates/_helpers.tpl @@ -4,7 +4,7 @@ Expand the name of the chart. */}} {{- define "monica.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} +{{- end -}} {{/* Create a default fully qualified app name. @@ -22,14 +22,14 @@ If release name contains chart name it will be used as a full name. {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} {{- end }} {{- end }} -{{- end }} +{{- end -}} {{/* Create chart name and version as used by the chart label. */}} {{- define "monica.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} +{{- end -}} {{/* Common labels @@ -41,7 +41,7 @@ helm.sh/chart: {{ include "monica.chart" . }} app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} +{{- end -}} {{/* Selector labels @@ -50,7 +50,7 @@ Selector labels app.kubernetes.io/name: {{ include "monica.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: app -{{- end }} +{{- end -}} {{/* Create the name of the service account to use @@ -61,7 +61,7 @@ Create the name of the service account to use {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} -{{- end }} +{{- end -}} {{/* @@ -69,7 +69,7 @@ Create a default fully qualified redis app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "monica.redis.fullname" -}} -{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} +{{- printf "%s-redis" .Release.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -77,7 +77,7 @@ Create a default fully qualified meilisearch app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "monica.meilisearch.fullname" -}} -{{- printf "%s-%s" .Release.Name "meilisearch" | trunc 63 | trimSuffix "-" -}} +{{- printf "%s-meilisearch" .Release.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -85,7 +85,7 @@ Create a default fully qualified memcached app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "monica.memcached.fullname" -}} -{{- printf "%s-%s" .Release.Name "memcached" | trunc 63 | trimSuffix "-" -}} +{{- printf "%s-memcached" .Release.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- define "monica.ingress.apiVersion" -}} @@ -127,12 +127,12 @@ Create environment variables used to configure the monica container as well as t - name: DB_USERNAME valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - name: DB_PASSWORD valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} {{- else if .Values.postgresql.enabled }} - name: DB_CONNECTION @@ -148,12 +148,12 @@ Create environment variables used to configure the monica container as well as t - name: DB_USERNAME valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - name: DB_PASSWORD valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} {{- else }} {{- if eq .Values.externalDatabase.type "postgresql" }} @@ -170,26 +170,14 @@ Create environment variables used to configure the monica container as well as t - name: DB_USERNAME valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - name: DB_PASSWORD valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }} key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} {{- end }} -{{- if .Values.monica.cacheStore }} -- name: CACHE_STORE - value: {{ .Values.monica.cacheStore | quote }} -{{- end }} -{{- if .Values.monica.queueConnection }} -- name: QUEUE_CONNECTION - value: {{ .Values.monica.queueConnection | quote }} -{{- end }} -{{- if .Values.monica.sessionDriver }} -- name: SESSION_DRIVER - value: {{ .Values.monica.sessionDriver | quote }} -{{- end }} {{- if .Values.monica.mail.enabled }} - name: MAIL_MAILER value: smtp diff --git a/charts/monica/templates/db-secret.yaml b/charts/monica/templates/db-secret.yaml index 5ff6696..a8df7f4 100644 --- a/charts/monica/templates/db-secret.yaml +++ b/charts/monica/templates/db-secret.yaml @@ -1,22 +1,23 @@ {{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled .Values.postgresql.enabled }} {{- if not .Values.externalDatabase.existingSecret.enabled }} +--- apiVersion: v1 kind: Secret metadata: - name: {{ printf "%s-%s" .Release.Name "db" }} + name: {{ .Release.Name }}-db labels: {{- include "monica.labels" . | nindent 4 }} type: Opaque data: {{- if .Values.mariadb.enabled }} - db-password: {{ default "" .Values.mariadb.auth.password | b64enc | quote }} - db-username: {{ default "" .Values.mariadb.auth.username | b64enc | quote }} + db-password: {{ .Values.mariadb.auth.password | b64enc | quote }} + db-username: {{ .Values.mariadb.auth.username | b64enc | quote }} {{- else if .Values.postgresql.enabled }} - db-password: {{ default "" .Values.postgresql.global.postgresql.auth.password | b64enc | quote }} - db-username: {{ default "" .Values.postgresql.global.postgresql.auth.username | b64enc | quote }} + db-password: {{ .Values.postgresql.global.postgresql.auth.password | b64enc | quote }} + db-username: {{ .Values.postgresql.global.postgresql.auth.username | b64enc | quote }} {{- else }} - db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} - db-username: {{ default "" .Values.externalDatabase.user | b64enc | quote }} + db-password: {{ .Values.externalDatabase.password | b64enc | quote }} + db-username: {{ .Values.externalDatabase.user | b64enc | quote }} {{- end }} {{- end }} {{- end }} diff --git a/charts/monica/templates/deployment.yaml b/charts/monica/templates/deployment.yaml index bde45e0..e9fee14 100644 --- a/charts/monica/templates/deployment.yaml +++ b/charts/monica/templates/deployment.yaml @@ -1,15 +1,16 @@ +--- apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "monica.fullname" . }} labels: {{- include "monica.labels" . | nindent 4 }} - {{- if .Values.deploymentLabels }} - {{ toYaml .Values.deploymentLabels | indent 4 }} + {{- with .Values.deploymentLabels }} + {{ toYaml . | indent 4 }} {{- end }} - {{- if .Values.deploymentAnnotations }} + {{- with .Values.deploymentAnnotations }} annotations: - {{ toYaml .Values.deploymentAnnotations | indent 4 }} + {{ toYaml . | indent 4 }} {{- end }} spec: replicas: {{ .Values.replicaCount }} @@ -50,29 +51,33 @@ spec: - name: {{ .Chart.Name }} image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- if .Values.lifecycle }} + {{- with .Values.lifecycle }} lifecycle: - {{- if .Values.lifecycle.postStartCommand }} + {{- with .postStartCommand }} postStart: exec: command: - {{- toYaml .Values.lifecycle.postStartCommand | nindent 18 -}} - {{- end }} - {{- if .Values.lifecycle.preStopCommand }} + {{- toYaml . | nindent 18 }} + {{- end }} + {{- if .preStopCommand }} preStop: exec: command: - {{- toYaml .Values.lifecycle.preStopCommand | nindent 18 -}} - {{- end }} + {{- toYaml . | nindent 18 }} + {{- end }} {{- end }} env: {{- include "monica.env" . | indent 12 }} + {{- if not .Values.nginx.enabled }} ports: - name: http protocol: TCP containerPort: {{ .Values.monica.containerPort | default "80" }} + {{- end }} resources: {{ toYaml .Values.resources | indent 12 }} + volumeMounts: + {{- include "monica.volumeMounts" . | trim | nindent 12 }} {{- if .Values.cronjob.enabled }} - name: {{ .Chart.Name }}-cron @@ -85,13 +90,13 @@ spec: postStart: exec: command: - {{- toYaml .Values.cronjob.lifecycle.postStartCommand | nindent 18 -}} + {{- toYaml .Values.cronjob.lifecycle.postStartCommand | nindent 18 }} {{- end }} {{- if .Values.cronjob.lifecycle.preStopCommand }} preStop: exec: command: - {{- toYaml .Values.cronjob.lifecycle.preStopCommand | nindent 18 -}} + {{- toYaml .Values.cronjob.lifecycle.preStopCommand | nindent 18 }} {{- end }} {{- end }}{{/* cronjob.lifecycle */}} env: @@ -107,20 +112,20 @@ spec: image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: [ 'queue.sh' ] - {{- if .Values.queue.lifecycle }} + {{- with .Values.queue.lifecycle }} lifecycle: - {{- if .Values.queue.lifecycle.postStartCommand }} + {{- if .postStartCommand }} postStart: exec: command: - {{- toYaml .Values.queue.lifecycle.postStartCommand | nindent 18 -}} - {{- end }} - {{- if .Values.queue.lifecycle.preStopCommand }} + {{- toYaml . | nindent 18 }} + {{- end }} + {{- if .preStopCommand }} preStop: exec: command: - {{- toYaml .Values.queue.lifecycle.preStopCommand | nindent 18 -}} - {{- end }} + {{- toYaml . | nindent 18 }} + {{- end }} {{- end }} env: {{- include "monica.env" . | indent 12 }} @@ -136,36 +141,40 @@ spec: imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} ports: - name: http - containerPort: {{ .Values.monica.containerPort | default "80" }} + containerPort: {{ .Values.monica.containerPort | default "http" }} protocol: TCP - {{- if .Values.livenessProbe.enabled }} + {{- with .Values.livenessProbe }} + {{- if .enabled }} livenessProbe: httpGet: path: /status.php - port: http + port: {{ $.Values.nextcloud.containerPort | default "http" }} httpHeaders: - name: Host - value: {{ .Values.monica.host | quote }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + value: {{ $.Values.monica.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} {{- end }}{{/* livenessProbe.enabled */}} - {{- if .Values.readinessProbe.enabled }} + {{- end }} + {{- with .Values.readinessProbe }} + {{- if .enabled }} readinessProbe: httpGet: path: /status.php - port: http + port: {{ $.Values.nextcloud.containerPort | default "http" }} httpHeaders: - name: Host - value: {{ .Values.monica.host | quote }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + value: {{ $.Values.monica.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} {{- end }}{{/* readinessProbe.enabled */}} + {{- end }} resources: {{ toYaml .Values.nginx.resources | indent 12 }} volumeMounts: @@ -176,6 +185,9 @@ spec: - name: monica-nginx-config mountPath: /etc/nginx/nginx.conf subPath: nginx.conf + {{- with .Values.monica.extraVolumeMounts }} + {{ toYaml . | indent 12 }} + {{- end }} {{- end }}{{/* nginx.enabled */}} {{- with .Values.monica.extraSidecarContainers }} diff --git a/charts/monica/templates/ingress.yaml b/charts/monica/templates/ingress.yaml index 22f008e..3ce560d 100644 --- a/charts/monica/templates/ingress.yaml +++ b/charts/monica/templates/ingress.yaml @@ -1,4 +1,5 @@ {{- if .Values.ingress.enabled }} +--- apiVersion: {{ include "monica.ingress.apiVersion" . }} kind: Ingress metadata: diff --git a/charts/monica/templates/nginx-config.yaml b/charts/monica/templates/nginx-config.yaml index 8e018f6..47c24c5 100644 --- a/charts/monica/templates/nginx-config.yaml +++ b/charts/monica/templates/nginx-config.yaml @@ -1,4 +1,5 @@ {{- if .Values.nginx.enabled -}} +--- apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/monica/templates/persistent-volume.yaml b/charts/monica/templates/persistent-volume.yaml index 5c770eb..e16de83 100644 --- a/charts/monica/templates/persistent-volume.yaml +++ b/charts/monica/templates/persistent-volume.yaml @@ -1,5 +1,6 @@ {{- if .Values.persistence.enabled -}} {{- if not .Values.persistence.existingClaim -}} +--- kind: PersistentVolumeClaim apiVersion: v1 metadata: diff --git a/charts/monica/templates/php-config.yaml b/charts/monica/templates/php-config.yaml index 52106da..d32dcdb 100644 --- a/charts/monica/templates/php-config.yaml +++ b/charts/monica/templates/php-config.yaml @@ -1,4 +1,5 @@ {{- if .Values.monica.phpConfigs -}} +--- apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/monica/templates/secrets.yaml b/charts/monica/templates/secrets.yaml index ce270bf..3297671 100644 --- a/charts/monica/templates/secrets.yaml +++ b/charts/monica/templates/secrets.yaml @@ -1,6 +1,7 @@ {{- if not .Values.monica.existingSecret.enabled }} {{- $keyprevious := lookup "v1" "Secret" .Release.Namespace "appkey" }} {{- $appkey := "" }} +--- apiVersion: v1 kind: Secret metadata: @@ -16,7 +17,7 @@ data: appkey: {{ $appkey | b64enc }} {{- end }} {{- if .Values.monica.mail.enabled }} - smtp-username: {{ default "" .Values.monica.mail.smtp.username | b64enc | quote }} - smtp-password: {{ default "" .Values.monica.mail.smtp.password | b64enc | quote }} + smtp-username: {{ .Values.monica.mail.smtp.username | default "" | b64enc | quote }} + smtp-password: {{ .Values.monica.mail.smtp.password | default "" | b64enc | quote }} {{- end }} {{- end }} diff --git a/charts/monica/templates/service.yaml b/charts/monica/templates/service.yaml index 8210e19..f6d2bd3 100644 --- a/charts/monica/templates/service.yaml +++ b/charts/monica/templates/service.yaml @@ -1,21 +1,35 @@ +--- apiVersion: v1 kind: Service metadata: name: {{ template "monica.fullname" . }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} labels: {{- include "monica.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} - {{- if eq .Values.service.type "LoadBalancer" }} - loadBalancerIP: {{ default "" .Values.service.loadBalancerIP }} + {{- if (eq .Values.service.type "LoadBalancer") }} + {{- with .Values.service.loadBalancerIP }} + loadBalancerIP: {{ . }} + {{- end }} + {{- end }} + {{- with .Values.service.ipFamilies }} + ipFamilies: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.service.ipFamilyPolicy }} + ipFamilyPolicy: {{ . }} {{- end }} ports: - port: {{ .Values.service.port }} targetPort: http protocol: TCP name: http - {{- if eq .Values.service.type "NodePort" }} - nodePort: {{ default "" .Values.service.nodePort }} + {{- with .Values.service.nodePort }} + nodePort: {{ . }} {{- end }} selector: {{- include "monica.selectorLabels" . | nindent 4 }} diff --git a/charts/monica/templates/serviceaccount.yaml b/charts/monica/templates/serviceaccount.yaml index ed4cf04..080fcb6 100644 --- a/charts/monica/templates/serviceaccount.yaml +++ b/charts/monica/templates/serviceaccount.yaml @@ -1,4 +1,5 @@ {{- if .Values.serviceAccount.create -}} +--- apiVersion: v1 kind: ServiceAccount metadata: diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index c568cec..341eb84 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -116,8 +116,7 @@ monica: # - name: monica-storage # mountPath: /run/monica/data - # Extra mounts for the pods. Example shown is for connecting a legacy NFS volume - # to monica pods in Kubernetes. This can then be configured in External Storage + # Extra mounts for the pods. extraVolumes: # - name: nfs # nfs: @@ -126,7 +125,7 @@ monica: # readOnly: false extraVolumeMounts: # - name: nfs - # mountPath: "/legacy_data" + # mountPath: "/monica_data" # Extra secuurityContext parameters. For example you may need to define runAsNonRoot directive # extraSecurityContext: @@ -292,8 +291,11 @@ queue: service: type: ClusterIP port: 8080 - loadBalancerIP: nil - nodePort: nil + loadBalancerIP: "" + nodePort: + annotations: {} + ## Insert your annotations such as below + # test/test: pumuckel ## Enable persistence using Persistent Volume Claims ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ From fe5e7d18d4d2bbf4cf6aa299249cb9e895578a29 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 19 Oct 2024 23:36:55 +0200 Subject: [PATCH 17/22] update --- charts/monica/templates/_helpers.tpl | 8 ++++---- charts/monica/templates/deployment.yaml | 16 ++++++++-------- charts/monica/templates/ingress.yaml | 8 ++++---- charts/monica/templates/persistent-volume.yaml | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/charts/monica/templates/_helpers.tpl b/charts/monica/templates/_helpers.tpl index e7af8dc..2a8d922 100644 --- a/charts/monica/templates/_helpers.tpl +++ b/charts/monica/templates/_helpers.tpl @@ -102,8 +102,8 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this Create environment variables used to configure the monica container as well as the cron and schedule containers. */}} {{- define "monica.env" -}} -{{- if .Values.monica.extraEnv }} -{{ toYaml .Values.monica.extraEnv }} +{{- with .Values.monica.extraEnv }} +{{ toYaml . }} {{- end }} - name: APP_KEY valueFrom: @@ -262,8 +262,8 @@ Create volume mounts for the monica storagedir. - name: monica-storage mountPath: {{ .Values.monica.storagedir }} {{- end }} -{{- if .Values.monica.extraVolumeMounts }} -{{ toYaml .Values.monica.extraVolumeMounts }} +{{- with .Values.monica.extraVolumeMounts }} +{{ toYaml . }} {{- end }} {{- $nginxEnabled := .Values.nginx.enabled -}} {{- range $key, $value := .Values.monica.phpConfigs }} diff --git a/charts/monica/templates/deployment.yaml b/charts/monica/templates/deployment.yaml index e9fee14..659cc08 100644 --- a/charts/monica/templates/deployment.yaml +++ b/charts/monica/templates/deployment.yaml @@ -84,21 +84,21 @@ spec: image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: [ 'cron.sh' ] - {{- if .Values.cronjob.lifecycle }} + {{- with .Values.cronjob.lifecycle }} lifecycle: - {{- if .Values.cronjob.lifecycle.postStartCommand }} + {{- with .postStartCommand }} postStart: exec: command: - {{- toYaml .Values.cronjob.lifecycle.postStartCommand | nindent 18 }} - {{- end }} - {{- if .Values.cronjob.lifecycle.preStopCommand }} + {{- toYaml . | nindent 18 }} + {{- end }} + {{- if .preStopCommand }} preStop: exec: command: - {{- toYaml .Values.cronjob.lifecycle.preStopCommand | nindent 18 }} - {{- end }} - {{- end }}{{/* cronjob.lifecycle */}} + {{- toYaml . | nindent 18 }} + {{- end }} + {{- end }} env: {{- include "monica.env" . | indent 12 }} resources: diff --git a/charts/monica/templates/ingress.yaml b/charts/monica/templates/ingress.yaml index 3ce560d..0f31cea 100644 --- a/charts/monica/templates/ingress.yaml +++ b/charts/monica/templates/ingress.yaml @@ -9,9 +9,9 @@ metadata: {{- with .Values.ingress.labels }} {{ toYaml . | indent 4 }} {{- end }} - {{- if .Values.ingress.annotations }} + {{- with .Values.ingress.annotations }} annotations: - {{ toYaml .Values.ingress.annotations | indent 4 }} + {{ toYaml . | indent 4 }} {{- end }} spec: {{- if .Values.ingress.className }} @@ -37,8 +37,8 @@ spec: serviceName: {{ template "monica.fullname" . }} servicePort: {{ .Values.service.port }} {{- end }} - {{- if .Values.ingress.tls }} + {{- with .Values.ingress.tls }} tls: - {{ toYaml .Values.ingress.tls | indent 4 }} + {{ toYaml . | indent 4 }} {{- end }} {{- end }} diff --git a/charts/monica/templates/persistent-volume.yaml b/charts/monica/templates/persistent-volume.yaml index e16de83..64718ec 100644 --- a/charts/monica/templates/persistent-volume.yaml +++ b/charts/monica/templates/persistent-volume.yaml @@ -7,9 +7,9 @@ metadata: name: {{ template "monica.fullname" . }}-storage labels: {{- include "monica.labels" . | nindent 4 }} - {{- if .Values.persistence.annotations }} + {{- with .Values.persistence.annotations }} annotations: - {{ toYaml .Values.persistence.annotations | indent 4 }} + {{ toYaml . | indent 4 }} {{- end }} spec: accessModes: From ed5671c5ca37b6d1acc566778a64f5b8b4f8c4e5 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 19 Oct 2024 23:44:10 +0200 Subject: [PATCH 18/22] update --- .github/tests/default.yaml | 0 .github/workflows/tests.yml | 3 --- 2 files changed, 3 deletions(-) delete mode 100644 .github/tests/default.yaml diff --git a/.github/tests/default.yaml b/.github/tests/default.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e47b3d1..b3dcf6a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,17 +45,14 @@ jobs: # test the helm chart with postgresql subchart enabled - name: PostgreSQL enabled file: postgresql.yaml - helm_args: '--helm-extra-set-args "--set=postgresql.enabled=true --set=internalDatabase.enabled=false"' # test the helm chart with mariadb subchart enabled - name: Mariadb enabled file: mariadb.yaml - helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false"' # test the helm chart with all options - name: Redis and queue enabled file: redis-queue.yaml - helm_args: '--helm-extra-set-args "--set=mariadb.enabled=true --set=internalDatabase.enabled=false --set=cronjob.enabled=true --set=queue.enabled=true --set=monica.cacheStore=memcached --set=monica.queueConnection=redis --set=redis.enabled=true --set=redis.master.persistence.enabled=false --set=redis.architecture=standalone --set=memcached.enabled=true"' steps: - name: Checkout From ab5a21f72e7eda5e5bfc1fe67ced4cb2a1560e81 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sun, 20 Oct 2024 20:16:57 +0200 Subject: [PATCH 19/22] update --- .github/tests/mariadb.yaml | 5 -- .github/tests/meilisearch.yaml | 20 +++++++ .github/tests/postgresql.yaml | 5 -- .../tests/{redis-queue.yaml => redis.yaml} | 28 +++++----- .github/workflows/docs.yml | 24 +++++++++ .github/workflows/tests.yml | 14 +++-- charts/monica/templates/_helpers.tpl | 5 +- charts/monica/templates/deployment.yaml | 20 +++---- charts/monica/templates/tests/unit-tests.yaml | 7 ++- charts/monica/values.yaml | 54 ++++++++++--------- 10 files changed, 112 insertions(+), 70 deletions(-) delete mode 100644 .github/tests/mariadb.yaml create mode 100644 .github/tests/meilisearch.yaml delete mode 100644 .github/tests/postgresql.yaml rename .github/tests/{redis-queue.yaml => redis.yaml} (84%) create mode 100644 .github/workflows/docs.yml diff --git a/.github/tests/mariadb.yaml b/.github/tests/mariadb.yaml deleted file mode 100644 index 3376aa5..0000000 --- a/.github/tests/mariadb.yaml +++ /dev/null @@ -1,5 +0,0 @@ -internalDatabase: - enabled: false - -mariadb: - enabled: true diff --git a/.github/tests/meilisearch.yaml b/.github/tests/meilisearch.yaml new file mode 100644 index 0000000..49e2724 --- /dev/null +++ b/.github/tests/meilisearch.yaml @@ -0,0 +1,20 @@ +meilisearch: + enabled: true + +internalDatabase: + enabled: false + +mariadb: + enabled: true + +monica: + extraEnv: + - name: QUEUE_CONNECTION + value: database + - name: SCOUT_DRIVER + value: meilisearch + - name: SCOUT_QUEUE + value: "true" + + queue: + enabled: true diff --git a/.github/tests/postgresql.yaml b/.github/tests/postgresql.yaml deleted file mode 100644 index afeab0f..0000000 --- a/.github/tests/postgresql.yaml +++ /dev/null @@ -1,5 +0,0 @@ -internalDatabase: - enabled: false - -postgresql: - enabled: true diff --git a/.github/tests/redis-queue.yaml b/.github/tests/redis.yaml similarity index 84% rename from .github/tests/redis-queue.yaml rename to .github/tests/redis.yaml index 83e865c..4d4ae39 100644 --- a/.github/tests/redis-queue.yaml +++ b/.github/tests/redis.yaml @@ -1,9 +1,19 @@ +redis: + enabled: true + architecture: standalone + master: + persistence: + enabled: false + internalDatabase: enabled: false mariadb: enabled: true +memcached: + enabled: true + monica: extraEnv: - name: QUEUE_CONNECTION @@ -11,18 +21,8 @@ monica: - name: CACHE_STORE value: memcached -cronjob: - enabled: true - -queue: - enabled: true + cronjob: + enabled: true -redis: - enabled: true - architecture: standalone - master: - persistence: - enabled: false - -memcached: - enabled: true + queue: + enabled: true diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..af82f59 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,24 @@ +name: Helm docs + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run helm-docs + uses: losisin/helm-docs-github-action@v1 + + - name: Check if there is any file update needed + run: | + status=$(git status --porcelain) + if [ -n "$status" ]; then + echo -e "Waiting modifications:\n$status" + echo "::error::Changes waiting. Please run 'helm-docs' prior to your next commit." + exit -1 + fi diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b3dcf6a..cbb29e1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,15 +44,19 @@ jobs: # test the helm chart with postgresql subchart enabled - name: PostgreSQL enabled - file: postgresql.yaml + helm_args: '--set=internalDatabase.enabled=false --set=postgresql.enabled=true' # test the helm chart with mariadb subchart enabled - name: Mariadb enabled - file: mariadb.yaml + helm_args: '--set=internalDatabase.enabled=false --set=mariadb.enabled=true' - # test the helm chart with all options + # test the helm chart with redis, queue and more - name: Redis and queue enabled - file: redis-queue.yaml + file: redis.yaml + + # test the helm chart with meilisearch + - name: Meilisearch and queue enabled + file: meilisearch.yaml steps: - name: Checkout @@ -89,4 +93,4 @@ jobs: run: cp .github/tests/${{ matrix.test_cases.file }} charts/monica/ci/test-values.yaml - name: Run chart-testing (install) - run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} + run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args "--set=image.repository=ghcr.io/monicahq/monica-next --set=image.tag=main ${{ matrix.test_cases.helm_args }}" diff --git a/charts/monica/templates/_helpers.tpl b/charts/monica/templates/_helpers.tpl index 2a8d922..f78d539 100644 --- a/charts/monica/templates/_helpers.tpl +++ b/charts/monica/templates/_helpers.tpl @@ -242,15 +242,12 @@ Create environment variables used to configure the monica container as well as t {{- end }} {{- if .Values.meilisearch.enabled }} - name: MEILISEARCH_HOST - value: {{ template "monica.meilisearch.fullname" . }} -{{- if .Values.meilisearch.auth.existingMasterKeySecret }} + value: http://{{ template "monica.meilisearch.fullname" . }}:7700 - name: MEILISEARCH_KEY valueFrom: secretKeyRef: name: {{ template "monica.meilisearch.fullname" . }}-master-key key: MEILI_MASTER_KEY -{{- else }} -{{- end }} {{- end }} {{- end -}} diff --git a/charts/monica/templates/deployment.yaml b/charts/monica/templates/deployment.yaml index 659cc08..5e86003 100644 --- a/charts/monica/templates/deployment.yaml +++ b/charts/monica/templates/deployment.yaml @@ -25,7 +25,7 @@ spec: {{- include "monica.selectorLabels" . | nindent 8 }} {{- if .Values.redis.enabled }} {{ template "monica.redis.fullname" . }}-client: "true" - {{- end }} + {{- end }} {{- if .Values.memcached.enabled }} {{ template "monica.memcached.fullname" . }}-client: "true" {{- end }} @@ -41,11 +41,11 @@ spec: {{ toYaml . | indent 8 }} {{- end }} spec: - {{- if .Values.image.pullSecrets }} + {{- with .Values.image.pullSecrets }} imagePullSecrets: - {{- range .Values.image.pullSecrets }} + {{- range . }} - name: {{ . }} - {{- end }} + {{- end }} {{- end }} containers: - name: {{ .Chart.Name }} @@ -79,12 +79,12 @@ spec: volumeMounts: {{- include "monica.volumeMounts" . | trim | nindent 12 }} - {{- if .Values.cronjob.enabled }} + {{- if .Values.monica.cronjob.enabled }} - name: {{ .Chart.Name }}-cron image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: [ 'cron.sh' ] - {{- with .Values.cronjob.lifecycle }} + {{- with .Values.monica.cronjob.lifecycle }} lifecycle: {{- with .postStartCommand }} postStart: @@ -105,14 +105,14 @@ spec: {{ toYaml .Values.resources | indent 12 }} volumeMounts: {{- include "monica.volumeMounts" . | trim | nindent 12 }} - {{- end }}{{/* cronjob.enabled */}} + {{- end }}{{/* monica.cronjob.enabled */}} - {{- if .Values.queue.enabled }} + {{- if .Values.monica.queue.enabled }} - name: {{ .Chart.Name }}-queue image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: [ 'queue.sh' ] - {{- with .Values.queue.lifecycle }} + {{- with .Values.monica.queue.lifecycle }} lifecycle: {{- if .postStartCommand }} postStart: @@ -133,7 +133,7 @@ spec: {{ toYaml .Values.resources | indent 12 }} volumeMounts: {{- include "monica.volumeMounts" . | trim | nindent 12 }} - {{- end }}{{/* queue.enabled */}} + {{- end }}{{/* monica.queue.enabled */}} {{- if .Values.nginx.enabled }} - name: {{ .Chart.Name }}-nginx diff --git a/charts/monica/templates/tests/unit-tests.yaml b/charts/monica/templates/tests/unit-tests.yaml index ab725ae..9c2fe6f 100644 --- a/charts/monica/templates/tests/unit-tests.yaml +++ b/charts/monica/templates/tests/unit-tests.yaml @@ -1,4 +1,5 @@ {{- $fullName := include "monica.fullname" . -}} +--- apiVersion: v1 kind: Pod metadata: @@ -9,9 +10,11 @@ metadata: "helm.sh/hook": test spec: serviceAccountName: {{ include "monica.serviceAccountName" . }} - {{- if .Values.imagePullSecrets }} + {{- with .Values.image.pullSecrets }} imagePullSecrets: - - name: {{ .Values.imagePullSecrets }} + {{- range . }} + - name: {{ . }} + {{- end }} {{- end }} containers: - name: unit-tests diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index 341eb84..b59704b 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -1,6 +1,6 @@ image: - repository: ghcr.io/monicahq/monica-next - tag: main + repository: monica + tag: 5.0-apache pullPolicy: IfNotPresent # pullSecrets: # - myRegistrKeySecretName @@ -134,6 +134,31 @@ monica: # runAsNonRoot: true # readOnlyRootFilesystem: true + ## + ## Cronjob to execute monica scheduled tasks + ## + cronjob: + enabled: false + + # Allow configuration of lifecycle hooks + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ + lifecycle: {} + # postStartCommand: [] + # preStopCommand: [] + + ## + ## queue job to execute monica background tasks + ## Use in addition to a `QUEUE_CONNECTION` variable + ## + queue: + enabled: false + + # Allow configuration of lifecycle hooks + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ + lifecycle: {} + # postStartCommand: [] + # preStopCommand: [] + nginx: ## You need to set an fpm version of the image for monica if you want to use nginx! enabled: false @@ -264,29 +289,8 @@ meilisearch: environment: MEILI_ENV: production # MEILI_MASTER_KEY - auth: - # existingMasterKeySecret - -## Cronjob to execute monica scheduled tasks -cronjob: - enabled: false - - # Allow configuration of lifecycle hooks - # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ - lifecycle: {} - # postStartCommand: [] - # preStopCommand: [] - - -## queue job to execute monica background tasks -queue: - enabled: false - - # Allow configuration of lifecycle hooks - # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ - lifecycle: {} - # postStartCommand: [] - # preStopCommand: [] + # auth: + # existingMasterKeySecret service: type: ClusterIP From 4828ecabd71fb2e29e4fb2c98526ee80431677a5 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sun, 20 Oct 2024 20:30:32 +0200 Subject: [PATCH 20/22] update --- .pre-commit-config.yaml | 5 ++ charts/monica/README.md | 131 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..befe931 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/norwoodj/helm-docs + rev: v1.14.2 + hooks: + - id: helm-docs diff --git a/charts/monica/README.md b/charts/monica/README.md index e69de29..0e5e858 100644 --- a/charts/monica/README.md +++ b/charts/monica/README.md @@ -0,0 +1,131 @@ +# monica + +![Version: 1.0.7](https://img.shields.io/badge/Version-1.0.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.0.0](https://img.shields.io/badge/AppVersion-5.0.0-informational?style=flat-square) + +A Helm chart for Kubernetes to install Monica + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| MonicaHQ | | | + +## Source Code + +* +* + +## Requirements + +Kubernetes: `>=1.16.0-0` + +| Repository | Name | Version | +|------------|------|---------| +| https://meilisearch.github.io/meilisearch-kubernetes | meilisearch | 0.10.* | +| oci://registry-1.docker.io/bitnamicharts | mariadb | 19.1.* | +| oci://registry-1.docker.io/bitnamicharts | memcached | 7.5.* | +| oci://registry-1.docker.io/bitnamicharts | postgresql | 16.0.* | +| oci://registry-1.docker.io/bitnamicharts | redis | 20.2.* | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| deploymentAnnotations | object | `{}` | | +| externalDatabase.database | string | `"monica"` | | +| externalDatabase.enabled | bool | `false` | | +| externalDatabase.existingSecret.enabled | bool | `false` | | +| externalDatabase.host | string | `nil` | | +| externalDatabase.password | string | `"secret"` | | +| externalDatabase.type | string | `"mysql"` | | +| externalDatabase.user | string | `"monica"` | | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"monica"` | | +| image.tag | string | `"5.0-apache"` | | +| ingress.annotations | object | `{}` | | +| ingress.enabled | bool | `false` | | +| ingress.labels | object | `{}` | | +| ingress.path | string | `"/"` | | +| ingress.pathType | string | `"Prefix"` | | +| internalDatabase.enabled | bool | `true` | | +| internalDatabase.name | string | `"/var/www/html/database/monica.sqlite"` | | +| lifecycle | object | `{}` | | +| mariadb.architecture | string | `"standalone"` | | +| mariadb.auth.database | string | `"monica"` | | +| mariadb.auth.password | string | `"secret"` | | +| mariadb.auth.username | string | `"monica"` | | +| mariadb.enabled | bool | `false` | | +| mariadb.primary.persistence.accessMode | string | `"ReadWriteOnce"` | | +| mariadb.primary.persistence.enabled | bool | `false` | | +| mariadb.primary.persistence.size | string | `"8Gi"` | | +| meilisearch.enabled | bool | `false` | | +| meilisearch.environment.MEILI_ENV | string | `"production"` | | +| memcached.auth.enabled | bool | `true` | | +| memcached.auth.password | string | `"secret"` | | +| memcached.auth.username | string | `"monica"` | | +| memcached.containerSecurityContext.readOnlyRootFilesystem | bool | `false` | | +| memcached.enabled | bool | `false` | | +| monica.cronjob.enabled | bool | `false` | | +| monica.cronjob.lifecycle | object | `{}` | | +| monica.existingSecret.enabled | bool | `false` | | +| monica.extraEnv | string | `nil` | | +| monica.extraInitContainers | list | `[]` | | +| monica.extraSidecarContainers | list | `[]` | | +| monica.extraVolumeMounts | string | `nil` | | +| monica.extraVolumes | string | `nil` | | +| monica.host | string | `"monica.kube.home"` | | +| monica.mail.enabled | bool | `false` | | +| monica.mail.fromAddress | string | `"user"` | | +| monica.mail.replyToAddress | string | `"user"` | | +| monica.mail.smtp.encryption | string | `"tls"` | | +| monica.mail.smtp.host | string | `"domain.com"` | | +| monica.mail.smtp.password | string | `"pass"` | | +| monica.mail.smtp.port | int | `465` | | +| monica.mail.smtp.username | string | `"user"` | | +| monica.phpConfigs | object | `{}` | | +| monica.queue.enabled | bool | `false` | | +| monica.queue.lifecycle | object | `{}` | | +| monica.storagedir | string | `"/var/www/html/storage"` | | +| monica.strategy.type | string | `"Recreate"` | | +| nameOverride | string | `""` | | +| nginx.config.default | bool | `true` | | +| nginx.enabled | bool | `false` | | +| nginx.image.pullPolicy | string | `"IfNotPresent"` | | +| nginx.image.repository | string | `"nginx"` | | +| nginx.image.tag | string | `"alpine"` | | +| nginx.resources | object | `{}` | | +| nodeSelector | object | `{}` | | +| persistence.accessMode | string | `"ReadWriteOnce"` | | +| persistence.annotations | object | `{}` | | +| persistence.enabled | bool | `false` | | +| persistence.size | string | `"4Gi"` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| postgresql.enabled | bool | `false` | | +| postgresql.global.postgresql.auth.database | string | `"monica"` | | +| postgresql.global.postgresql.auth.password | string | `"secret"` | | +| postgresql.global.postgresql.auth.username | string | `"monica"` | | +| postgresql.primary.persistence.enabled | bool | `false` | | +| redis.auth.enabled | bool | `true` | | +| redis.auth.password | string | `"secret"` | | +| redis.enabled | bool | `false` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| service.annotations | object | `{}` | | +| service.loadBalancerIP | string | `""` | | +| service.nodePort | string | `nil` | | +| service.port | int | `8080` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| tests.unitTests.resources.limits.cpu | string | `"200m"` | | +| tests.unitTests.resources.limits.memory | string | `"256Mi"` | | +| tests.unitTests.resources.requests.cpu | string | `"100m"` | | +| tests.unitTests.resources.requests.memory | string | `"128Mi"` | | +| tolerations | list | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) From 9251eb15cf10a8f00f4f8a87137655ba0389b4c3 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sun, 20 Oct 2024 20:53:06 +0200 Subject: [PATCH 21/22] up --- charts/monica/README.md | 4 ++-- charts/monica/values.yaml | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/charts/monica/README.md b/charts/monica/README.md index 0e5e858..0e34662 100644 --- a/charts/monica/README.md +++ b/charts/monica/README.md @@ -42,8 +42,8 @@ Kubernetes: `>=1.16.0-0` | externalDatabase.user | string | `"monica"` | | | fullnameOverride | string | `""` | | | image.pullPolicy | string | `"IfNotPresent"` | | -| image.repository | string | `"monica"` | | -| image.tag | string | `"5.0-apache"` | | +| image.repository | string | `"ghcr.io/monicahq/monica-next"` | | +| image.tag | string | `"main"` | | | ingress.annotations | object | `{}` | | | ingress.enabled | bool | `false` | | | ingress.labels | object | `{}` | | diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index b59704b..e84ab9d 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -1,6 +1,8 @@ image: - repository: monica - tag: 5.0-apache + repository: ghcr.io/monicahq/monica-next + tag: main + # repository: monica + # tag: 5.0-apache pullPolicy: IfNotPresent # pullSecrets: # - myRegistrKeySecretName From 3ccc0c2d6dedf5db0b965db653f30e63f61c959e Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sun, 20 Oct 2024 21:13:48 +0200 Subject: [PATCH 22/22] update --- charts/monica/Chart.yaml | 6 ++++-- charts/monica/README.md | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/charts/monica/Chart.yaml b/charts/monica/Chart.yaml index c54af51..4b94e6a 100644 --- a/charts/monica/Chart.yaml +++ b/charts/monica/Chart.yaml @@ -8,12 +8,14 @@ icon: https://www.monicahq.com/favicon.ico maintainers: - name: MonicaHQ url: https://github.com/monicahq/monica + - name: asbiin + email: alexis@saettler.org keywords: - crm kubeVersion: ">=1.16.0-0" sources: - - https://github.com/monicahq/monica - - https://hub.docker.com/_/monica + - https://github.com/monicahq/helm + - https://github.com/monicahq/docker dependencies: - name: postgresql version: 16.0.* diff --git a/charts/monica/README.md b/charts/monica/README.md index 0e34662..f57f073 100644 --- a/charts/monica/README.md +++ b/charts/monica/README.md @@ -9,11 +9,12 @@ A Helm chart for Kubernetes to install Monica | Name | Email | Url | | ---- | ------ | --- | | MonicaHQ | | | +| asbiin | | | ## Source Code -* -* +* +* ## Requirements