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/redis.yaml b/.github/tests/redis.yaml new file mode 100644 index 0000000..4d4ae39 --- /dev/null +++ b/.github/tests/redis.yaml @@ -0,0 +1,28 @@ +redis: + enabled: true + architecture: standalone + master: + persistence: + enabled: false + +internalDatabase: + enabled: false + +mariadb: + enabled: true + +memcached: + enabled: true + +monica: + extraEnv: + - name: QUEUE_CONNECTION + value: redis + - name: CACHE_STORE + value: memcached + + cronjob: + 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/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 56146e4..cbb29e1 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 }} @@ -29,10 +29,35 @@ 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 + name: Helm tests (${{ matrix.test_cases.name }}) + + 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: '--set=internalDatabase.enabled=false --set=postgresql.enabled=true' + + # test the helm chart with mariadb subchart enabled + - name: Mariadb enabled + helm_args: '--set=internalDatabase.enabled=false --set=mariadb.enabled=true' + + # test the helm chart with redis, queue and more + - name: Redis and queue enabled + file: redis.yaml + + # test the helm chart with meilisearch + - name: Meilisearch and queue enabled + file: meilisearch.yaml + steps: - name: Checkout uses: actions/checkout@v4 @@ -40,11 +65,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 }} @@ -54,7 +79,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 --target-branch ${{ github.event.repository.default_branch }}) if [[ -n "$changed" ]]; then echo "changed=true" >> $GITHUB_OUTPUT fi @@ -63,5 +88,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 + 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/.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/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..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 - version: 11.6.26 + repository: oci://registry-1.docker.io/bitnamicharts + version: 16.0.3 - name: mariadb - repository: https://charts.bitnami.com/bitnami - version: 11.0.14 + repository: oci://registry-1.docker.io/bitnamicharts + version: 19.1.0 - name: redis - repository: https://charts.bitnami.com/bitnami - version: 16.12.3 + repository: oci://registry-1.docker.io/bitnamicharts + version: 20.2.1 - name: memcached - repository: https://charts.bitnami.com/bitnami - version: 6.3.2 + repository: oci://registry-1.docker.io/bitnamicharts + 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:3fb70271b7f30bc1a3072252b987b1941e768d3eb7bc26aefd0e18c9eaf7b841 +generated: "2024-10-19T23:24:58.299202579+02:00" diff --git a/charts/monica/Chart.yaml b/charts/monica/Chart.yaml index cb4df76..4b94e6a 100644 --- a/charts/monica/Chart.yaml +++ b/charts/monica/Chart.yaml @@ -2,36 +2,38 @@ apiVersion: v2 name: monica description: A Helm chart for Kubernetes to install Monica type: application -version: 1.0.6 -appVersion: "1.0.0" +version: 1.0.7 +appVersion: "5.0.0" 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: 11.6.* - repository: https://charts.bitnami.com/bitnami + version: 16.0.* + repository: oci://registry-1.docker.io/bitnamicharts condition: postgresql.enabled - name: mariadb - version: 11.0.* - repository: https://charts.bitnami.com/bitnami + version: 19.1.* + repository: oci://registry-1.docker.io/bitnamicharts condition: mariadb.enabled - name: redis - version: 16.12.* - repository: https://charts.bitnami.com/bitnami + version: 20.2.* + repository: oci://registry-1.docker.io/bitnamicharts condition: redis.enabled - name: memcached - version: 6.3.* - repository: https://charts.bitnami.com/bitnami + version: 7.5.* + repository: oci://registry-1.docker.io/bitnamicharts condition: memcached.enabled - name: meilisearch - version: 0.1.* + version: 0.10.* repository: https://meilisearch.github.io/meilisearch-kubernetes condition: meilisearch.enabled diff --git a/charts/monica/README.md b/charts/monica/README.md index e69de29..f57f073 100644 --- a/charts/monica/README.md +++ b/charts/monica/README.md @@ -0,0 +1,132 @@ +# 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 | | | +| asbiin | | | + +## 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 | `"ghcr.io/monicahq/monica-next"` | | +| image.tag | string | `"main"` | | +| 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) 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/_helpers.tpl b/charts/monica/templates/_helpers.tpl index 91e1dea..f78d539 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" -}} @@ -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: @@ -127,18 +127,18 @@ 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 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 }} @@ -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,12 +170,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" }} {{- end }} {{- if .Values.monica.mail.enabled }} @@ -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 -}} @@ -262,8 +259,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/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 2cf7a69..5e86003 100644 --- a/charts/monica/templates/deployment.yaml +++ b/charts/monica/templates/deployment.yaml @@ -1,20 +1,21 @@ +--- 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 }} strategy: -{{ toYaml .Values.monica.strategy | indent 4 }} + {{ toYaml .Values.monica.strategy | indent 4 }} selector: matchLabels: {{- include "monica.selectorLabels" . | nindent 6 }} @@ -24,159 +25,173 @@ 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 }} - {{- 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 }} + {{- with .Values.image.pullSecrets }} imagePullSecrets: - {{- range .Values.image.pullSecrets }} + {{- range . }} - name: {{ . }} - {{- 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 }} + containers: + - name: {{ .Chart.Name }} + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.lifecycle }} + lifecycle: + {{- with .postStartCommand }} + postStart: + exec: + command: + {{- toYaml . | nindent 18 }} + {{- end }} + {{- if .preStopCommand }} + preStop: + exec: + command: + {{- 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.monica.cronjob.enabled }} + - name: {{ .Chart.Name }}-cron + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ 'cron.sh' ] + {{- with .Values.monica.cronjob.lifecycle }} + lifecycle: + {{- with .postStartCommand }} + postStart: + exec: + command: + {{- toYaml . | nindent 18 }} + {{- end }} + {{- if .preStopCommand }} + preStop: + exec: + command: + {{- toYaml . | nindent 18 }} + {{- end }} + {{- end }} + env: + {{- include "monica.env" . | indent 12 }} + resources: + {{ toYaml .Values.resources | indent 12 }} + volumeMounts: + {{- include "monica.volumeMounts" . | trim | nindent 12 }} + {{- end }}{{/* monica.cronjob.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.monica.queue.lifecycle }} + lifecycle: + {{- if .postStartCommand }} + postStart: + exec: + command: + {{- toYaml . | nindent 18 }} + {{- end }} + {{- if .preStopCommand }} + preStop: + exec: + command: + {{- toYaml . | nindent 18 }} + {{- end }} + {{- end }} + env: + {{- include "monica.env" . | indent 12 }} + resources: + {{ toYaml .Values.resources | indent 12 }} + volumeMounts: + {{- include "monica.volumeMounts" . | trim | nindent 12 }} + {{- end }}{{/* monica.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 "http" }} + protocol: TCP + {{- with .Values.livenessProbe }} + {{- if .enabled }} + livenessProbe: + httpGet: + path: /status.php + port: {{ $.Values.nextcloud.containerPort | default "http" }} + httpHeaders: + - name: Host + value: {{ $.Values.monica.host | quote }} + initialDelaySeconds: {{ .initialDelaySeconds }} + periodSeconds: {{ .periodSeconds }} + timeoutSeconds: {{ .timeoutSeconds }} + successThreshold: {{ .successThreshold }} + failureThreshold: {{ .failureThreshold }} + {{- end }}{{/* livenessProbe.enabled */}} + {{- end }} + {{- with .Values.readinessProbe }} + {{- if .enabled }} + readinessProbe: + httpGet: + path: /status.php + port: {{ $.Values.nextcloud.containerPort | default "http" }} + httpHeaders: + - name: Host + 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: + {{- if .Values.persistence.enabled }} + - name: monica-storage + mountPath: {{ .Values.monica.datadir }} + {{- end }} + - name: monica-nginx-config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + {{- with .Values.monica.extraVolumeMounts }} + {{ toYaml . | indent 12 }} + {{- end }} + {{- 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 +199,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 mysql --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 }} + {{- if .Values.nginx.enabled }} + - name: monica-nginx-config + configMap: + name: {{ template "monica.fullname" . }}-nginxconfig {{- end }} + {{- with .Values.monica.extraVolumes }} + {{ toYaml . | indent 8 }} {{- end }} - {{- else }} - # Will mount configuration files as www-data (id: 33) for monica + 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..0f31cea 100644 --- a/charts/monica/templates/ingress.yaml +++ b/charts/monica/templates/ingress.yaml @@ -1,43 +1,44 @@ {{- if .Values.ingress.enabled }} +--- apiVersion: {{ include "monica.ingress.apiVersion" . }} kind: Ingress 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 }} + {{- with .Values.ingress.annotations }} annotations: -{{ toYaml .Values.ingress.annotations | indent 4 }} -{{- end }} + {{ toYaml . | 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 }} + {{- with .Values.ingress.tls }} tls: -{{ toYaml .Values.ingress.tls | indent 4 }} -{{- end -}} + {{ toYaml . | indent 4 }} + {{- end }} {{- end }} diff --git a/charts/monica/templates/nginx-config.yaml b/charts/monica/templates/nginx-config.yaml index 3692131..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: @@ -168,7 +169,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..64718ec 100644 --- a/charts/monica/templates/persistent-volume.yaml +++ b/charts/monica/templates/persistent-volume.yaml @@ -1,15 +1,16 @@ {{- if .Values.persistence.enabled -}} {{- if not .Values.persistence.existingClaim -}} +--- kind: PersistentVolumeClaim apiVersion: v1 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 }} -{{- end }} + {{ toYaml . | indent 4 }} + {{- end }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }} 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 8b86d56..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}} - {{- end }} + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- 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/templates/tests/unit-tests.yaml b/charts/monica/templates/tests/unit-tests.yaml index c35b905..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,15 +10,17 @@ 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 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 8e32a80..e84ab9d 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -1,6 +1,8 @@ image: repository: ghcr.io/monicahq/monica-next tag: main + # repository: monica + # tag: 5.0-apache pullPolicy: IfNotPresent # pullSecrets: # - myRegistrKeySecretName @@ -113,11 +115,10 @@ 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 + # Extra mounts for the pods. extraVolumes: # - name: nfs # nfs: @@ -126,7 +127,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: @@ -135,6 +136,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 @@ -151,7 +177,6 @@ nginx: resources: {} - ## ## Internal database configuration (SQLite) ## @@ -160,7 +185,6 @@ internalDatabase: ## Database fullpath file name: /var/www/html/database/monica.sqlite - ## ## External database configuration ## @@ -251,9 +275,12 @@ memcached: enabled: false auth: enabled: true + username: monica password: secret # existingSecret # existingSecretPasswordKey + containerSecurityContext: + readOnlyRootFilesystem: false ## ## Meilisearch chart configuration @@ -264,35 +291,17 @@ 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 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/ diff --git a/ct.yaml b/ct.yaml index f237d53..2a086f8 100644 --- a/ct.yaml +++ b/ct.yaml @@ -1,6 +1,4 @@ remote: origin -helm-extra-args: --timeout 600s -target-branch: main chart-dirs: - charts chart-repos: