From a062b92c5b97e04a95ba05037f0cca70a6b2f7c5 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sun, 27 Oct 2024 14:01:44 +0100 Subject: [PATCH 1/6] Update Chart documentation --- README.md | 4 +- charts/monica/Chart.yaml | 19 +- charts/monica/README.md | 337 +++++++++++++++++++++++---------- charts/monica/README.md.gotmpl | 157 +++++++++++++++ charts/monica/values.yaml | 198 +++++++++++++------ 5 files changed, 542 insertions(+), 173 deletions(-) create mode 100644 charts/monica/README.md.gotmpl diff --git a/README.md b/README.md index f461f86..58813da 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # Monica Helm Charts +[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/monica)](https://artifacthub.io/packages/search?repo=monica) + [Helm](https://helm.sh) repo for different charts related to Monica which can be installed on [Kubernetes](https://kubernetes.io) ## Add Helm repository To install the repo just run: -```bash +```console helm repo add monica https://monicahq.github.io/helm/ helm repo update ``` diff --git a/charts/monica/Chart.yaml b/charts/monica/Chart.yaml index 90e6bdf..d82b930 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.11 +version: 1.0.12 appVersion: "5.0.0" icon: https://raw.githubusercontent.com/monicahq/monica/aa98c09/public/img/favicon.svg maintainers: @@ -12,6 +12,9 @@ maintainers: email: alexis@saettler.org keywords: - crm + - prm + - social + - laravel kubeVersion: ">=1.16.0-0" sources: - https://github.com/monicahq/helm @@ -61,16 +64,4 @@ annotations: url: https://github.com/monicahq/monica artifacthub.io/changes: | - kind: changed - description: Use a CronJob for the cron job instead of a container - - kind: changed - description: Use a DaemonSet for the queue instead of a container - - kind: fixed - description: Fix static file rendering (css, js, ...) for nginx using and emptydir - - kind: fixed - description: Fixed hpa test value - - kind: fixed - description: Fixed phpConfigs rendering - - kind: added - description: Added a rbac.create option - - kind: added - description: Added a monica.queue.priorityClassName option + description: Update chart documentation diff --git a/charts/monica/README.md b/charts/monica/README.md index cac811b..6204809 100644 --- a/charts/monica/README.md +++ b/charts/monica/README.md @@ -1,9 +1,28 @@ # monica -![Version: 1.0.11](https://img.shields.io/badge/Version-1.0.11-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) +![Version: 1.0.12](https://img.shields.io/badge/Version-1.0.12-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 +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +helm repo add monica https://monicahq.github.io/helm/ +helm install my-release monica/monica +``` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + ## Maintainers | Name | Email | Url | @@ -31,127 +50,249 @@ Kubernetes: `>=1.16.0-0` | 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 | `""` | | +| affinity | object | `{}` | Affinity for pod assignment | +| deploymentAnnotations | object | `{}` | Annotations to be added at 'service' level | +| externalDatabase.database | string | `"monica"` | Database name | +| externalDatabase.enabled | bool | `false` | Enable external database | +| externalDatabase.existingSecret.enabled | bool | `false` | Use an existing secret. If enabled set: `secretName`, `usernameKey`, `passwordKey` | +| externalDatabase.host | string | `nil` | Database host | +| externalDatabase.password | string | `"secret"` | Database password | +| externalDatabase.type | string | `"mysql"` | Database type. Supported database engines: `mysql` or `postgresql` | +| externalDatabase.user | string | `"monica"` | Database user | +| fullnameOverride | string | `""` | Override the fullname of the chart | | hpa.cputhreshold | int | `60` | | -| hpa.enabled | bool | `false` | | +| hpa.enabled | bool | `false` | Enable Horizontal Pod Autoscaler | | hpa.maxPods | int | `10` | | | hpa.minPods | int | `1` | | | 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 | `{}` | | -| livenessProbe.enabled | bool | `true` | | +| ingress.annotations | object | `{}` | An array of service annotations | +| ingress.className | string | `nil` | Name of the ingress class to use | +| ingress.enabled | bool | `false` | Enable ingress controller resource | +| ingress.labels | object | `{}` | An array of service labels | +| ingress.path | string | `"/"` | The Path to use in Ingress' paths | +| ingress.pathType | string | `"Prefix"` | The PathType to use in Ingress' paths | +| internalDatabase.enabled | bool | `true` | Enable internal (SQLite) database | +| internalDatabase.name | string | `"/var/www/html/database/monica.sqlite"` | Database fullpath file | +| lifecycle | object | `{}` | Allow configuration of lifecycle hooks. ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ | +| livenessProbe.enabled | bool | `true` | Enable liveness probe | | livenessProbe.failureThreshold | int | `3` | | | livenessProbe.initialDelaySeconds | int | `10` | | | livenessProbe.periodSeconds | int | `10` | | | livenessProbe.successThreshold | int | `1` | | | livenessProbe.timeoutSeconds | int | `5` | | -| 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` | | +| mariadb.architecture | string | `"standalone"` | MariaDB architecture: `standalone` or `replication` | +| mariadb.auth.database | string | `"monica"` | Database name | +| mariadb.auth.password | string | `"secret"` | Database password | +| mariadb.auth.username | string | `"monica"` | Database user | +| mariadb.enabled | bool | `false` | Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters | +| mariadb.primary.persistence.accessMode | string | `"ReadWriteOnce"` | Access Mode for the PVC | +| mariadb.primary.persistence.enabled | bool | `false` | Enable MariaDB persistence using Persistent Volume Claims | +| mariadb.primary.persistence.existingClaim | string | `nil` | Use an existing Persistent Volume Claim (must be created ahead of time) | +| mariadb.primary.persistence.size | string | `"8Gi"` | PVC Storage Request | +| mariadb.primary.persistence.storageClass | string | `nil` | Storage class of backing PVC | +| meilisearch.enabled | bool | `false` | Enable Meilisearch. Use with `SCOUT_DRIVER=meilisearch` and `SCOUT_QUEUE=true` variables. | | 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.queue.priorityClassName | string | `"important"` | | -| monica.queue.terminationGracePeriodSeconds | int | `20` | | -| monica.storagedir | string | `"/var/www/html/storage"` | | -| monica.strategy.type | string | `"Recreate"` | | -| nameOverride | string | `""` | | -| nginx.config.default | bool | `true` | | -| nginx.containerPort | int | `80` | | -| nginx.enabled | bool | `false` | | +| memcached.auth.enabled | bool | `true` | Enable memcached authentication | +| memcached.auth.password | string | `"secret"` | Memcached password | +| memcached.auth.username | string | `"monica"` | Memcached user | +| memcached.containerSecurityContext | object | `{}` | | +| memcached.enabled | bool | `false` | Enable Memcached. Use with a `CACHE_STORE=memcached` variable (can also be used for `SESSION_DRIVER`). | +| monica.containerPort | int | `80` | Customize container port | +| monica.cronjob.enabled | bool | `false` | Enable cronjob to execute monica scheduled tasks | +| monica.cronjob.lifecycle | object | `{}` | Allow configuration of lifecycle hooks. ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ | +| monica.existingSecret.enabled | bool | `false` | Use an existing secret. If enabled, you need to set: `secretName`, `appKey`, `mailUsernameKey`, `mailPasswordKey` | +| monica.extraEnv | list | `[]` | Extra environment variables | +| monica.extraInitContainers | list | `[]` | Extra init containers that runs before pods start. | +| monica.extraSidecarContainers | list | `[]` | Extra sidecar containers. | +| monica.extraVolumeMounts | list | `[]` | Extra mounts for the pods. | +| monica.extraVolumes | list | `[]` | Extra volumes for the pods. | +| monica.host | string | `"monica.kube.home"` | Application URL | +| monica.mail.enabled | bool | `false` | Enable email service | +| monica.mail.fromAddress | string | `"user"` | Email `from` address | +| monica.mail.replyToAddress | string | `"user"` | Email `reply-to` address | +| monica.mail.smtp.encryption | string | `"tls"` | SMTP encryption | +| monica.mail.smtp.host | string | `"domain.com"` | SMTP host | +| monica.mail.smtp.password | string | `"pass"` | SMTP password | +| monica.mail.smtp.port | int | `465` | SMTP port | +| monica.mail.smtp.username | string | `"user"` | SMTP username | +| monica.phpConfigs | object | `{}` | PHP Configuration files. Will be injected in /usr/local/etc/php/conf.d for apache image and in /usr/local/etc/php-fpm.d when nginx.enabled: true | +| monica.queue.enabled | bool | `false` | Enable queue job to execute monica background tasks. Use in addition to a `QUEUE_CONNECTION` variable. | +| monica.queue.lifecycle | object | `{}` | Allow configuration of lifecycle hooks. ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ | +| monica.storagedir | string | `"/var/www/html/storage"` | Monica storage directory | +| monica.strategy | object | `{"type":"Recreate"}` | Strategy used to replace old pods. IMPORTANT: use with care, it is suggested to leave as that for upgrade purposes. ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy | +| nameOverride | string | `""` | Add a suffix to the name of the chart | +| nginx.config.custom | string | `nil` | Custom nginx configuration | +| nginx.config.default | bool | `true` | Generates the default nginx config | +| nginx.containerPort | int | `80` | Customize container port | +| nginx.enabled | bool | `false` | Enable nginx. You need to set an fpm version of the image for monica if you want to use nginx. | | 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` | | -| rbac.create | bool | `true` | | -| readinessProbe.enabled | bool | `true` | | +| nginx.resources | object | `{}` | nginx resources definition (limits, requests) | +| nodeSelector | object | `{}` | Node labels for pod assignment | +| persistence.accessMode | string | `"ReadWriteOnce"` | Persistent Volume Access Mode | +| persistence.annotations | object | `{}` | Persistent Volume Claim annotations | +| persistence.enabled | bool | `false` | Enable Monica persistence using Persistent Volume Claims | +| persistence.existingClaim | string | `nil` | A manually managed Persistent Volume and Claim Requires persistence.enabled: true If defined, PVC must be created manually before volume will be bound | +| persistence.size | string | `"4Gi"` | Persistent Volume Storage Request | +| persistence.storageClass | string | `nil` | Persistent Volume Storage Class If defined, storageClassName: If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. (gp2 on AWS, standard on GKE, AWS & OpenStack) | +| podAnnotations | object | `{}` | Annotations to be added at 'pod' level | +| podLabels | object | `{}` | Labels to be added at 'pod' level | +| postgresql.enabled | bool | `false` | Whether to deploy a postgresql server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters | +| postgresql.global.postgresql.auth.database | string | `"monica"` | Database name | +| postgresql.global.postgresql.auth.password | string | `"secret"` | Database password | +| postgresql.global.postgresql.auth.username | string | `"monica"` | Database user | +| postgresql.primary.persistence.enabled | bool | `false` | Enable PostgreSQL persistence using Persistent Volume Claims | +| postgresql.primary.persistence.existingClaim | string | `nil` | Use an existing Persistent Volume Claim (must be created ahead of time) | +| postgresql.primary.persistence.storageClass | string | `nil` | Storage class of backing PVC | +| rbac.create | bool | `true` | Specifies whether RBAC resources should be created | +| readinessProbe.enabled | bool | `true` | Enable readiness probe | | readinessProbe.failureThreshold | int | `3` | | | readinessProbe.initialDelaySeconds | int | `10` | | | readinessProbe.periodSeconds | int | `10` | | | readinessProbe.successThreshold | int | `1` | | | readinessProbe.timeoutSeconds | int | `5` | | -| 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 | `nil` | | -| startupProbe.enabled | bool | `false` | | +| redis.auth.enabled | bool | `true` | Enable redis authentication | +| redis.auth.password | string | `"secret"` | Redis password | +| redis.enabled | bool | `false` | Enable Redis. Use with a `QUEUE_CONNECTION=redis` variable (can also be used for `CACHE_STORE` and `SESSION_DRIVER`). | +| replicaCount | int | `1` | Number of replicas to be deployed | +| resources | object | `{}` | Define resources requests and limits for the pod (limits, requests) | +| service.annotations | object | `{}` | Service annotations | +| service.loadBalancerIP | string | `""` | Load Balancer IP (optional, only works with service.type LoadBalancer) | +| service.nodePort | string | `nil` | Node Port (optional, only works with service.type NodePort) | +| service.port | int | `8080` | Service port | +| service.type | string | `"ClusterIP"` | Service type | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `nil` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | +| startupProbe.enabled | bool | `false` | Enable startup probe | | startupProbe.failureThreshold | int | `30` | | | startupProbe.initialDelaySeconds | int | `30` | | | startupProbe.periodSeconds | int | `10` | | | startupProbe.successThreshold | int | `1` | | | startupProbe.timeoutSeconds | int | `5` | | -| 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 | `[]` | | +| tolerations | list | `[]` | Tolerations for pod assignment | + +## Database + +By default, the chart uses a SQLite database. If you want to use a different database, set the `internalDatabase.enabled` parameters to `false` in your `values.yaml`. + +```yaml +internalDatabase: + enabled: false +``` + +You can also use an external database by setting the `externalDatabase.enabled` parameters to `true` in your `values.yaml`. + +```yaml +internalDatabase: + enabled: false +externalDatabase: + enabled: true + type: mysql + host: myhost.test + user: monica + password: secret + database: monica +``` + +Or you can use a mariadb database by setting the `mariadb.enabled` parameters to `true` in your `values.yaml`. + +```yaml +internalDatabase: + enabled: false +mariadb: + enabled: true +``` + +## Cron job + +Monica requires a cron job to run reminders and other [scheduled](https://laravel.com/docs/11.x/scheduling) tasks. You can enable the cron job by setting the `monica.cronjob.enabled` parameters to `true` in your `values.yaml`. + +```yaml +monica: + cronJob: + enabled: true +``` + +## Queue worker + +Monica works better with a [queue](https://laravel.com/docs/11.x/queues) worker. You can enable the queue worker by setting the `monica.queue.enabled` parameters to `true` in your `values.yaml`. +You can use the `database` for `QUEUE_CONNECTION`, but other options exists. + +```yaml +monica: + queue: + enabled: true + extraEnv: + - name: QUEUE_CONNECTION + value: database +``` + +## Add environment variables + +To add environment variables to the monica container, set the `monica.extraEnv` parameters in your `values.yaml`. + +Example: + +```yaml +monica: + extraEnv: + - name: QUEUE_CONNECTION + value: redis + - name: CACHE_STORE + value: memcached + - name: SCOUT_DRIVER + value: meilisearch + - name: SCOUT_QUEUE + value: "true" + - name: PHP_UPLOAD_LIMIT + value: 10G +``` + +## Using nginx + +To use nginx instead of apache to serve monica, set the following parameters in your `values.yaml`: + +```yaml +# This uses the fpm flavor of the monica image +image: + tag: main-fpm + +# this deploys an nginx container within the monica pod +nginx + enabled: true +``` + +## Php configuration + +You may want special [`php.ini`](https://www.php.net/manual/en/ini.list.php) values. For instance, perhaps your setup requires a bit more memory. You can add additional `php.ini` files in the values.yaml by providing `monica.phpConfigs.NAME_OF_FILE`. + +Example: + +```yaml +monica: + phpConfigs: + zz-error.ini: |- + error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + display_errors = Off +``` + +> [!Note] +> Be sure to prefix your file name with `zz` to ensure it is loaded at the end. + +## HPA (Clustering) + +If you want to have multiple Monica containers, regardless of dynamic or static sizes, you need to use shared persistence between the containers. + +Minimum cluster compatible persistence settings: +```yaml +persistence: + enabled: true + accessMode: ReadWriteMany +``` ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) \ No newline at end of file diff --git a/charts/monica/README.md.gotmpl b/charts/monica/README.md.gotmpl new file mode 100644 index 0000000..fda8074 --- /dev/null +++ b/charts/monica/README.md.gotmpl @@ -0,0 +1,157 @@ +{{ template "chart.header" . }} +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.badgesSection" . }} + +{{ template "chart.description" . }} + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +helm repo add monica https://monicahq.github.io/helm/ +helm install my-release monica/monica +``` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +{{ template "chart.homepageLine" . }} + +{{ template "chart.maintainersSection" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} + +## Database + +By default, the chart uses a SQLite database. If you want to use a different database, set the `internalDatabase.enabled` parameters to `false` in your `values.yaml`. + +```yaml +internalDatabase: + enabled: false +``` + +You can also use an external database by setting the `externalDatabase.enabled` parameters to `true` in your `values.yaml`. + +```yaml +internalDatabase: + enabled: false +externalDatabase: + enabled: true + type: mysql + host: myhost.test + user: monica + password: secret + database: monica +``` + +Or you can use a mariadb database by setting the `mariadb.enabled` parameters to `true` in your `values.yaml`. + +```yaml +internalDatabase: + enabled: false +mariadb: + enabled: true +``` + +## Cron job + +Monica requires a cron job to run reminders and other [scheduled](https://laravel.com/docs/11.x/scheduling) tasks. You can enable the cron job by setting the `monica.cronjob.enabled` parameters to `true` in your `values.yaml`. + +```yaml +monica: + cronJob: + enabled: true +``` + +## Queue worker + +Monica works better with a [queue](https://laravel.com/docs/11.x/queues) worker. You can enable the queue worker by setting the `monica.queue.enabled` parameters to `true` in your `values.yaml`. +You can use the `database` for `QUEUE_CONNECTION`, but other options exists. + +```yaml +monica: + queue: + enabled: true + extraEnv: + - name: QUEUE_CONNECTION + value: database +``` + +## Add environment variables + +To add environment variables to the monica container, set the `monica.extraEnv` parameters in your `values.yaml`. + +Example: + +```yaml +monica: + extraEnv: + - name: QUEUE_CONNECTION + value: redis + - name: CACHE_STORE + value: memcached + - name: SCOUT_DRIVER + value: meilisearch + - name: SCOUT_QUEUE + value: "true" + - name: PHP_UPLOAD_LIMIT + value: 10G +``` + +## Using nginx + +To use nginx instead of apache to serve monica, set the following parameters in your `values.yaml`: + +```yaml +# This uses the fpm flavor of the monica image +image: + tag: main-fpm + +# this deploys an nginx container within the monica pod +nginx + enabled: true +``` + +## Php configuration + +You may want special [`php.ini`](https://www.php.net/manual/en/ini.list.php) values. For instance, perhaps your setup requires a bit more memory. You can add additional `php.ini` files in the values.yaml by providing `monica.phpConfigs.NAME_OF_FILE`. + +Example: + +```yaml +monica: + phpConfigs: + zz-error.ini: |- + error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + display_errors = Off +``` + +> [!Note] +> Be sure to prefix your file name with `zz` to ensure it is loaded at the end. + + +## HPA (Clustering) + +If you want to have multiple Monica containers, regardless of dynamic or static sizes, you need to use shared persistence between the containers. + +Minimum cluster compatible persistence settings: +```yaml +persistence: + enabled: true + accessMode: ReadWriteMany +``` + +{{ template "helm-docs.versionFooter" . }} \ No newline at end of file diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index 40d2c46..a85ce6a 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -7,21 +7,29 @@ image: # pullSecrets: # - myRegistrKeySecretName +# -- Add a suffix to the name of the chart nameOverride: "" +# -- Override the fullname of the chart fullnameOverride: "" +# -- Annotations to be added at 'pod' level podAnnotations: {} +# -- Labels to be added at 'pod' level podLabels: {} +# -- Annotations to be added at 'service' level deploymentAnnotations: {} -# Number of replicas to be deployed +# -- Number of replicas to be deployed replicaCount: 1 ## Allowing use of ingress controllers ## ref: https://kubernetes.io/docs/concepts/services-networking/ingress/ ## ingress: + # -- Enable ingress controller resource enabled: false - # className: nginx + # -- Name of the ingress class to use + className: + # -- An array of service annotations annotations: {} # nginx.ingress.kubernetes.io/proxy-body-size: 4G # kubernetes.io/tls-acme: "true" @@ -47,46 +55,60 @@ ingress: # - secretName: monica-tls # hosts: # - monica.kube.home + # -- An array of service labels labels: {} + # -- The Path to use in Ingress' paths path: / + # -- The PathType to use in Ingress' paths pathType: Prefix -# Allow configuration of lifecycle hooks +# -- Allow configuration of lifecycle hooks. # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ lifecycle: {} # postStartCommand: [] # preStopCommand: [] monica: + # -- Application URL host: monica.kube.home ## Use an existing secret existingSecret: + # -- Use an existing secret. If enabled, you need to set: `secretName`, `appKey`, `mailUsernameKey`, `mailPasswordKey` enabled: false # secretName: nameofsecret # appKey: base64_key # mailUsernameKey: smtp_username # mailPasswordKey: smtp_password - # If web server is not binding default port, you can define it - # containerPort: 80 + # -- Customize container port + containerPort: 80 + # -- Monica storage directory storagedir: /var/www/html/storage mail: + # -- Enable email service enabled: false + # -- Email `from` address fromAddress: user + # -- Email `reply-to` address replyToAddress: user smtp: + # -- SMTP host host: domain.com + # -- SMTP encryption encryption: tls + # -- SMTP port port: 465 + # -- SMTP username username: user + # -- SMTP password password: pass - # PHP Configuration files + # -- PHP Configuration files. # Will be injected in /usr/local/etc/php/conf.d for apache image and in /usr/local/etc/php-fpm.d when nginx.enabled: true phpConfigs: {} - ## Strategy used to replace old pods - ## IMPORTANT: use with care, it is suggested to leave as that for upgrade purposes - ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy + # -- Strategy used to replace old pods. + # IMPORTANT: use with care, it is suggested to leave as that for upgrade purposes. + # ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy strategy: type: Recreate # type: RollingUpdate @@ -94,22 +116,21 @@ monica: # maxSurge: 1 # maxUnavailable: 0 - ## - ## Extra environment variables - extraEnv: + # -- Extra environment variables + extraEnv: [] # - name: SOME_SECRET_ENV # valueFrom: # secretKeyRef: # name: monica # key: secret_key - # Extra init containers that runs before pods start. + # -- Extra init containers that runs before pods start. extraInitContainers: [] # - name: do-something # image: busybox # command: ['do', 'something'] - # Extra sidecar containers. + # -- Extra sidecar containers. extraSidecarContainers: [] # - name: monica-logger # image: busybox @@ -118,99 +139,113 @@ monica: # - name: monica-storage # mountPath: /run/monica/data - # Extra mounts for the pods. - extraVolumes: + # -- Extra volumes for the pods. + extraVolumes: [] # - name: nfs # nfs: # server: "10.0.0.1" # path: "/var/www/html/storage" # readOnly: false - extraVolumeMounts: + # -- Extra mounts for the pods. + extraVolumeMounts: [] # - name: nfs # mountPath: "/var/www/html/storage" - # Extra secuurityContext parameters. For example you may need to define runAsNonRoot directive - # extraSecurityContext: - # runAsUser: "33" - # runAsGroup: "33" - # runAsNonRoot: true - # readOnlyRootFilesystem: true - ## ## Cronjob to execute monica scheduled tasks ## cronjob: + # -- Enable cronjob to execute monica scheduled tasks enabled: false - # Allow configuration of lifecycle hooks + # -- 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 job to execute monica background tasks ## Use in addition to a `QUEUE_CONNECTION` variable ## queue: + # -- Enable queue job to execute monica background tasks. Use in addition to a `QUEUE_CONNECTION` variable. enabled: false - # Allow configuration of lifecycle hooks + # -- Allow configuration of lifecycle hooks. # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ lifecycle: {} # postStartCommand: [] # preStopCommand: [] + # @ignored priorityClassName: important + # @ignored terminationGracePeriodSeconds: 20 nginx: - ## You need to set an fpm version of the image for monica if you want to use nginx! + # -- Enable nginx. You need to set an fpm version of the image for monica if you want to use nginx. enabled: false image: repository: nginx tag: alpine pullPolicy: IfNotPresent + # -- Customize container port containerPort: 80 config: - # This generates the default nginx config + # -- Generates the default nginx config default: true - # custom: |- - # worker_processes 1;.. + # -- Custom nginx configuration + custom: + # worker_processes 1;.. + # -- nginx resources definition (limits, requests) resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi ## ## Internal database configuration (SQLite) ## internalDatabase: + # -- Enable internal (SQLite) database enabled: true - ## Database fullpath file + # -- Database fullpath file name: /var/www/html/database/monica.sqlite ## ## External database configuration ## externalDatabase: + # -- Enable external database enabled: false - ## Supported database engines: mysql or postgresql + # -- Database type. Supported database engines: `mysql` or `postgresql` type: mysql - ## Database host + # -- Database host host: - ## Database user + # -- Database user user: monica - ## Database password + # -- Database password password: secret - ## Database name + # -- Database name database: monica ## Use an existing secret existingSecret: + # -- Use an existing secret. If enabled set: `secretName`, `usernameKey`, `passwordKey` enabled: false # secretName: nameofsecret # usernameKey: username @@ -221,14 +256,18 @@ externalDatabase: ## for more options see https://github.com/bitnami/charts/tree/master/bitnami/mariadb ## mariadb: - ## Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters + # -- Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters enabled: false auth: + # -- Database name database: monica + # -- Database user username: monica + # -- Database password password: secret + # -- MariaDB architecture: `standalone` or `replication` architecture: standalone ## Enable persistence using Persistent Volume Claims @@ -236,9 +275,15 @@ mariadb: ## primary: persistence: + # -- Enable MariaDB persistence using Persistent Volume Claims enabled: false - # storageClass: "" + # -- Use an existing Persistent Volume Claim (must be created ahead of time) + existingClaim: + # -- Storage class of backing PVC + storageClass: + # -- Access Mode for the PVC accessMode: ReadWriteOnce + # -- PVC Storage Request size: 8Gi ## @@ -246,26 +291,37 @@ mariadb: ## for more options see https://github.com/bitnami/charts/tree/master/bitnami/postgresql ## postgresql: + # -- Whether to deploy a postgresql server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters enabled: false global: postgresql: auth: + # -- Database user username: monica + # -- Database password password: secret + # -- Database name database: monica primary: persistence: + # -- Enable PostgreSQL persistence using Persistent Volume Claims enabled: false - # storageClass: "" + # -- Use an existing Persistent Volume Claim (must be created ahead of time) + existingClaim: + # -- Storage class of backing PVC + storageClass: ## ## Redis chart configuration ## for more options see https://github.com/bitnami/charts/tree/master/bitnami/redis ## redis: + # -- Enable Redis. Use with a `QUEUE_CONNECTION=redis` variable (can also be used for `CACHE_STORE` and `SESSION_DRIVER`). enabled: false auth: + # -- Enable redis authentication enabled: true + # -- Redis password password: secret # existingSecret # existingSecretPasswordKey @@ -275,14 +331,19 @@ redis: ## for more options see https://github.com/bitnami/charts/tree/main/bitnami/memcached ## memcached: + # -- Enable Memcached. Use with a `CACHE_STORE=memcached` variable (can also be used for `SESSION_DRIVER`). enabled: false auth: + # -- Enable memcached authentication enabled: true + # -- Memcached user username: monica + # -- Memcached password password: secret # existingSecret # existingSecretPasswordKey containerSecurityContext: + # @ignored readOnlyRootFilesystem: false ## @@ -290,6 +351,7 @@ memcached: ## for more options see https://github.com/meilisearch/meilisearch-kubernetes/tree/main/charts/meilisearch ## meilisearch: + # -- Enable Meilisearch. Use with `SCOUT_DRIVER=meilisearch` and `SCOUT_QUEUE=true` variables. enabled: false environment: MEILI_ENV: production @@ -298,10 +360,15 @@ meilisearch: # existingMasterKeySecret service: + # -- Service type type: ClusterIP + # -- Service port port: 8080 + # -- Load Balancer IP (optional, only works with service.type LoadBalancer) loadBalancerIP: "" + # -- Node Port (optional, only works with service.type NodePort) nodePort: + # -- Service annotations annotations: {} ## Insert your annotations such as below # test/test: pumuckel @@ -310,26 +377,29 @@ service: ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ ## persistence: - # monica storage (/var/www/html/storage) + # -- Enable Monica persistence using Persistent Volume Claims enabled: false + # -- Persistent Volume Claim annotations annotations: {} - ## monica storage Persistent Volume Storage Class - ## If defined, storageClassName: - ## If set to "-", storageClassName: "", which disables dynamic provisioning - ## If undefined (the default) or set to null, no storageClassName spec is - ## set, choosing the default provisioner. (gp2 on AWS, standard on - ## GKE, AWS & OpenStack) - ## - # storageClass: "-" - - ## A manually managed Persistent Volume and Claim - ## Requires persistence.enabled: true - ## If defined, PVC must be created manually before volume will be bound - # existingClaim: - + # -- Persistent Volume Storage Class + # If defined, storageClassName: + # If set to "-", storageClassName: "", which disables dynamic provisioning + # If undefined (the default) or set to null, no storageClassName spec is + # set, choosing the default provisioner. (gp2 on AWS, standard on + # GKE, AWS & OpenStack) + storageClass: + + # -- A manually managed Persistent Volume and Claim + # Requires persistence.enabled: true + # If defined, PVC must be created manually before volume will be bound + existingClaim: + + # -- Persistent Volume Access Mode accessMode: ReadWriteOnce + # -- Persistent Volume Storage Request size: 4Gi +# -- Define resources requests and limits for the pod (limits, requests) resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little @@ -347,6 +417,7 @@ resources: {} ## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes ## livenessProbe: + # -- Enable liveness probe enabled: true initialDelaySeconds: 10 periodSeconds: 10 @@ -354,6 +425,7 @@ livenessProbe: failureThreshold: 3 successThreshold: 1 readinessProbe: + # -- Enable readiness probe enabled: true initialDelaySeconds: 10 periodSeconds: 10 @@ -361,6 +433,7 @@ readinessProbe: failureThreshold: 3 successThreshold: 1 startupProbe: + # -- Enable startup probe enabled: false initialDelaySeconds: 30 periodSeconds: 10 @@ -373,30 +446,35 @@ startupProbe: ## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ ## hpa: + # -- Enable Horizontal Pod Autoscaler enabled: false cputhreshold: 60 minPods: 1 maxPods: 10 +# -- Node labels for pod assignment nodeSelector: {} +# -- Tolerations for pod assignment tolerations: [] +# -- Affinity for pod assignment affinity: {} rbac: - # Specifies whether RBAC resources should be created + # -- Specifies whether RBAC resources should be created create: true serviceAccount: - # Specifies whether a service account should be created + # -- Specifies whether a service account should be created create: true - # Annotations to add to the service account + # -- Annotations to add to the service account annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template + # -- The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template name: +# @ignored tests: unitTests: resources: From 7b0fedb543b2d8ab69d881fd60ccebf72d53b619 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Thu, 31 Oct 2024 08:32:41 +0100 Subject: [PATCH 2/6] update --- charts/monica/Chart.yaml | 6 ++ charts/monica/README.md | 107 +++++++++++++----------- charts/monica/README.md.gotmpl | 48 ++++++----- charts/monica/files/init-publicdir.sh | 2 +- charts/monica/files/nginx-config.tpl | 3 +- charts/monica/templates/cronjob.yaml | 2 +- charts/monica/templates/deployment.yaml | 8 +- charts/monica/templates/hpa.yaml | 34 ++++++-- charts/monica/templates/queue.yaml | 2 +- charts/monica/values.yaml | 64 ++++++++++---- 10 files changed, 178 insertions(+), 98 deletions(-) diff --git a/charts/monica/Chart.yaml b/charts/monica/Chart.yaml index d82b930..f66e659 100644 --- a/charts/monica/Chart.yaml +++ b/charts/monica/Chart.yaml @@ -65,3 +65,9 @@ annotations: artifacthub.io/changes: | - kind: changed description: Update chart documentation + - kind: fixed + description: Fix resources usage + - kind: added + description: Add resources for cronjob and queue + - kind: changed + description: Renamed 'hpa' to 'autoscaling', and its child values diff --git a/charts/monica/README.md b/charts/monica/README.md index 6204809..bf928cb 100644 --- a/charts/monica/README.md +++ b/charts/monica/README.md @@ -51,7 +51,13 @@ Kubernetes: `>=1.16.0-0` | Key | Type | Default | Description | |-----|------|---------|-------------| | affinity | object | `{}` | Affinity for pod assignment | -| deploymentAnnotations | object | `{}` | Annotations to be added at 'service' level | +| autoscaling.enabled | bool | `false` | Enable autoscaling | +| autoscaling.maxReplicas | string | `nil` | Maximum number of replicas to scale out | +| autoscaling.minReplicas | string | `nil` | Minimum number of replicas to scale back | +| autoscaling.targetCPU | string | `nil` | Target CPU utilization percentage | +| autoscaling.targetMemory | string | `nil` | Target Memory utilization percentage | +| deploymentAnnotations | object | `{}` | Annotations to be added at 'deployment' level | +| deploymentLabels | object | `{}` | Labels to be added at 'deployment' level | | externalDatabase.database | string | `"monica"` | Database name | | externalDatabase.enabled | bool | `false` | Enable external database | | externalDatabase.existingSecret.enabled | bool | `false` | Use an existing secret. If enabled set: `secretName`, `usernameKey`, `passwordKey` | @@ -60,13 +66,10 @@ Kubernetes: `>=1.16.0-0` | externalDatabase.type | string | `"mysql"` | Database type. Supported database engines: `mysql` or `postgresql` | | externalDatabase.user | string | `"monica"` | Database user | | fullnameOverride | string | `""` | Override the fullname of the chart | -| hpa.cputhreshold | int | `60` | | -| hpa.enabled | bool | `false` | Enable Horizontal Pod Autoscaler | -| hpa.maxPods | int | `10` | | -| hpa.minPods | int | `1` | | -| image.pullPolicy | string | `"IfNotPresent"` | | -| image.repository | string | `"ghcr.io/monicahq/monica-next"` | | -| image.tag | string | `"main"` | | +| image.pullPolicy | string | `"IfNotPresent"` | The monica image pull policy | +| image.pullSecrets | list | `[]` | Optionally specify an array of imagePullSecrets. | +| image.repository | string | `"ghcr.io/monicahq/monica-next"` | The monica image repository to pull from | +| image.tag | string | `"main"` | The monica image tag to pull | | ingress.annotations | object | `{}` | An array of service annotations | | ingress.className | string | `nil` | Name of the ingress class to use | | ingress.enabled | bool | `false` | Enable ingress controller resource | @@ -77,11 +80,11 @@ Kubernetes: `>=1.16.0-0` | internalDatabase.name | string | `"/var/www/html/database/monica.sqlite"` | Database fullpath file | | lifecycle | object | `{}` | Allow configuration of lifecycle hooks. ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ | | livenessProbe.enabled | bool | `true` | Enable liveness probe | -| livenessProbe.failureThreshold | int | `3` | | -| livenessProbe.initialDelaySeconds | int | `10` | | -| livenessProbe.periodSeconds | int | `10` | | -| livenessProbe.successThreshold | int | `1` | | -| livenessProbe.timeoutSeconds | int | `5` | | +| livenessProbe.failureThreshold | int | `3` | Minimum consecutive failures for the probe | +| livenessProbe.initialDelaySeconds | int | `10` | Delay before this probe is initiated | +| livenessProbe.periodSeconds | int | `10` | How often to perform the probe | +| livenessProbe.successThreshold | int | `1` | Minimum consecutive successes for the probe | +| livenessProbe.timeoutSeconds | int | `5` | When the probe times out | | mariadb.architecture | string | `"standalone"` | MariaDB architecture: `standalone` or `replication` | | mariadb.auth.database | string | `"monica"` | Database name | | mariadb.auth.password | string | `"secret"` | Database password | @@ -102,6 +105,7 @@ Kubernetes: `>=1.16.0-0` | monica.containerPort | int | `80` | Customize container port | | monica.cronjob.enabled | bool | `false` | Enable cronjob to execute monica scheduled tasks | | monica.cronjob.lifecycle | object | `{}` | Allow configuration of lifecycle hooks. ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ | +| monica.cronjob.resources | object | `{}` | cronjob resources definition (limits, requests) | | monica.existingSecret.enabled | bool | `false` | Use an existing secret. If enabled, you need to set: `secretName`, `appKey`, `mailUsernameKey`, `mailPasswordKey` | | monica.extraEnv | list | `[]` | Extra environment variables | | monica.extraInitContainers | list | `[]` | Extra init containers that runs before pods start. | @@ -120,6 +124,7 @@ Kubernetes: `>=1.16.0-0` | monica.phpConfigs | object | `{}` | PHP Configuration files. Will be injected in /usr/local/etc/php/conf.d for apache image and in /usr/local/etc/php-fpm.d when nginx.enabled: true | | monica.queue.enabled | bool | `false` | Enable queue job to execute monica background tasks. Use in addition to a `QUEUE_CONNECTION` variable. | | monica.queue.lifecycle | object | `{}` | Allow configuration of lifecycle hooks. ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ | +| monica.queue.resources | object | `{}` | queue job resources definition (limits, requests) | | monica.storagedir | string | `"/var/www/html/storage"` | Monica storage directory | | monica.strategy | object | `{"type":"Recreate"}` | Strategy used to replace old pods. IMPORTANT: use with care, it is suggested to leave as that for upgrade purposes. ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy | | nameOverride | string | `""` | Add a suffix to the name of the chart | @@ -127,9 +132,9 @@ Kubernetes: `>=1.16.0-0` | nginx.config.default | bool | `true` | Generates the default nginx config | | nginx.containerPort | int | `80` | Customize container port | | nginx.enabled | bool | `false` | Enable nginx. You need to set an fpm version of the image for monica if you want to use nginx. | -| nginx.image.pullPolicy | string | `"IfNotPresent"` | | -| nginx.image.repository | string | `"nginx"` | | -| nginx.image.tag | string | `"alpine"` | | +| nginx.image.pullPolicy | string | `"IfNotPresent"` | The nginx image pull policy | +| nginx.image.repository | string | `"nginx"` | The nginx image repository to pull from | +| nginx.image.tag | string | `"alpine"` | The nginx image tag to pull | | nginx.resources | object | `{}` | nginx resources definition (limits, requests) | | nodeSelector | object | `{}` | Node labels for pod assignment | | persistence.accessMode | string | `"ReadWriteOnce"` | Persistent Volume Access Mode | @@ -149,15 +154,15 @@ Kubernetes: `>=1.16.0-0` | postgresql.primary.persistence.storageClass | string | `nil` | Storage class of backing PVC | | rbac.create | bool | `true` | Specifies whether RBAC resources should be created | | readinessProbe.enabled | bool | `true` | Enable readiness probe | -| readinessProbe.failureThreshold | int | `3` | | -| readinessProbe.initialDelaySeconds | int | `10` | | -| readinessProbe.periodSeconds | int | `10` | | -| readinessProbe.successThreshold | int | `1` | | -| readinessProbe.timeoutSeconds | int | `5` | | +| readinessProbe.failureThreshold | int | `3` | Minimum consecutive failures for the probe | +| readinessProbe.initialDelaySeconds | int | `10` | Delay before this probe is initiated | +| readinessProbe.periodSeconds | int | `10` | How often to perform the probe | +| readinessProbe.successThreshold | int | `1` | Minimum consecutive successes for the probe | +| readinessProbe.timeoutSeconds | int | `5` | When the probe times out | | redis.auth.enabled | bool | `true` | Enable redis authentication | | redis.auth.password | string | `"secret"` | Redis password | | redis.enabled | bool | `false` | Enable Redis. Use with a `QUEUE_CONNECTION=redis` variable (can also be used for `CACHE_STORE` and `SESSION_DRIVER`). | -| replicaCount | int | `1` | Number of replicas to be deployed | +| replicaCount | int | `1` | Number of pods to be deployed | | resources | object | `{}` | Define resources requests and limits for the pod (limits, requests) | | service.annotations | object | `{}` | Service annotations | | service.loadBalancerIP | string | `""` | Load Balancer IP (optional, only works with service.type LoadBalancer) | @@ -168,11 +173,11 @@ Kubernetes: `>=1.16.0-0` | serviceAccount.create | bool | `true` | Specifies whether a service account should be created | | serviceAccount.name | string | `nil` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | | startupProbe.enabled | bool | `false` | Enable startup probe | -| startupProbe.failureThreshold | int | `30` | | -| startupProbe.initialDelaySeconds | int | `30` | | -| startupProbe.periodSeconds | int | `10` | | -| startupProbe.successThreshold | int | `1` | | -| startupProbe.timeoutSeconds | int | `5` | | +| startupProbe.failureThreshold | int | `30` | Minimum consecutive failures for the probe | +| startupProbe.initialDelaySeconds | int | `30` | Delay before this probe is initiated | +| startupProbe.periodSeconds | int | `10` | How often to perform the probe | +| startupProbe.successThreshold | int | `1` | Minimum consecutive successes for the probe | +| startupProbe.timeoutSeconds | int | `5` | When the probe times out | | tolerations | list | `[]` | Tolerations for pod assignment | ## Database @@ -207,6 +212,27 @@ mariadb: enabled: true ``` +## Add environment variables + +To add environment variables to the monica container, set the `monica.extraEnv` parameters in your `values.yaml`. + +Example: + +```yaml +monica: + extraEnv: + - name: QUEUE_CONNECTION + value: redis + - name: CACHE_STORE + value: memcached + - name: SCOUT_DRIVER + value: meilisearch + - name: SCOUT_QUEUE + value: "true" + - name: PHP_UPLOAD_LIMIT + value: 10G +``` + ## Cron job Monica requires a cron job to run reminders and other [scheduled](https://laravel.com/docs/11.x/scheduling) tasks. You can enable the cron job by setting the `monica.cronjob.enabled` parameters to `true` in your `values.yaml`. @@ -217,6 +243,9 @@ monica: enabled: true ``` +> [!Note] +> Cron job requires a permanent database. Using the internal SQLite database won't work in this scenario. + ## Queue worker Monica works better with a [queue](https://laravel.com/docs/11.x/queues) worker. You can enable the queue worker by setting the `monica.queue.enabled` parameters to `true` in your `values.yaml`. @@ -231,26 +260,8 @@ monica: value: database ``` -## Add environment variables - -To add environment variables to the monica container, set the `monica.extraEnv` parameters in your `values.yaml`. - -Example: - -```yaml -monica: - extraEnv: - - name: QUEUE_CONNECTION - value: redis - - name: CACHE_STORE - value: memcached - - name: SCOUT_DRIVER - value: meilisearch - - name: SCOUT_QUEUE - value: "true" - - name: PHP_UPLOAD_LIMIT - value: 10G -``` +> [!Note] +> Queue requires a permanent database. Using the internal SQLite database won't work in this scenario. ## Using nginx @@ -280,6 +291,8 @@ monica: display_errors = Off ``` +Note you can also set `PHP_UPLOAD_LIMIT` and `PHP_MEMORY_LIMIT` in the `monica.extraEnv` section. + > [!Note] > Be sure to prefix your file name with `zz` to ensure it is loaded at the end. diff --git a/charts/monica/README.md.gotmpl b/charts/monica/README.md.gotmpl index fda8074..f186c55 100644 --- a/charts/monica/README.md.gotmpl +++ b/charts/monica/README.md.gotmpl @@ -66,6 +66,27 @@ mariadb: enabled: true ``` +## Add environment variables + +To add environment variables to the monica container, set the `monica.extraEnv` parameters in your `values.yaml`. + +Example: + +```yaml +monica: + extraEnv: + - name: QUEUE_CONNECTION + value: redis + - name: CACHE_STORE + value: memcached + - name: SCOUT_DRIVER + value: meilisearch + - name: SCOUT_QUEUE + value: "true" + - name: PHP_UPLOAD_LIMIT + value: 10G +``` + ## Cron job Monica requires a cron job to run reminders and other [scheduled](https://laravel.com/docs/11.x/scheduling) tasks. You can enable the cron job by setting the `monica.cronjob.enabled` parameters to `true` in your `values.yaml`. @@ -76,6 +97,9 @@ monica: enabled: true ``` +> [!Note] +> Cron job requires a permanent database. Using the internal SQLite database won't work in this scenario. + ## Queue worker Monica works better with a [queue](https://laravel.com/docs/11.x/queues) worker. You can enable the queue worker by setting the `monica.queue.enabled` parameters to `true` in your `values.yaml`. @@ -90,26 +114,8 @@ monica: value: database ``` -## Add environment variables - -To add environment variables to the monica container, set the `monica.extraEnv` parameters in your `values.yaml`. - -Example: - -```yaml -monica: - extraEnv: - - name: QUEUE_CONNECTION - value: redis - - name: CACHE_STORE - value: memcached - - name: SCOUT_DRIVER - value: meilisearch - - name: SCOUT_QUEUE - value: "true" - - name: PHP_UPLOAD_LIMIT - value: 10G -``` +> [!Note] +> Queue requires a permanent database. Using the internal SQLite database won't work in this scenario. ## Using nginx @@ -139,6 +145,8 @@ monica: display_errors = Off ``` +Note you can also set `PHP_UPLOAD_LIMIT` and `PHP_MEMORY_LIMIT` in the `monica.extraEnv` section. + > [!Note] > Be sure to prefix your file name with `zz` to ensure it is loaded at the end. diff --git a/charts/monica/files/init-publicdir.sh b/charts/monica/files/init-publicdir.sh index 5b72efa..aed9558 100644 --- a/charts/monica/files/init-publicdir.sh +++ b/charts/monica/files/init-publicdir.sh @@ -1,3 +1,3 @@ -ln -sf ../storage /var/www/html/public/storage +php /var/www/html/artisan storage:link rm -rf /public/* cp -ra /var/www/html/public /public \ No newline at end of file diff --git a/charts/monica/files/nginx-config.tpl b/charts/monica/files/nginx-config.tpl index 061f7ba..2a73b54 100644 --- a/charts/monica/files/nginx-config.tpl +++ b/charts/monica/files/nginx-config.tpl @@ -55,7 +55,8 @@ server { # set max upload size client_max_body_size 10G; - fastcgi_buffers 64 4K; + fastcgi_buffers 64 8K; + fastcgi_buffer_size 32k; # Enable gzip but do not remove ETag headers gzip on; diff --git a/charts/monica/templates/cronjob.yaml b/charts/monica/templates/cronjob.yaml index bb352ca..05d9a07 100644 --- a/charts/monica/templates/cronjob.yaml +++ b/charts/monica/templates/cronjob.yaml @@ -34,7 +34,7 @@ spec: env: {{- include "monica.env" . | indent 16 }} resources: - {{ toYaml .Values.resources | indent 16 }} + {{- toYaml .Values.monica.cronjob.resources | nindent 16 }} volumeMounts: {{- include "monica.volumeMounts" . | trim | nindent 16 }} restartPolicy: Never diff --git a/charts/monica/templates/deployment.yaml b/charts/monica/templates/deployment.yaml index c43a0d0..7f0ffc5 100644 --- a/charts/monica/templates/deployment.yaml +++ b/charts/monica/templates/deployment.yaml @@ -14,7 +14,7 @@ metadata: {{ toYaml . | indent 4 }} {{- end }} spec: - {{- if not .Values.hpa.enabled }} + {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} strategy: @@ -128,13 +128,13 @@ spec: {{- end }} {{- end }}{{/* not nginx.enabled */}} resources: - {{ toYaml .Values.resources | indent 12 }} + {{- toYaml .Values.resources | nindent 12 }} volumeMounts: {{- include "monica.volumeMounts" . | trim | nindent 12 }} {{- if .Values.nginx.enabled }} - name: {{ .Chart.Name }}-nginx - image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}" + image: "{{ .Values.nginx.image.registry | default "docker.io" }}/{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}" imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} {{- with .Values.nginx.extraEnv }} env: @@ -193,7 +193,7 @@ spec: {{- end }} {{- end }} resources: - {{ toYaml .Values.nginx.resources | indent 12 }} + {{- toYaml .Values.nginx.resources | nindent 12 }} volumeMounts: - name: monica-nginx-config mountPath: /etc/nginx/conf.d/ diff --git a/charts/monica/templates/hpa.yaml b/charts/monica/templates/hpa.yaml index 5370873..78a4692 100644 --- a/charts/monica/templates/hpa.yaml +++ b/charts/monica/templates/hpa.yaml @@ -1,4 +1,4 @@ -{{- if .Values.hpa.enabled }} +{{- if .Values.autoscaling.enabled }} --- apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler @@ -12,9 +12,33 @@ spec: kind: Deployment apiVersion: apps/v1 name: {{ template "monica.fullname" . }} - {{- with .Values.hpa }} - minReplicas: {{ .minPods }} - maxReplicas: {{ .maxPods }} - targetCPUUtilizationPercentage: {{ .cputhreshold }} + {{- with .Values.autoscaling }} + minReplicas: {{ .minReplicas }} + maxReplicas: {{ .maxReplicas }} + metrics: + {{- if .targetMemory }} + - type: Resource + resource: + name: memory + {{- if semverCompare "<1.23-0" $.Capabilities.KubeVersion.GitVersion -}} + targetAverageUtilization: {{ .targetMemory }} + {{- else }} + target: + type: Utilization + averageUtilization: {{ .targetMemory }} + {{- end }} + {{- end }} + {{- if .targetCPU }} + - type: Resource + resource: + name: cpu + {{- if semverCompare "<1.23-0" $.Capabilities.KubeVersion.GitVersion -}} + targetAverageUtilization: {{ .targetCPU }} + {{- else }} + target: + type: Utilization + averageUtilization: {{ .targetCPU }} + {{- end }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/monica/templates/queue.yaml b/charts/monica/templates/queue.yaml index 150a9e3..a9c11e0 100644 --- a/charts/monica/templates/queue.yaml +++ b/charts/monica/templates/queue.yaml @@ -59,7 +59,7 @@ spec: env: {{- include "monica.env" . | indent 12 }} resources: - {{ toYaml .Values.resources | indent 12 }} + {{- toYaml .Values.monica.queue.resources | nindent 12 }} volumeMounts: {{- include "monica.volumeMounts" . | trim | nindent 12 }} {{- with .Values.monica.queue.priorityClassName }} diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index a85ce6a..ce18d3d 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -1,10 +1,14 @@ image: + # -- The monica image repository to pull from repository: ghcr.io/monicahq/monica-next + # -- The monica image tag to pull tag: main # repository: monica # tag: 5.0-apache + # -- The monica image pull policy pullPolicy: IfNotPresent - # pullSecrets: + # -- Optionally specify an array of imagePullSecrets. + pullSecrets: [] # - myRegistrKeySecretName # -- Add a suffix to the name of the chart @@ -15,10 +19,12 @@ fullnameOverride: "" podAnnotations: {} # -- Labels to be added at 'pod' level podLabels: {} -# -- Annotations to be added at 'service' level +# -- Annotations to be added at 'deployment' level deploymentAnnotations: {} +# -- Labels to be added at 'deployment' level +deploymentLabels: {} -# -- Number of replicas to be deployed +# -- Number of pods to be deployed replicaCount: 1 ## Allowing use of ingress controllers @@ -164,6 +170,9 @@ monica: # postStartCommand: [] # preStopCommand: [] + # -- cronjob resources definition (limits, requests) + resources: {} + ## ## Queue job to execute monica background tasks ## Use in addition to a `QUEUE_CONNECTION` variable @@ -177,17 +186,25 @@ monica: lifecycle: {} # postStartCommand: [] # preStopCommand: [] + + # -- queue job resources definition (limits, requests) + resources: {} + # @ignored priorityClassName: important # @ignored terminationGracePeriodSeconds: 20 + nginx: # -- Enable nginx. You need to set an fpm version of the image for monica if you want to use nginx. enabled: false image: + # -- The nginx image repository to pull from repository: nginx + # -- The nginx image tag to pull tag: alpine + # -- The nginx image pull policy pullPolicy: IfNotPresent # -- Customize container port @@ -201,16 +218,6 @@ nginx: # -- nginx resources definition (limits, requests) resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi ## ## Internal database configuration (SQLite) @@ -419,38 +426,59 @@ resources: {} livenessProbe: # -- Enable liveness probe enabled: true + # -- Delay before this probe is initiated initialDelaySeconds: 10 + # -- How often to perform the probe periodSeconds: 10 + # -- When the probe times out timeoutSeconds: 5 + # -- Minimum consecutive failures for the probe failureThreshold: 3 + # -- Minimum consecutive successes for the probe successThreshold: 1 readinessProbe: # -- Enable readiness probe enabled: true + # -- Delay before this probe is initiated initialDelaySeconds: 10 + # -- How often to perform the probe periodSeconds: 10 + # -- When the probe times out timeoutSeconds: 5 + # -- Minimum consecutive failures for the probe failureThreshold: 3 + # -- Minimum consecutive successes for the probe successThreshold: 1 startupProbe: # -- Enable startup probe enabled: false + # -- Delay before this probe is initiated initialDelaySeconds: 30 + # -- How often to perform the probe periodSeconds: 10 + # -- When the probe times out timeoutSeconds: 5 + # -- Minimum consecutive failures for the probe failureThreshold: 30 + # -- Minimum consecutive successes for the probe successThreshold: 1 ## Enable pod autoscaling using HorizontalPodAutoscaler ## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ ## -hpa: - # -- Enable Horizontal Pod Autoscaler +autoscaling: + # -- Enable autoscaling enabled: false - cputhreshold: 60 - minPods: 1 - maxPods: 10 + # -- Minimum number of replicas to scale back + minReplicas: + # -- Maximum number of replicas to scale out + maxReplicas: + # -- Target CPU utilization percentage + targetCPU: + # -- Target Memory utilization percentage + targetMemory: + # -- Node labels for pod assignment nodeSelector: {} From b08f282df9a2a883360007334285d7c64a1dafc9 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Thu, 31 Oct 2024 08:33:53 +0100 Subject: [PATCH 3/6] add schema --- .github/workflows/docs.yml | 27 +- .pre-commit-config.yaml | 6 + .schema.yaml | 11 + charts/monica/values.schema copy.json | 614 ++++++++++++++++++++++++ charts/monica/values.schema.json | 658 ++++++++++++++++++++++++++ 5 files changed, 1315 insertions(+), 1 deletion(-) create mode 100644 .schema.yaml create mode 100644 charts/monica/values.schema copy.json create mode 100644 charts/monica/values.schema.json diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d9fac4f..aa3091f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,10 +4,13 @@ on: pull_request: types: [opened, synchronize, reopened] +env: + helm: v3.16.2 + jobs: docs: - runs-on: ubuntu-latest name: Helm docs + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -23,3 +26,25 @@ jobs: echo "::error::Changes waiting. Please run 'helm-docs' prior to your next commit." exit -1 fi + + schema: + name: Generate schema file + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v4 + with: + version: ${{ env.helm }} + + - name: Generate schema file + uses: losisin/helm-values-schema-json-action@v1 + with: + input: charts/monica/values.yaml + output: charts/monica/values.schema.json + indent: 2 + fail-on-diff: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index befe931..7a77794 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,3 +3,9 @@ repos: rev: v1.14.2 hooks: - id: helm-docs + + - repo: https://github.com/losisin/helm-values-schema-json + rev: v1.6.1 + hooks: + - id: helm-schema + args: ["-input", "charts/monica/values.yaml", "-output", "charts/monica/values.schema.json", "-indent", "2"] diff --git a/.schema.yaml b/.schema.yaml new file mode 100644 index 0000000..d393afd --- /dev/null +++ b/.schema.yaml @@ -0,0 +1,11 @@ +# Required +input: + - charts/monica/values.yaml + +indent: 2 +output: charts/monica/values.schema.json + +schemaRoot: + id: https://example.com/schema + title: Monica Helm Charts Values Schema + description: Schema for Helm values diff --git a/charts/monica/values.schema copy.json b/charts/monica/values.schema copy.json new file mode 100644 index 0000000..05782fe --- /dev/null +++ b/charts/monica/values.schema copy.json @@ -0,0 +1,614 @@ +{ + "$id": "https://example.com/schema", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "additionalProperties": true, + "description": "Schema for Helm values", + "properties": { + "affinity": { + "properties": {}, + "type": "object" + }, + "deploymentAnnotations": { + "properties": {}, + "type": "object" + }, + "externalDatabase": { + "properties": { + "database": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "existingSecret": { + "properties": { + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "host": { + "type": "null" + }, + "password": { + "type": "string" + }, + "type": { + "type": "string" + }, + "user": { + "type": "string" + } + }, + "type": "object" + }, + "fullnameOverride": { + "type": "string" + }, + "hpa": { + "properties": { + "cputhreshold": { + "type": "integer" + }, + "enabled": { + "type": "boolean" + }, + "maxPods": { + "type": "integer" + }, + "minPods": { + "type": "integer" + } + }, + "type": "object" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "ingress": { + "properties": { + "annotations": { + "properties": {}, + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "labels": { + "properties": {}, + "type": "object" + }, + "path": { + "type": "string" + }, + "pathType": { + "type": "string" + } + }, + "type": "object" + }, + "internalDatabase": { + "properties": { + "enabled": { + "type": "boolean" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "lifecycle": { + "properties": {}, + "type": "object" + }, + "livenessProbe": { + "properties": { + "enabled": { + "type": "boolean" + }, + "failureThreshold": { + "type": "integer" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "successThreshold": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "mariadb": { + "properties": { + "architecture": { + "type": "string" + }, + "auth": { + "properties": { + "database": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "primary": { + "properties": { + "persistence": { + "properties": { + "accessMode": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "size": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "meilisearch": { + "properties": { + "enabled": { + "type": "boolean" + }, + "environment": { + "properties": { + "MEILI_ENV": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "memcached": { + "properties": { + "auth": { + "properties": { + "enabled": { + "type": "boolean" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "type": "object" + }, + "containerSecurityContext": { + "properties": { + "readOnlyRootFilesystem": { + "type": "boolean" + } + }, + "type": "object" + }, + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "monica": { + "properties": { + "cronjob": { + "properties": { + "enabled": { + "type": "boolean" + }, + "lifecycle": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "existingSecret": { + "properties": { + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "extraEnv": { + "type": "null" + }, + "extraInitContainers": { + "type": "array" + }, + "extraSidecarContainers": { + "type": "array" + }, + "extraVolumeMounts": { + "type": "null" + }, + "extraVolumes": { + "type": "null" + }, + "host": { + "type": "string" + }, + "mail": { + "properties": { + "enabled": { + "type": "boolean" + }, + "fromAddress": { + "type": "string" + }, + "replyToAddress": { + "type": "string" + }, + "smtp": { + "properties": { + "encryption": { + "type": "string" + }, + "host": { + "type": "string" + }, + "password": { + "type": "string" + }, + "port": { + "type": "integer" + }, + "username": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "phpConfigs": { + "properties": {}, + "type": "object" + }, + "queue": { + "properties": { + "enabled": { + "type": "boolean" + }, + "lifecycle": { + "properties": {}, + "type": "object" + }, + "priorityClassName": { + "type": "string" + }, + "terminationGracePeriodSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "storagedir": { + "type": "string" + }, + "strategy": { + "properties": { + "type": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "nameOverride": { + "type": "string" + }, + "nginx": { + "properties": { + "config": { + "properties": { + "default": { + "type": "boolean" + } + }, + "type": "object" + }, + "containerPort": { + "type": "integer" + }, + "enabled": { + "type": "boolean" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "resources": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "nodeSelector": { + "properties": {}, + "type": "object" + }, + "persistence": { + "properties": { + "accessMode": { + "type": "string" + }, + "annotations": { + "properties": {}, + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "size": { + "type": "string" + } + }, + "type": "object" + }, + "podAnnotations": { + "properties": {}, + "type": "object" + }, + "podLabels": { + "properties": {}, + "type": "object" + }, + "postgresql": { + "properties": { + "enabled": { + "type": "boolean" + }, + "global": { + "properties": { + "postgresql": { + "properties": { + "auth": { + "properties": { + "database": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "primary": { + "properties": { + "persistence": { + "properties": { + "enabled": { + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "rbac": { + "properties": { + "create": { + "type": "boolean" + } + }, + "type": "object" + }, + "readinessProbe": { + "properties": { + "enabled": { + "type": "boolean" + }, + "failureThreshold": { + "type": "integer" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "successThreshold": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "redis": { + "properties": { + "auth": { + "properties": { + "enabled": { + "type": "boolean" + }, + "password": { + "type": "string" + } + }, + "type": "object" + }, + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "replicaCount": { + "type": "integer" + }, + "resources": { + "properties": {}, + "type": "object" + }, + "service": { + "properties": { + "annotations": { + "properties": {}, + "type": "object" + }, + "loadBalancerIP": { + "type": "string" + }, + "nodePort": { + "type": "null" + }, + "port": { + "type": "integer" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "serviceAccount": { + "properties": { + "annotations": { + "properties": {}, + "type": "object" + }, + "create": { + "type": "boolean" + }, + "name": { + "type": "null" + } + }, + "type": "object" + }, + "startupProbe": { + "properties": { + "enabled": { + "type": "boolean" + }, + "failureThreshold": { + "type": "integer" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "successThreshold": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "tests": { + "properties": { + "unitTests": { + "properties": { + "resources": { + "properties": { + "limits": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + }, + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "tolerations": { + "type": "array" + } + }, + "title": "Monica Helm Charts Values Schema", + "type": "object" +} diff --git a/charts/monica/values.schema.json b/charts/monica/values.schema.json new file mode 100644 index 0000000..12abe5d --- /dev/null +++ b/charts/monica/values.schema.json @@ -0,0 +1,658 @@ +{ + "$id": "https://example.com/schema", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "description": "Schema for Helm values", + "properties": { + "affinity": { + "properties": {}, + "type": "object" + }, + "autoscaling": { + "properties": { + "enabled": { + "type": "boolean" + }, + "maxReplicas": { + "type": "null" + }, + "minReplicas": { + "type": "null" + }, + "targetCPU": { + "type": "null" + }, + "targetMemory": { + "type": "null" + } + }, + "type": "object" + }, + "deploymentAnnotations": { + "properties": {}, + "type": "object" + }, + "deploymentLabels": { + "properties": {}, + "type": "object" + }, + "externalDatabase": { + "properties": { + "database": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "existingSecret": { + "properties": { + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "host": { + "type": "null" + }, + "password": { + "type": "string" + }, + "type": { + "type": "string" + }, + "user": { + "type": "string" + } + }, + "type": "object" + }, + "fullnameOverride": { + "type": "string" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "pullSecrets": { + "type": "array" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "ingress": { + "properties": { + "annotations": { + "properties": {}, + "type": "object" + }, + "className": { + "type": "null" + }, + "enabled": { + "type": "boolean" + }, + "labels": { + "properties": {}, + "type": "object" + }, + "path": { + "type": "string" + }, + "pathType": { + "type": "string" + } + }, + "type": "object" + }, + "internalDatabase": { + "properties": { + "enabled": { + "type": "boolean" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "lifecycle": { + "properties": {}, + "type": "object" + }, + "livenessProbe": { + "properties": { + "enabled": { + "type": "boolean" + }, + "failureThreshold": { + "type": "integer" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "successThreshold": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "mariadb": { + "properties": { + "architecture": { + "type": "string" + }, + "auth": { + "properties": { + "database": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "primary": { + "properties": { + "persistence": { + "properties": { + "accessMode": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "existingClaim": { + "type": "null" + }, + "size": { + "type": "string" + }, + "storageClass": { + "type": "null" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "meilisearch": { + "properties": { + "enabled": { + "type": "boolean" + }, + "environment": { + "properties": { + "MEILI_ENV": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "memcached": { + "properties": { + "auth": { + "properties": { + "enabled": { + "type": "boolean" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "type": "object" + }, + "containerSecurityContext": { + "properties": { + "readOnlyRootFilesystem": { + "type": "boolean" + } + }, + "type": "object" + }, + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "monica": { + "properties": { + "containerPort": { + "type": "integer" + }, + "cronjob": { + "properties": { + "enabled": { + "type": "boolean" + }, + "lifecycle": { + "properties": {}, + "type": "object" + }, + "resources": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "existingSecret": { + "properties": { + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "extraEnv": { + "type": "array" + }, + "extraInitContainers": { + "type": "array" + }, + "extraSidecarContainers": { + "type": "array" + }, + "extraVolumeMounts": { + "type": "array" + }, + "extraVolumes": { + "type": "array" + }, + "host": { + "type": "string" + }, + "mail": { + "properties": { + "enabled": { + "type": "boolean" + }, + "fromAddress": { + "type": "string" + }, + "replyToAddress": { + "type": "string" + }, + "smtp": { + "properties": { + "encryption": { + "type": "string" + }, + "host": { + "type": "string" + }, + "password": { + "type": "string" + }, + "port": { + "type": "integer" + }, + "username": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "phpConfigs": { + "properties": {}, + "type": "object" + }, + "queue": { + "properties": { + "enabled": { + "type": "boolean" + }, + "lifecycle": { + "properties": {}, + "type": "object" + }, + "priorityClassName": { + "type": "string" + }, + "resources": { + "properties": {}, + "type": "object" + }, + "terminationGracePeriodSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "storagedir": { + "type": "string" + }, + "strategy": { + "properties": { + "type": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "nameOverride": { + "type": "string" + }, + "nginx": { + "properties": { + "config": { + "properties": { + "custom": { + "type": "null" + }, + "default": { + "type": "boolean" + } + }, + "type": "object" + }, + "containerPort": { + "type": "integer" + }, + "enabled": { + "type": "boolean" + }, + "image": { + "properties": { + "pullPolicy": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "resources": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "nodeSelector": { + "properties": {}, + "type": "object" + }, + "persistence": { + "properties": { + "accessMode": { + "type": "string" + }, + "annotations": { + "properties": {}, + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "existingClaim": { + "type": "null" + }, + "size": { + "type": "string" + }, + "storageClass": { + "type": "null" + } + }, + "type": "object" + }, + "podAnnotations": { + "properties": {}, + "type": "object" + }, + "podLabels": { + "properties": {}, + "type": "object" + }, + "postgresql": { + "properties": { + "enabled": { + "type": "boolean" + }, + "global": { + "properties": { + "postgresql": { + "properties": { + "auth": { + "properties": { + "database": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "primary": { + "properties": { + "persistence": { + "properties": { + "enabled": { + "type": "boolean" + }, + "existingClaim": { + "type": "null" + }, + "storageClass": { + "type": "null" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "rbac": { + "properties": { + "create": { + "type": "boolean" + } + }, + "type": "object" + }, + "readinessProbe": { + "properties": { + "enabled": { + "type": "boolean" + }, + "failureThreshold": { + "type": "integer" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "successThreshold": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "redis": { + "properties": { + "auth": { + "properties": { + "enabled": { + "type": "boolean" + }, + "password": { + "type": "string" + } + }, + "type": "object" + }, + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "replicaCount": { + "type": "integer" + }, + "resources": { + "properties": {}, + "type": "object" + }, + "service": { + "properties": { + "annotations": { + "properties": {}, + "type": "object" + }, + "loadBalancerIP": { + "type": "string" + }, + "nodePort": { + "type": "null" + }, + "port": { + "type": "integer" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "serviceAccount": { + "properties": { + "annotations": { + "properties": {}, + "type": "object" + }, + "create": { + "type": "boolean" + }, + "name": { + "type": "null" + } + }, + "type": "object" + }, + "startupProbe": { + "properties": { + "enabled": { + "type": "boolean" + }, + "failureThreshold": { + "type": "integer" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "successThreshold": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "tests": { + "properties": { + "unitTests": { + "properties": { + "resources": { + "properties": { + "limits": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + }, + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "tolerations": { + "type": "array" + } + }, + "title": "Monica Helm Charts Values Schema", + "type": "object" +} From f438ea37a2d942bd36c3ac96b933518e63584775 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Thu, 31 Oct 2024 10:12:09 +0100 Subject: [PATCH 4/6] update --- .github/workflows/tests.yml | 2 +- .schema.yaml | 3 +- charts/monica/README.md | 24 +- charts/monica/templates/hpa.yaml | 4 + charts/monica/templates/service.yaml | 19 +- charts/monica/values.schema copy.json | 614 -------------------------- charts/monica/values.schema.json | 75 +++- charts/monica/values.yaml | 71 +-- 8 files changed, 123 insertions(+), 689 deletions(-) delete mode 100644 charts/monica/values.schema copy.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f1678a2..846960a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,7 +56,7 @@ jobs: helm_args: '--set=nginx.enabled=true --set=image.tag=main-fpm' - name: Horizontal Pod Autoscaling Enabled - helm_args: '--set=hpa.enabled=true --set=hpa.minPods=2 --set=hpa.maxPods=3 --set=hpa.cputhreshold=75' + helm_args: '--set=autoscaling.enabled=true --set=autoscaling.miniReplicas=2 --set=autoscaling.maxReplicas=3 --set=autoscaling.targetCPU=75 --set=autoscaling.targetMemory=75' - name: Redis and queue enabled file: redis.yaml diff --git a/.schema.yaml b/.schema.yaml index d393afd..a2eaf14 100644 --- a/.schema.yaml +++ b/.schema.yaml @@ -6,6 +6,7 @@ indent: 2 output: charts/monica/values.schema.json schemaRoot: - id: https://example.com/schema + id: https://monicahq.github.io/helm/schema title: Monica Helm Charts Values Schema description: Schema for Helm values + additionalProperties: true diff --git a/charts/monica/README.md b/charts/monica/README.md index bf928cb..2e32d2e 100644 --- a/charts/monica/README.md +++ b/charts/monica/README.md @@ -61,7 +61,7 @@ Kubernetes: `>=1.16.0-0` | externalDatabase.database | string | `"monica"` | Database name | | externalDatabase.enabled | bool | `false` | Enable external database | | externalDatabase.existingSecret.enabled | bool | `false` | Use an existing secret. If enabled set: `secretName`, `usernameKey`, `passwordKey` | -| externalDatabase.host | string | `nil` | Database host | +| externalDatabase.host | string | `""` | Database host | | externalDatabase.password | string | `"secret"` | Database password | | externalDatabase.type | string | `"mysql"` | Database type. Supported database engines: `mysql` or `postgresql` | | externalDatabase.user | string | `"monica"` | Database user | @@ -71,7 +71,7 @@ Kubernetes: `>=1.16.0-0` | image.repository | string | `"ghcr.io/monicahq/monica-next"` | The monica image repository to pull from | | image.tag | string | `"main"` | The monica image tag to pull | | ingress.annotations | object | `{}` | An array of service annotations | -| ingress.className | string | `nil` | Name of the ingress class to use | +| ingress.className | string | `""` | Name of the ingress class to use | | ingress.enabled | bool | `false` | Enable ingress controller resource | | ingress.labels | object | `{}` | An array of service labels | | ingress.path | string | `"/"` | The Path to use in Ingress' paths | @@ -92,9 +92,9 @@ Kubernetes: `>=1.16.0-0` | mariadb.enabled | bool | `false` | Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters | | mariadb.primary.persistence.accessMode | string | `"ReadWriteOnce"` | Access Mode for the PVC | | mariadb.primary.persistence.enabled | bool | `false` | Enable MariaDB persistence using Persistent Volume Claims | -| mariadb.primary.persistence.existingClaim | string | `nil` | Use an existing Persistent Volume Claim (must be created ahead of time) | +| mariadb.primary.persistence.existingClaim | string | `""` | Use an existing Persistent Volume Claim (must be created ahead of time) | | mariadb.primary.persistence.size | string | `"8Gi"` | PVC Storage Request | -| mariadb.primary.persistence.storageClass | string | `nil` | Storage class of backing PVC | +| mariadb.primary.persistence.storageClass | string | `""` | Storage class of backing PVC | | meilisearch.enabled | bool | `false` | Enable Meilisearch. Use with `SCOUT_DRIVER=meilisearch` and `SCOUT_QUEUE=true` variables. | | meilisearch.environment.MEILI_ENV | string | `"production"` | | | memcached.auth.enabled | bool | `true` | Enable memcached authentication | @@ -104,7 +104,6 @@ Kubernetes: `>=1.16.0-0` | memcached.enabled | bool | `false` | Enable Memcached. Use with a `CACHE_STORE=memcached` variable (can also be used for `SESSION_DRIVER`). | | monica.containerPort | int | `80` | Customize container port | | monica.cronjob.enabled | bool | `false` | Enable cronjob to execute monica scheduled tasks | -| monica.cronjob.lifecycle | object | `{}` | Allow configuration of lifecycle hooks. ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ | | monica.cronjob.resources | object | `{}` | cronjob resources definition (limits, requests) | | monica.existingSecret.enabled | bool | `false` | Use an existing secret. If enabled, you need to set: `secretName`, `appKey`, `mailUsernameKey`, `mailPasswordKey` | | monica.extraEnv | list | `[]` | Extra environment variables | @@ -128,7 +127,7 @@ Kubernetes: `>=1.16.0-0` | monica.storagedir | string | `"/var/www/html/storage"` | Monica storage directory | | monica.strategy | object | `{"type":"Recreate"}` | Strategy used to replace old pods. IMPORTANT: use with care, it is suggested to leave as that for upgrade purposes. ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy | | nameOverride | string | `""` | Add a suffix to the name of the chart | -| nginx.config.custom | string | `nil` | Custom nginx configuration | +| nginx.config.custom | string | `""` | Custom nginx configuration | | nginx.config.default | bool | `true` | Generates the default nginx config | | nginx.containerPort | int | `80` | Customize container port | | nginx.enabled | bool | `false` | Enable nginx. You need to set an fpm version of the image for monica if you want to use nginx. | @@ -140,9 +139,9 @@ Kubernetes: `>=1.16.0-0` | persistence.accessMode | string | `"ReadWriteOnce"` | Persistent Volume Access Mode | | persistence.annotations | object | `{}` | Persistent Volume Claim annotations | | persistence.enabled | bool | `false` | Enable Monica persistence using Persistent Volume Claims | -| persistence.existingClaim | string | `nil` | A manually managed Persistent Volume and Claim Requires persistence.enabled: true If defined, PVC must be created manually before volume will be bound | +| persistence.existingClaim | string | `""` | A manually managed Persistent Volume and Claim Requires persistence.enabled: true If defined, PVC must be created manually before volume will be bound | | persistence.size | string | `"4Gi"` | Persistent Volume Storage Request | -| persistence.storageClass | string | `nil` | Persistent Volume Storage Class If defined, storageClassName: If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. (gp2 on AWS, standard on GKE, AWS & OpenStack) | +| persistence.storageClass | string | `""` | Persistent Volume Storage Class If defined, storageClassName: If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. (gp2 on AWS, standard on GKE, AWS & OpenStack) | | podAnnotations | object | `{}` | Annotations to be added at 'pod' level | | podLabels | object | `{}` | Labels to be added at 'pod' level | | postgresql.enabled | bool | `false` | Whether to deploy a postgresql server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters | @@ -150,8 +149,8 @@ Kubernetes: `>=1.16.0-0` | postgresql.global.postgresql.auth.password | string | `"secret"` | Database password | | postgresql.global.postgresql.auth.username | string | `"monica"` | Database user | | postgresql.primary.persistence.enabled | bool | `false` | Enable PostgreSQL persistence using Persistent Volume Claims | -| postgresql.primary.persistence.existingClaim | string | `nil` | Use an existing Persistent Volume Claim (must be created ahead of time) | -| postgresql.primary.persistence.storageClass | string | `nil` | Storage class of backing PVC | +| postgresql.primary.persistence.existingClaim | string | `""` | Use an existing Persistent Volume Claim (must be created ahead of time) | +| postgresql.primary.persistence.storageClass | string | `""` | Storage class of backing PVC | | rbac.create | bool | `true` | Specifies whether RBAC resources should be created | | readinessProbe.enabled | bool | `true` | Enable readiness probe | | readinessProbe.failureThreshold | int | `3` | Minimum consecutive failures for the probe | @@ -165,13 +164,16 @@ Kubernetes: `>=1.16.0-0` | replicaCount | int | `1` | Number of pods to be deployed | | resources | object | `{}` | Define resources requests and limits for the pod (limits, requests) | | service.annotations | object | `{}` | Service annotations | +| service.loadBalancerClass | string | `""` | Load Balancer Class (optional, only works with service.type LoadBalancer) | | service.loadBalancerIP | string | `""` | Load Balancer IP (optional, only works with service.type LoadBalancer) | | service.nodePort | string | `nil` | Node Port (optional, only works with service.type NodePort) | | service.port | int | `8080` | Service port | +| service.sessionAffinity | string | `"None"` | Session Affinity for Kubernetes service, can be "None" or "ClientIP" # If "ClientIP", consecutive client requests will be directed to the same Pod # ref: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies | +| service.sessionAffinityConfig | object | `{}` | Additional settings for the sessionAffinity # sessionAffinityConfig: # clientIP: # timeoutSeconds: 300 | | service.type | string | `"ClusterIP"` | Service type | | serviceAccount.annotations | object | `{}` | Annotations to add to the service account | | serviceAccount.create | bool | `true` | Specifies whether a service account should be created | -| serviceAccount.name | string | `nil` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | +| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | | startupProbe.enabled | bool | `false` | Enable startup probe | | startupProbe.failureThreshold | int | `30` | Minimum consecutive failures for the probe | | startupProbe.initialDelaySeconds | int | `30` | Delay before this probe is initiated | diff --git a/charts/monica/templates/hpa.yaml b/charts/monica/templates/hpa.yaml index 78a4692..fd414d9 100644 --- a/charts/monica/templates/hpa.yaml +++ b/charts/monica/templates/hpa.yaml @@ -1,6 +1,10 @@ {{- if .Values.autoscaling.enabled }} --- +{{- if semverCompare "<1.23-0" $.Capabilities.KubeVersion.GitVersion -}} apiVersion: autoscaling/v1 +{{- else }} +apiVersion: autoscaling/v2 +{{- end }} kind: HorizontalPodAutoscaler metadata: name: {{ template "monica.fullname" . }} diff --git a/charts/monica/templates/service.yaml b/charts/monica/templates/service.yaml index 5fda475..76f486c 100644 --- a/charts/monica/templates/service.yaml +++ b/charts/monica/templates/service.yaml @@ -15,17 +15,20 @@ spec: {{- include "monica.selectorLabels" . | nindent 4 }} app.kubernetes.io/component: app type: {{ .Values.service.type }} - {{- if (eq .Values.service.type "LoadBalancer") }} + {{- with .Values.service.sessionAffinity }} + sessionAffinity: {{ . }} + {{- end }} + {{- with .Values.service.sessionAffinityConfig }} + sessionAffinityConfig: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if eq .Values.service.type "LoadBalancer" }} {{- with .Values.service.loadBalancerIP }} loadBalancerIP: {{ . }} {{- end }} + {{- with .Values.service.loadBalancerClass }} + loadBalancerIP: {{ . }} {{- end }} - {{- with .Values.service.ipFamilies }} - ipFamilies: - {{- toYaml . | nindent 4 }} - {{- end }} - {{- with .Values.service.ipFamilyPolicy }} - ipFamilyPolicy: {{ . }} {{- end }} ports: - port: {{ .Values.service.port }} @@ -36,6 +39,8 @@ spec: {{- end }} protocol: TCP name: http + {{- if or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer") }} {{- with .Values.service.nodePort }} nodePort: {{ . }} {{- end }} + {{- end }} diff --git a/charts/monica/values.schema copy.json b/charts/monica/values.schema copy.json deleted file mode 100644 index 05782fe..0000000 --- a/charts/monica/values.schema copy.json +++ /dev/null @@ -1,614 +0,0 @@ -{ - "$id": "https://example.com/schema", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "additionalProperties": true, - "description": "Schema for Helm values", - "properties": { - "affinity": { - "properties": {}, - "type": "object" - }, - "deploymentAnnotations": { - "properties": {}, - "type": "object" - }, - "externalDatabase": { - "properties": { - "database": { - "type": "string" - }, - "enabled": { - "type": "boolean" - }, - "existingSecret": { - "properties": { - "enabled": { - "type": "boolean" - } - }, - "type": "object" - }, - "host": { - "type": "null" - }, - "password": { - "type": "string" - }, - "type": { - "type": "string" - }, - "user": { - "type": "string" - } - }, - "type": "object" - }, - "fullnameOverride": { - "type": "string" - }, - "hpa": { - "properties": { - "cputhreshold": { - "type": "integer" - }, - "enabled": { - "type": "boolean" - }, - "maxPods": { - "type": "integer" - }, - "minPods": { - "type": "integer" - } - }, - "type": "object" - }, - "image": { - "properties": { - "pullPolicy": { - "type": "string" - }, - "repository": { - "type": "string" - }, - "tag": { - "type": "string" - } - }, - "type": "object" - }, - "ingress": { - "properties": { - "annotations": { - "properties": {}, - "type": "object" - }, - "enabled": { - "type": "boolean" - }, - "labels": { - "properties": {}, - "type": "object" - }, - "path": { - "type": "string" - }, - "pathType": { - "type": "string" - } - }, - "type": "object" - }, - "internalDatabase": { - "properties": { - "enabled": { - "type": "boolean" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "lifecycle": { - "properties": {}, - "type": "object" - }, - "livenessProbe": { - "properties": { - "enabled": { - "type": "boolean" - }, - "failureThreshold": { - "type": "integer" - }, - "initialDelaySeconds": { - "type": "integer" - }, - "periodSeconds": { - "type": "integer" - }, - "successThreshold": { - "type": "integer" - }, - "timeoutSeconds": { - "type": "integer" - } - }, - "type": "object" - }, - "mariadb": { - "properties": { - "architecture": { - "type": "string" - }, - "auth": { - "properties": { - "database": { - "type": "string" - }, - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - }, - "type": "object" - }, - "enabled": { - "type": "boolean" - }, - "primary": { - "properties": { - "persistence": { - "properties": { - "accessMode": { - "type": "string" - }, - "enabled": { - "type": "boolean" - }, - "size": { - "type": "string" - } - }, - "type": "object" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "meilisearch": { - "properties": { - "enabled": { - "type": "boolean" - }, - "environment": { - "properties": { - "MEILI_ENV": { - "type": "string" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "memcached": { - "properties": { - "auth": { - "properties": { - "enabled": { - "type": "boolean" - }, - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - }, - "type": "object" - }, - "containerSecurityContext": { - "properties": { - "readOnlyRootFilesystem": { - "type": "boolean" - } - }, - "type": "object" - }, - "enabled": { - "type": "boolean" - } - }, - "type": "object" - }, - "monica": { - "properties": { - "cronjob": { - "properties": { - "enabled": { - "type": "boolean" - }, - "lifecycle": { - "properties": {}, - "type": "object" - } - }, - "type": "object" - }, - "existingSecret": { - "properties": { - "enabled": { - "type": "boolean" - } - }, - "type": "object" - }, - "extraEnv": { - "type": "null" - }, - "extraInitContainers": { - "type": "array" - }, - "extraSidecarContainers": { - "type": "array" - }, - "extraVolumeMounts": { - "type": "null" - }, - "extraVolumes": { - "type": "null" - }, - "host": { - "type": "string" - }, - "mail": { - "properties": { - "enabled": { - "type": "boolean" - }, - "fromAddress": { - "type": "string" - }, - "replyToAddress": { - "type": "string" - }, - "smtp": { - "properties": { - "encryption": { - "type": "string" - }, - "host": { - "type": "string" - }, - "password": { - "type": "string" - }, - "port": { - "type": "integer" - }, - "username": { - "type": "string" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "phpConfigs": { - "properties": {}, - "type": "object" - }, - "queue": { - "properties": { - "enabled": { - "type": "boolean" - }, - "lifecycle": { - "properties": {}, - "type": "object" - }, - "priorityClassName": { - "type": "string" - }, - "terminationGracePeriodSeconds": { - "type": "integer" - } - }, - "type": "object" - }, - "storagedir": { - "type": "string" - }, - "strategy": { - "properties": { - "type": { - "type": "string" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "nameOverride": { - "type": "string" - }, - "nginx": { - "properties": { - "config": { - "properties": { - "default": { - "type": "boolean" - } - }, - "type": "object" - }, - "containerPort": { - "type": "integer" - }, - "enabled": { - "type": "boolean" - }, - "image": { - "properties": { - "pullPolicy": { - "type": "string" - }, - "repository": { - "type": "string" - }, - "tag": { - "type": "string" - } - }, - "type": "object" - }, - "resources": { - "properties": {}, - "type": "object" - } - }, - "type": "object" - }, - "nodeSelector": { - "properties": {}, - "type": "object" - }, - "persistence": { - "properties": { - "accessMode": { - "type": "string" - }, - "annotations": { - "properties": {}, - "type": "object" - }, - "enabled": { - "type": "boolean" - }, - "size": { - "type": "string" - } - }, - "type": "object" - }, - "podAnnotations": { - "properties": {}, - "type": "object" - }, - "podLabels": { - "properties": {}, - "type": "object" - }, - "postgresql": { - "properties": { - "enabled": { - "type": "boolean" - }, - "global": { - "properties": { - "postgresql": { - "properties": { - "auth": { - "properties": { - "database": { - "type": "string" - }, - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - }, - "type": "object" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "primary": { - "properties": { - "persistence": { - "properties": { - "enabled": { - "type": "boolean" - } - }, - "type": "object" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "rbac": { - "properties": { - "create": { - "type": "boolean" - } - }, - "type": "object" - }, - "readinessProbe": { - "properties": { - "enabled": { - "type": "boolean" - }, - "failureThreshold": { - "type": "integer" - }, - "initialDelaySeconds": { - "type": "integer" - }, - "periodSeconds": { - "type": "integer" - }, - "successThreshold": { - "type": "integer" - }, - "timeoutSeconds": { - "type": "integer" - } - }, - "type": "object" - }, - "redis": { - "properties": { - "auth": { - "properties": { - "enabled": { - "type": "boolean" - }, - "password": { - "type": "string" - } - }, - "type": "object" - }, - "enabled": { - "type": "boolean" - } - }, - "type": "object" - }, - "replicaCount": { - "type": "integer" - }, - "resources": { - "properties": {}, - "type": "object" - }, - "service": { - "properties": { - "annotations": { - "properties": {}, - "type": "object" - }, - "loadBalancerIP": { - "type": "string" - }, - "nodePort": { - "type": "null" - }, - "port": { - "type": "integer" - }, - "type": { - "type": "string" - } - }, - "type": "object" - }, - "serviceAccount": { - "properties": { - "annotations": { - "properties": {}, - "type": "object" - }, - "create": { - "type": "boolean" - }, - "name": { - "type": "null" - } - }, - "type": "object" - }, - "startupProbe": { - "properties": { - "enabled": { - "type": "boolean" - }, - "failureThreshold": { - "type": "integer" - }, - "initialDelaySeconds": { - "type": "integer" - }, - "periodSeconds": { - "type": "integer" - }, - "successThreshold": { - "type": "integer" - }, - "timeoutSeconds": { - "type": "integer" - } - }, - "type": "object" - }, - "tests": { - "properties": { - "unitTests": { - "properties": { - "resources": { - "properties": { - "limits": { - "properties": { - "cpu": { - "type": "string" - }, - "memory": { - "type": "string" - } - }, - "type": "object" - }, - "requests": { - "properties": { - "cpu": { - "type": "string" - }, - "memory": { - "type": "string" - } - }, - "type": "object" - } - }, - "type": "object" - } - }, - "type": "object" - } - }, - "type": "object" - }, - "tolerations": { - "type": "array" - } - }, - "title": "Monica Helm Charts Values Schema", - "type": "object" -} diff --git a/charts/monica/values.schema.json b/charts/monica/values.schema.json index 12abe5d..298d8ac 100644 --- a/charts/monica/values.schema.json +++ b/charts/monica/values.schema.json @@ -1,6 +1,7 @@ { - "$id": "https://example.com/schema", + "$id": "https://monicahq.github.io/helm/schema", "$schema": "https://json-schema.org/draft/2020-12/schema", + "additionalProperties": true, "description": "Schema for Helm values", "properties": { "affinity": { @@ -13,16 +14,28 @@ "type": "boolean" }, "maxReplicas": { - "type": "null" + "type": [ + "integer", + "null" + ] }, "minReplicas": { - "type": "null" + "type": [ + "integer", + "null" + ] }, "targetCPU": { - "type": "null" + "type": [ + "integer", + "null" + ] }, "targetMemory": { - "type": "null" + "type": [ + "integer", + "null" + ] } }, "type": "object" @@ -52,7 +65,7 @@ "type": "object" }, "host": { - "type": "null" + "type": "string" }, "password": { "type": "string" @@ -84,6 +97,10 @@ "type": "string" } }, + "required": [ + "repository", + "tag" + ], "type": "object" }, "ingress": { @@ -93,7 +110,7 @@ "type": "object" }, "className": { - "type": "null" + "type": "string" }, "enabled": { "type": "boolean" @@ -182,13 +199,13 @@ "type": "boolean" }, "existingClaim": { - "type": "null" + "type": "string" }, "size": { "type": "string" }, "storageClass": { - "type": "null" + "type": "string" } }, "type": "object" @@ -255,10 +272,6 @@ "enabled": { "type": "boolean" }, - "lifecycle": { - "properties": {}, - "type": "object" - }, "resources": { "properties": {}, "type": "object" @@ -374,7 +387,7 @@ "config": { "properties": { "custom": { - "type": "null" + "type": "string" }, "default": { "type": "boolean" @@ -426,13 +439,13 @@ "type": "boolean" }, "existingClaim": { - "type": "null" + "type": "string" }, "size": { "type": "string" }, "storageClass": { - "type": "null" + "type": "string" } }, "type": "object" @@ -482,10 +495,10 @@ "type": "boolean" }, "existingClaim": { - "type": "null" + "type": "string" }, "storageClass": { - "type": "null" + "type": "string" } }, "type": "object" @@ -559,16 +572,38 @@ "properties": {}, "type": "object" }, + "loadBalancerClass": { + "type": "string" + }, "loadBalancerIP": { "type": "string" }, "nodePort": { - "type": "null" + "type": [ + "integer", + "null" + ] }, "port": { "type": "integer" }, + "sessionAffinity": { + "enum": [ + "ClusterIP", + "None" + ], + "type": "string" + }, + "sessionAffinityConfig": { + "properties": {}, + "type": "object" + }, "type": { + "enum": [ + "ClusterIP", + "LoadBalancer", + null + ], "type": "string" } }, @@ -584,7 +619,7 @@ "type": "boolean" }, "name": { - "type": "null" + "type": "string" } }, "type": "object" diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index ce18d3d..9162438 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -1,8 +1,8 @@ image: # -- The monica image repository to pull from - repository: ghcr.io/monicahq/monica-next + repository: ghcr.io/monicahq/monica-next # @schema required:true # -- The monica image tag to pull - tag: main + tag: main # @schema required:true # repository: monica # tag: 5.0-apache # -- The monica image pull policy @@ -34,7 +34,7 @@ ingress: # -- Enable ingress controller resource enabled: false # -- Name of the ingress class to use - className: + className: "" # -- An array of service annotations annotations: {} # nginx.ingress.kubernetes.io/proxy-body-size: 4G @@ -164,12 +164,6 @@ monica: # -- Enable cronjob to execute monica scheduled tasks enabled: false - # -- Allow configuration of lifecycle hooks. - # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ - lifecycle: {} - # postStartCommand: [] - # preStopCommand: [] - # -- cronjob resources definition (limits, requests) resources: {} @@ -213,7 +207,7 @@ nginx: # -- Generates the default nginx config default: true # -- Custom nginx configuration - custom: + custom: "" # worker_processes 1;.. # -- nginx resources definition (limits, requests) @@ -234,19 +228,14 @@ internalDatabase: externalDatabase: # -- Enable external database enabled: false - # -- Database type. Supported database engines: `mysql` or `postgresql` type: mysql - # -- Database host - host: - + host: "" # -- Database user user: monica - # -- Database password password: secret - # -- Database name database: monica @@ -285,9 +274,9 @@ mariadb: # -- Enable MariaDB persistence using Persistent Volume Claims enabled: false # -- Use an existing Persistent Volume Claim (must be created ahead of time) - existingClaim: + existingClaim: "" # -- Storage class of backing PVC - storageClass: + storageClass: "" # -- Access Mode for the PVC accessMode: ReadWriteOnce # -- PVC Storage Request @@ -303,20 +292,21 @@ postgresql: global: postgresql: auth: + # -- Database name + database: monica # -- Database user username: monica # -- Database password password: secret - # -- Database name - database: monica + primary: persistence: # -- Enable PostgreSQL persistence using Persistent Volume Claims enabled: false # -- Use an existing Persistent Volume Claim (must be created ahead of time) - existingClaim: + existingClaim: "" # -- Storage class of backing PVC - storageClass: + storageClass: "" ## ## Redis chart configuration @@ -330,8 +320,8 @@ redis: enabled: true # -- Redis password password: secret - # existingSecret - # existingSecretPasswordKey + # existingSecret: + # existingSecretPasswordKey: ## ## Memcached chart configuration @@ -347,8 +337,8 @@ memcached: username: monica # -- Memcached password password: secret - # existingSecret - # existingSecretPasswordKey + # existingSecret: + # existingSecretPasswordKey: containerSecurityContext: # @ignored readOnlyRootFilesystem: false @@ -368,17 +358,28 @@ meilisearch: service: # -- Service type - type: ClusterIP + type: ClusterIP # @schema enum:[ClusterIP, LoadBalancer, null] # -- Service port port: 8080 # -- Load Balancer IP (optional, only works with service.type LoadBalancer) loadBalancerIP: "" + # -- Load Balancer Class (optional, only works with service.type LoadBalancer) + loadBalancerClass: "" # -- Node Port (optional, only works with service.type NodePort) - nodePort: + nodePort: # @schema type:[integer, null] # -- Service annotations annotations: {} ## Insert your annotations such as below # test/test: pumuckel + # -- Session Affinity for Kubernetes service, can be "None" or "ClientIP" + ## If "ClientIP", consecutive client requests will be directed to the same Pod + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + sessionAffinity: None # @schema enum:[ClusterIP, None] + # -- Additional settings for the sessionAffinity + ## sessionAffinityConfig: + ## clientIP: + ## timeoutSeconds: 300 + sessionAffinityConfig: {} ## Enable persistence using Persistent Volume Claims ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ @@ -394,12 +395,12 @@ persistence: # If undefined (the default) or set to null, no storageClassName spec is # set, choosing the default provisioner. (gp2 on AWS, standard on # GKE, AWS & OpenStack) - storageClass: + storageClass: "" # -- A manually managed Persistent Volume and Claim # Requires persistence.enabled: true # If defined, PVC must be created manually before volume will be bound - existingClaim: + existingClaim: "" # -- Persistent Volume Access Mode accessMode: ReadWriteOnce @@ -471,13 +472,13 @@ autoscaling: # -- Enable autoscaling enabled: false # -- Minimum number of replicas to scale back - minReplicas: + minReplicas: # @schema type:[integer, null] # -- Maximum number of replicas to scale out - maxReplicas: + maxReplicas: # @schema type:[integer, null] # -- Target CPU utilization percentage - targetCPU: + targetCPU: # @schema type:[integer, null] # -- Target Memory utilization percentage - targetMemory: + targetMemory: # @schema type:[integer, null] # -- Node labels for pod assignment @@ -500,7 +501,7 @@ serviceAccount: annotations: {} # -- The name of the service account to use. # If not set and create is true, a name is generated using the fullname template - name: + name: "" # @ignored tests: From 1c07fe65602b82586ac68983efc0ac59ee671239 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Thu, 31 Oct 2024 10:45:19 +0100 Subject: [PATCH 5/6] fix --- charts/monica/values.schema.json | 1 + charts/monica/values.yaml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/charts/monica/values.schema.json b/charts/monica/values.schema.json index 298d8ac..5fcaa37 100644 --- a/charts/monica/values.schema.json +++ b/charts/monica/values.schema.json @@ -602,6 +602,7 @@ "enum": [ "ClusterIP", "LoadBalancer", + "NodePort", null ], "type": "string" diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index 9162438..8bca729 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -1,8 +1,8 @@ image: # -- The monica image repository to pull from - repository: ghcr.io/monicahq/monica-next # @schema required:true + repository: ghcr.io/monicahq/monica-next # @schema required:true # -- The monica image tag to pull - tag: main # @schema required:true + tag: main # @schema required:true # repository: monica # tag: 5.0-apache # -- The monica image pull policy @@ -358,7 +358,7 @@ meilisearch: service: # -- Service type - type: ClusterIP # @schema enum:[ClusterIP, LoadBalancer, null] + type: ClusterIP # @schema enum:[ClusterIP, LoadBalancer, NodePort, null] # -- Service port port: 8080 # -- Load Balancer IP (optional, only works with service.type LoadBalancer) @@ -366,7 +366,7 @@ service: # -- Load Balancer Class (optional, only works with service.type LoadBalancer) loadBalancerClass: "" # -- Node Port (optional, only works with service.type NodePort) - nodePort: # @schema type:[integer, null] + nodePort: # @schema type:[integer, null] # -- Service annotations annotations: {} ## Insert your annotations such as below @@ -374,7 +374,7 @@ service: # -- Session Affinity for Kubernetes service, can be "None" or "ClientIP" ## If "ClientIP", consecutive client requests will be directed to the same Pod ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - sessionAffinity: None # @schema enum:[ClusterIP, None] + sessionAffinity: None # @schema enum:[ClusterIP, None] # -- Additional settings for the sessionAffinity ## sessionAffinityConfig: ## clientIP: @@ -472,13 +472,13 @@ autoscaling: # -- Enable autoscaling enabled: false # -- Minimum number of replicas to scale back - minReplicas: # @schema type:[integer, null] + minReplicas: # @schema type:[integer, null] # -- Maximum number of replicas to scale out - maxReplicas: # @schema type:[integer, null] + maxReplicas: # @schema type:[integer, null] # -- Target CPU utilization percentage - targetCPU: # @schema type:[integer, null] + targetCPU: # @schema type:[integer, null] # -- Target Memory utilization percentage - targetMemory: # @schema type:[integer, null] + targetMemory: # @schema type:[integer, null] # -- Node labels for pod assignment From 9a50b3ac3da629f4b446ef356ae202ec9d61869d Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Thu, 31 Oct 2024 10:49:14 +0100 Subject: [PATCH 6/6] add tests --- .github/workflows/tests.yml | 6 +++--- charts/monica/values.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 846960a..d5b51b1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,6 @@ on: env: helm: v3.16.2 python-version: 3.x - kubectl: v1.16.0 jobs: linter: @@ -35,11 +34,12 @@ jobs: helm-tests: runs-on: ubuntu-latest - name: Helm tests (${{ matrix.test_cases.name }}) + name: Helm tests (${{ matrix.test_cases.name }}) (K8s ${{ matrix.kubectl }}) strategy: fail-fast: false matrix: + kubectl: [v1.16.0, v1.29.3] test_cases: - name: Default - no custom values @@ -98,7 +98,7 @@ jobs: uses: helm/kind-action@v1 if: steps.list-changed.outputs.changed == 'true' with: - kubectl_version: ${{ env.kubectl }} + kubectl_version: ${{ matrix.kubectl }} - name: Copy test case file if: matrix.test_cases.file != '' diff --git a/charts/monica/values.yaml b/charts/monica/values.yaml index 8bca729..baa484d 100644 --- a/charts/monica/values.yaml +++ b/charts/monica/values.yaml @@ -298,7 +298,7 @@ postgresql: username: monica # -- Database password password: secret - + primary: persistence: # -- Enable PostgreSQL persistence using Persistent Volume Claims