From 268b17f68ca5e556dc265b60b9c3e4338d6026eb Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 3 Dec 2020 19:49:11 +0500 Subject: [PATCH 01/29] Add initial nextcloud upstream chart --- test/nextcloud/2.3.2/.helmignore | 21 + test/nextcloud/2.3.2/Chart.yaml | 36 ++ test/nextcloud/2.3.2/README.md | 269 ++++++++++++ test/nextcloud/2.3.2/templates/NOTES.txt | 94 +++++ test/nextcloud/2.3.2/templates/_helpers.tpl | 49 +++ test/nextcloud/2.3.2/templates/config.yaml | 127 ++++++ test/nextcloud/2.3.2/templates/cronjob.yaml | 75 ++++ test/nextcloud/2.3.2/templates/db-secret.yaml | 22 + .../nextcloud/2.3.2/templates/deployment.yaml | 360 ++++++++++++++++ test/nextcloud/2.3.2/templates/hpa.yaml | 20 + test/nextcloud/2.3.2/templates/ingress.yaml | 31 ++ .../2.3.2/templates/metrics-deployment.yaml | 55 +++ .../2.3.2/templates/metrics-service.yaml | 31 ++ .../2.3.2/templates/nextcloud-pvc.yaml | 31 ++ .../2.3.2/templates/nginx-config.yaml | 185 ++++++++ .../nextcloud/2.3.2/templates/php-config.yaml | 16 + test/nextcloud/2.3.2/templates/secrets.yaml | 21 + test/nextcloud/2.3.2/templates/service.yaml | 25 ++ test/nextcloud/2.3.2/values.yaml | 399 ++++++++++++++++++ 19 files changed, 1867 insertions(+) create mode 100644 test/nextcloud/2.3.2/.helmignore create mode 100644 test/nextcloud/2.3.2/Chart.yaml create mode 100644 test/nextcloud/2.3.2/README.md create mode 100644 test/nextcloud/2.3.2/templates/NOTES.txt create mode 100644 test/nextcloud/2.3.2/templates/_helpers.tpl create mode 100644 test/nextcloud/2.3.2/templates/config.yaml create mode 100644 test/nextcloud/2.3.2/templates/cronjob.yaml create mode 100644 test/nextcloud/2.3.2/templates/db-secret.yaml create mode 100644 test/nextcloud/2.3.2/templates/deployment.yaml create mode 100644 test/nextcloud/2.3.2/templates/hpa.yaml create mode 100644 test/nextcloud/2.3.2/templates/ingress.yaml create mode 100644 test/nextcloud/2.3.2/templates/metrics-deployment.yaml create mode 100644 test/nextcloud/2.3.2/templates/metrics-service.yaml create mode 100644 test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml create mode 100644 test/nextcloud/2.3.2/templates/nginx-config.yaml create mode 100644 test/nextcloud/2.3.2/templates/php-config.yaml create mode 100644 test/nextcloud/2.3.2/templates/secrets.yaml create mode 100644 test/nextcloud/2.3.2/templates/service.yaml create mode 100644 test/nextcloud/2.3.2/values.yaml diff --git a/test/nextcloud/2.3.2/.helmignore b/test/nextcloud/2.3.2/.helmignore new file mode 100644 index 00000000000..f0c13194444 --- /dev/null +++ b/test/nextcloud/2.3.2/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/test/nextcloud/2.3.2/Chart.yaml b/test/nextcloud/2.3.2/Chart.yaml new file mode 100644 index 00000000000..a72306391b8 --- /dev/null +++ b/test/nextcloud/2.3.2/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v2 +name: nextcloud +version: 2.3.2 +appVersion: 19.0.3 +description: A file sharing server that puts the control and security of your own data back into your hands. +keywords: +- nextcloud +- storage +- http +- web +- php +home: https://nextcloud.com/ +icon: https://cdn.rawgit.com/docker-library/docs/defa5ffc7123177acd60ddef6e16bddf694cc35f/nextcloud/logo.svg +sources: +- https://github.com/nextcloud/helm +- https://github.com/nextcloud/docker +maintainers: +- name: skjnldsv + email: skjnldsv@protonmail.com +- name: chrisingenhaag + email: christian.ingenhaag@googlemail.com +- name: billimek + email: jeff@billimek.com +dependencies: +- name: postgresql + version: 9.8.9 + repository: https://charts.bitnami.com/bitnami + condition: postgresql.enabled +- name: mariadb + version: 7.10.2 + repository: https://charts.bitnami.com/bitnami + condition: mariadb.enabled +- name: redis + version: 11.0.5 + repository: https://charts.bitnami.com/bitnami + condition: redis.enabled diff --git a/test/nextcloud/2.3.2/README.md b/test/nextcloud/2.3.2/README.md new file mode 100644 index 00000000000..6520e833a12 --- /dev/null +++ b/test/nextcloud/2.3.2/README.md @@ -0,0 +1,269 @@ +# nextcloud + +[nextcloud](https://nextcloud.com/) is a file sharing server that puts the control and security of your own data back into your hands. + +## TL;DR; + +```console +helm repo add nextcloud https://nextcloud.github.io/helm/ +helm install my-release nextcloud/nextcloud +``` + +## Introduction + +This chart bootstraps an [nextcloud](https://hub.docker.com/_/nextcloud/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +It also packages the [Bitnami MariaDB chart](https://github.com/kubernetes/charts/tree/master/stable/mariadb) which is required for bootstrapping a MariaDB deployment for the database requirements of the nextcloud application. + +## Prerequisites + +- Kubernetes 1.9+ with Beta APIs enabled +- PV provisioner support in the underlying infrastructure + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +helm repo add nextcloud https://nextcloud.github.io/helm/ +helm install my-release nextcloud/nextcloud +``` + +The command deploys nextcloud on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## 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. + +## Configuration + +The following table lists the configurable parameters of the nextcloud chart and their default values. + +| Parameter | Description | Default | +| ------------------------------------------------------------ | ------------------------------------------------------- | ------------------------------------------- | +| `image.repository` | nextcloud Image name | `nextcloud` | +| `image.tag` | nextcloud Image tag | `{VERSION}` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `image.pullSecrets` | Specify image pull secrets | `nil` | +| `ingress.enabled` | Enable use of ingress controllers | `false` | +| `ingress.servicePort` | Ingress' backend servicePort | `http` | +| `ingress.annotations` | An array of service annotations | `nil` | +| `ingress.labels` | An array of service labels | `nil` | +| `ingress.tls` | Ingress TLS configuration | `[]` | +| `nextcloud.host` | nextcloud host to create application URLs | `nextcloud.kube.home` | +| `nextcloud.username` | User of the application | `admin` | +| `nextcloud.password` | Application password | `changeme` | +| `nextcloud.update` | Trigger update if custom command is used | `0` | +| `nextcloud.datadir` | nextcloud data dir location | `/var/www/html/data` | +| `nextcloud.tableprefix` | nextcloud db table prefix | `''` | +| `nextcloud.mail.enabled` | Whether to enable/disable email settings | `false` | +| `nextcloud.mail.fromAddress` | nextcloud mail send from field | `nil` | +| `nextcloud.mail.domain` | nextcloud mail domain | `nil` | +| `nextcloud.mail.smtp.host` | SMTP hostname | `nil` | +| `nextcloud.mail.smtp.secure` | SMTP connection `ssl` or empty | `''` | +| `nextcloud.mail.smtp.port` | Optional SMTP port | `nil` | +| `nextcloud.mail.smtp.authtype` | SMTP authentication method | `LOGIN` | +| `nextcloud.mail.smtp.name` | SMTP username | `''` | +| `nextcloud.mail.smtp.password` | SMTP password | `''` | +| `nextcloud.configs` | Config files created in `/var/www/html/config` | `{}` | +| `nextcloud.persistence.subPath` | Set the subPath for nextcloud to use in volume | `nil` | +| `nextcloud.phpConfigs` | PHP Config files created in `/usr/local/etc/php/conf.d` | `{}` | +| `nextcloud.defaultConfigs.\.htaccess` | Default .htaccess to protect `/var/www/html/config` | `true` | +| `nextcloud.defaultConfigs.\.redis\.config\.php` | Default Redis configuration | `true` | +| `nextcloud.defaultConfigs.\.apache-pretty-urls\.config\.php` | Default Apache configuration for rewrite urls | `true` | +| `nextcloud.defaultConfigs.\.apcu\.config\.php` | Default configuration to define APCu as local cache | `true` | +| `nextcloud.defaultConfigs.\.apps\.config\.php` | Default configuration for apps | `true` | +| `nextcloud.defaultConfigs.\.autoconfig\.php` | Default auto-configuration for databases | `true` | +| `nextcloud.defaultConfigs.\.smtp\.config\.php` | Default configuration for smtp | `true` | +| `nextcloud.strategy` | specifies the strategy used to replace old Pods by new ones | `type: Recreate` | +| `nextcloud.extraEnv` | specify additional environment variables | `{}` | +| `nextcloud.extraVolumes` | specify additional volumes for the NextCloud pod | `{}` | +| `nextcloud.extraVolumeMounts` | specify additional volume mounts for the NextCloud pod | `{}` | +| `nginx.enabled` | Enable nginx (requires you use php-fpm image) | `false` | +| `nginx.image.repository` | nginx Image name | `nginx` | +| `nginx.image.tag` | nginx Image tag | `alpine` | +| `nginx.image.pullPolicy` | nginx Image pull policy | `IfNotPresent` | +| `nginx.config.default` | Whether to use nextclouds recommended nginx config | `true` | +| `nginx.config.custom` | Specify a custom config for nginx | `{}` | +| `nginx.resources` | nginx resources | `{}` | +| `lifecycle.postStartCommand` | Specify deployment lifecycle hook postStartCommand | `nil` | +| `lifecycle.preStopCommand` | Specify deployment lifecycle hook preStopCommand | `nil` | +| `internalDatabase.enabled` | Whether to use internal sqlite database | `true` | +| `internalDatabase.database` | Name of the existing database | `nextcloud` | +| `externalDatabase.enabled` | Whether to use external database | `false` | +| `externalDatabase.type` | External database type: `mysql`, `postgresql` | `mysql` | +| `externalDatabase.host` | Host of the external database | `nil` | +| `externalDatabase.database` | Name of the existing database | `nextcloud` | +| `externalDatabase.user` | Existing username in the external db | `nextcloud` | +| `externalDatabase.password` | Password for the above username | `nil` | +| `externalDatabase.existingSecret.enabled` | Whether to use a existing secret or not | `false` | +| `externalDatabase.existingSecret.secretName` | Name of the existing secret | `nil` | +| `externalDatabase.existingSecret.usernameKey` | Name of the key that contains the username | `nil` | +| `externalDatabase.existingSecret.passwordKey` | Name of the key that contains the password | `nil` | +| `mariadb.enabled` | Whether to use the MariaDB chart | `false` | +| `mariadb.db.name` | Database name to create | `nextcloud` | +| `mariadb.db.password` | Password for the database | `changeme` | +| `mariadb.db.user` | Database user to create | `nextcloud` | +| `mariadb.rootUser.password` | MariaDB admin password | `nil` | +| `redis.enabled` | Whether to install/use redis for locking | `false` | +| `cronjob.enabled` | Whether to enable/disable cronjob | `false` | +| `cronjob.schedule` | Schedule for the CronJob | `*/15 * * * *` | +| `cronjob.annotations` | Annotations to add to the cronjob | {} | +| `cronjob.curlInsecure` | Set insecure (-k) option to curl | false | +| `cronjob.failedJobsHistoryLimit` | Specify the number of failed Jobs to keep | `5` | +| `cronjob.successfulJobsHistoryLimit` | Specify the number of completed Jobs to keep | `2` | +| `cronjob.resources` | Cronjob Resources | `nil` | +| `cronjob.nodeSelector` | Cronjob Node selector | `nil` | +| `cronjob.tolerations` | Cronjob tolerations | `nil` | +| `cronjob.affinity` | Cronjob affinity | `nil` | +| `service.type` | Kubernetes Service type | `ClusterIp` | +| `service.loadBalancerIP` | LoadBalancerIp for service type LoadBalancer | `nil` | +| `service.nodePort` | NodePort for service type NodePort | `nil` | +| `persistence.enabled` | Enable persistence using PVC | `false` | +| `persistence.annotations` | PVC annotations | `{}` | +| `persistence.storageClass` | PVC Storage Class for nextcloud volume | `nil` (uses alpha storage class annotation) | +| `persistence.existingClaim` | An Existing PVC name for nextcloud volume | `nil` (uses alpha storage class annotation) | +| `persistence.accessMode` | PVC Access Mode for nextcloud volume | `ReadWriteOnce` | +| `persistence.size` | PVC Storage Request for nextcloud volume | `8Gi` | +| `resources` | CPU/Memory resource requests/limits | `{}` | +| `livenessProbe.enabled` | Turn on and off liveness probe | `true` | +| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | +| `livenessProbe.periodSeconds` | How often to perform the probe | `15` | +| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | `3` | +| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | +| `readinessProbe.enabled` | Turn on and off readiness probe | `true` | +| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | +| `readinessProbe.periodSeconds` | How often to perform the probe | `15` | +| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | `3` | +| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | +| `hpa.enabled` | Boolean to create a HorizontalPodAutoscaler | `false` | +| `hpa.cputhreshold` | CPU threshold percent for the HorizontalPodAutoscale | `60` | +| `hpa.minPods` | Min. pods for the Nextcloud HorizontalPodAutoscaler | `1` | +| `hpa.maxPods` | Max. pods for the Nextcloud HorizontalPodAutoscaler | `10` | +| `deploymentAnnotations` | Annotations to be added at 'deployment' level | not set | +| `podAnnotations` | Annotations to be added at 'pod' level | not set | +| `metrics.enabled` | Start Prometheus metrics exporter | `false` | +| `metrics.https` | Defines if https is used to connect to nextcloud | `false` (uses http) | +| `metrics.timeout` | When the scrape times out | `5s` | +| `metrics.image.repository` | Nextcloud metrics exporter image name | `xperimental/nextcloud-exporter` | +| `metrics.image.tag` | Nextcloud metrics exporter image tag | `v0.3.0` | +| `metrics.image.pullPolicy` | Nextcloud metrics exporter image pull policy | `IfNotPresent` | +| `metrics.podAnnotations` | Additional annotations for metrics exporter | not set | +| `metrics.podLabels` | Additional labels for metrics exporter | not set | +| `metrics.service.type` | Metrics: Kubernetes Service type | `ClusterIP` | +| `metrics.service.loadBalancerIP` | Metrics: LoadBalancerIp for service type LoadBalancer | `nil` | +| `metrics.service.nodePort` | Metrics: NodePort for service type NodePort | `nil` | +| `metrics.service.annotations` | Additional annotations for service metrics exporter | `{prometheus.io/scrape: "true", prometheus.io/port: "9205"}` | +| `metrics.service.labels` | Additional labels for service metrics exporter | `{}` | + +> **Note**: +> +> For nextcloud to function correctly, you should specify the `nextcloud.host` parameter to specify the FQDN (recommended) or the public IP address of the nextcloud service. +> +> Optionally, you can specify the `service.loadBalancerIP` parameter to assign a reserved IP address to the nextcloud service of the chart. However please note that this feature is only available on a few cloud providers (f.e. GKE). +> +> To reserve a public IP address on GKE: +> +> ```bash +> gcloud compute addresses create nextcloud-public-ip +> ``` +> +> The reserved IP address can be associated to the nextcloud service by specifying it as the value of the `service.loadBalancerIP` parameter while installing the chart. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +helm install --name my-release \ + --set nextcloud.username=admin,nextcloud.password=password,mariadb.rootUser.password=secretpassword \ + nextcloud/nextcloud +``` + +The above command sets the nextcloud administrator account username and password to `admin` and `password` respectively. Additionally, it sets the MariaDB `root` user password to `secretpassword`. + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +helm install --name my-release -f values.yaml nextcloud/nextcloud +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +The [Nextcloud](https://hub.docker.com/_/nextcloud/) image stores the nextcloud data and configurations at the `/var/www/html` paths of the container. + +Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube. +See the [Configuration](#configuration) section to enable persistence and configuration of the PVC. + +## Cronjob + +This chart can utilize Kubernetes `CronJob` resource to execute [background tasks](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html). + +To use this functionality, set `cronjob.enabled` parameter to `true` and switch background mode to Webcron in your nextcloud settings page. +See the [Configuration](#configuration) section for further configuration of the cronjob resource. + +> **Note**: For the cronjobs to work correctly, ingress must be also enabled (set `ingress.enabled` to `true`) and `nextcloud.host` has to be publicly resolvable. + +## Multiple config.php file + +Nextcloud supports loading configuration parameters from multiple files. +You can add arbitrary files ending with `.config.php` in the `config/` directory. +See [documentation](https://docs.nextcloud.com/server/15/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file). + +For example, following config will configure Nextcloud with [S3 as primary storage](https://docs.nextcloud.com/server/13/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3) by creating file `/var/www/html/config/s3.config.php`: + +```yaml +nextcloud: + configs: + s3.config.php: |- + array( + 'class' => '\\OC\\Files\\ObjectStore\\S3', + 'arguments' => array( + 'bucket' => 'my-bucket', + 'autocreate' => true, + 'key' => 'xxx', + 'secret' => 'xxx', + 'region' => 'us-east-1', + 'use_ssl' => true + ) + ) + ); +``` + +## Hugepages + +If your node has hugepages enabled, but you do not map any into the container, it could fail to start with a bus error in Apache. This is due +to Apache attempting to memory map a file and use hugepages. The fix is to either disable huge pages on the node or map hugepages into the container: + +```yaml +nextcloud: + extraVolumes: + - name: hugepages + emptyDir: + medium: HugePages-2Mi + extraVolumeMounts: + - name: hugepages + mountPath: /dev/hugepages + resources: + requests: + hugepages-2Mi: 500Mi + # note that Kubernetes currently requires cpu or memory requests and limits before hugepages are allowed. + memory: 500Mi + limits: + # limit and request must be the same for hugepages. They are a fixed resource. + hugepages-2Mi: 500Mi + # note that Kubernetes currently requires cpu or memory requests and limits before hugepages are allowed. + memory: 1Gi +``` diff --git a/test/nextcloud/2.3.2/templates/NOTES.txt b/test/nextcloud/2.3.2/templates/NOTES.txt new file mode 100644 index 00000000000..f1428c5e10a --- /dev/null +++ b/test/nextcloud/2.3.2/templates/NOTES.txt @@ -0,0 +1,94 @@ +{{- if or .Values.mariadb.enabled .Values.externalDatabase.host -}} + +{{- if empty .Values.nextcloud.host -}} +################################################################################# +### WARNING: You did not provide an external host in your 'helm install' call ### +################################################################################# + +This deployment will be incomplete until you configure nextcloud with a resolvable +host. To configure nextcloud with the URL of your service: + +1. Get the nextcloud URL by running: + + {{- if contains "NodePort" .Values.service.type }} + + export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") + export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + + {{- else if contains "LoadBalancer" .Values.service.type }} + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "nextcloud.fullname" . }}' + + export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") + export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) + {{- if .Values.mariadb.db.password }} + export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.mariadb.fullname" . }} -o jsonpath="{.data.mariadb-password}" | base64 --decode) + {{- end }} + {{- end }} + +2. Complete your nextcloud deployment by running: + +{{- if .Values.mariadb.enabled }} + + helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ + --set nextcloud.host=$APP_HOST,nextcloud.password=$APP_PASSWORD{{ if .Values.mariadb.db.password }},mariadb.db.password=$APP_DATABASE_PASSWORD{{ end }} +{{- else }} + + ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## + + helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ + --set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type={{ .Values.service.type }},mariadb.enabled=false{{- if not (empty .Values.externalDatabase.host) }},externalDatabase.host={{ .Values.externalDatabase.host }}{{- end }}{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }} +{{- end }} + +{{- else -}} +1. Get the nextcloud URL by running: + +{{- if eq .Values.service.type "ClusterIP" }} + + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "nextcloud.fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + echo http://127.0.0.1:8080/ + kubectl port-forward $POD_NAME 8080:80 +{{- else }} + + echo http://{{ .Values.nextcloud.host }}/ +{{- end }} + +2. Get your nextcloud login credentials by running: + + echo User: {{ .Values.nextcloud.username }} + echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) +{{- end }} + +{{- else -}} + +####################################################################################################### +## WARNING: You did not provide an external database host in your 'helm install' call ## +## Running Nextcloud with the integrated sqlite database is not recommended for production instances ## +####################################################################################################### + +For better performance etc. you have to configure nextcloud with a resolvable database +host. To configure nextcloud to use and external database host: + + +1. Complete your nextcloud deployment by running: + +{{- if contains "NodePort" .Values.service.type }} + export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") +{{- else if contains "LoadBalancer" .Values.service.type }} + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "nextcloud.fullname" . }}' + + export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") +{{- else }} + + export APP_HOST=127.0.0.1 +{{- end }} + export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) + + ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## + + helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ + --set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type={{ .Values.service.type }},mariadb.enabled=false{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }},externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/_helpers.tpl b/test/nextcloud/2.3.2/templates/_helpers.tpl new file mode 100644 index 00000000000..87c6e91d1bd --- /dev/null +++ b/test/nextcloud/2.3.2/templates/_helpers.tpl @@ -0,0 +1,49 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "nextcloud.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nextcloud.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "nextcloud.mariadb.fullname" -}} +{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{/* +Create a default fully qualified redis app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "nextcloud.redis.fullname" -}} +{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nextcloud.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/test/nextcloud/2.3.2/templates/config.yaml b/test/nextcloud/2.3.2/templates/config.yaml new file mode 100644 index 00000000000..7fb2ade68a5 --- /dev/null +++ b/test/nextcloud/2.3.2/templates/config.yaml @@ -0,0 +1,127 @@ +{{- if .Values.nextcloud.configs -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "nextcloud.fullname" . }}-config + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +data: +{{- range $key, $value := .Values.nextcloud.configs }} + {{ $key }}: |- +{{ $value | indent 4 }} +{{- end }} +{{- if .Values.nextcloud.defaultConfigs }} +{{- if index .Values.nextcloud.defaultConfigs ".htaccess" }} + .htaccess: |- + # line below if for Apache 2.4 + + Require all denied + + # line below if for Apache 2.2 + + deny from all + + # section for Apache 2.2 and 2.4 + + IndexIgnore * + +{{- end }} +{{- if index .Values.nextcloud.defaultConfigs "redis.config.php" }} + redis.config.php: |- + '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis' => array( + 'host' => getenv('REDIS_HOST'), + 'port' => getenv('REDIS_HOST_PORT') ?: 6379, + ), + ); + } +{{- end }} +{{- if index .Values.nextcloud.defaultConfigs "apache-pretty-urls.config.php" }} + apache-pretty-urls.config.php: |- + '/', + ); +{{- end }} +{{- if index .Values.nextcloud.defaultConfigs "apcu.config.php" }} + apcu.config.php: |- + '\OC\Memcache\APCu', + ); +{{- end }} +{{- if index .Values.nextcloud.defaultConfigs "apps.config.php" }} + apps.config.php: |- + array ( + 0 => array ( + "path" => OC::$SERVERROOT."/apps", + "url" => "/apps", + "writable" => false, + ), + 1 => array ( + "path" => OC::$SERVERROOT."/custom_apps", + "url" => "/custom_apps", + "writable" => true, + ), + ), + ); +{{- end }} +{{- if index .Values.nextcloud.defaultConfigs "autoconfig.php" }} + autoconfig.php: |- + 'smtp', + 'mail_smtphost' => getenv('SMTP_HOST'), + 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), + 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', + 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), + 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', + 'mail_smtpname' => getenv('SMTP_NAME') ?: '', + 'mail_smtppassword' => getenv('SMTP_PASSWORD') ?: '', + 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), + 'mail_domain' => getenv('MAIL_DOMAIN'), + ); + } +{{- end }} +{{- end }} +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/cronjob.yaml b/test/nextcloud/2.3.2/templates/cronjob.yaml new file mode 100644 index 00000000000..3a2eded29eb --- /dev/null +++ b/test/nextcloud/2.3.2/templates/cronjob.yaml @@ -0,0 +1,75 @@ +{{- if .Values.cronjob.enabled }} +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: {{ template "nextcloud.fullname" . }}-cron + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: +{{ toYaml .Values.cronjob.annotations | indent 4 }} +spec: + schedule: "{{ .Values.cronjob.schedule }}" + concurrencyPolicy: Forbid + {{- with .Values.cronjob.failedJobsHistoryLimit }} + failedJobsHistoryLimit: {{ . }} + {{- end }} + {{- with .Values.cronjob.successfulJobsHistoryLimit }} + successfulJobsHistoryLimit: {{ . }} + {{- end }} + jobTemplate: + metadata: + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + spec: + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + spec: + restartPolicy: Never + {{- if (default .Values.image.pullSecrets .Values.cronjob.image.pullSecrets) }} + imagePullSecrets: + {{- range (default .Values.image.pullSecrets .Values.cronjob.image.pullSecrets) }} + - name: {{ . }} + {{- end }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ default .Values.image.repository .Values.cronjob.image.repository }}:{{ default .Values.image.tag .Values.cronjob.image.tag }}" + imagePullPolicy: {{ default .Values.image.pullPolicy .Values.cronjob.image.pullPolicy }} + command: [ "curl" ] + args: + {{- if .Values.ingress.enabled }} + {{- if .Values.cronjob.curlInsecure }} + - "-k" + {{- end }} + - "--fail" + - "-L" + {{- if .Values.ingress.tls }} + - "https://{{ .Values.nextcloud.host }}/cron.php" + {{- else }} + - "http://{{ .Values.nextcloud.host }}/cron.php" + {{- end }} + {{- else }} + - "http://{{ template "nextcloud.fullname" . }}:{{ .Values.service.port }}/cron.php" + {{- end }} + resources: +{{ toYaml (default .Values.resources .Values.cronjob.resources) | indent 16 }} + {{- with (default .Values.nodeSelector .Values.cronjob.nodeSelector) }} + nodeSelector: +{{ toYaml . | indent 12 }} + {{- end }} + {{- with (default .Values.affinity .Values.cronjob.affinity) }} + affinity: +{{ toYaml . | indent 12 }} + {{- end }} + {{- with (default .Values.tolerations .Values.cronjob.tolerations) }} + tolerations: +{{ toYaml . | indent 12 }}: + {{- end }} +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/db-secret.yaml b/test/nextcloud/2.3.2/templates/db-secret.yaml new file mode 100644 index 00000000000..790b65b75be --- /dev/null +++ b/test/nextcloud/2.3.2/templates/db-secret.yaml @@ -0,0 +1,22 @@ +{{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled }} +{{- if not .Values.externalDatabase.existingSecret.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ printf "%s-%s" .Release.Name "db" }} + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +type: Opaque +data: + {{- if .Values.mariadb.enabled }} + db-password: {{ default "" .Values.mariadb.db.password | b64enc | quote }} + db-username: {{ default "" .Values.mariadb.db.user | b64enc | quote }} + {{- else }} + db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} + db-username: {{ default "" .Values.externalDatabase.user | b64enc | quote }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml new file mode 100644 index 00000000000..fad0d7a3b6d --- /dev/null +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -0,0 +1,360 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "nextcloud.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app + {{- if .Values.deploymentAnnotations }} + annotations: +{{ toYaml .Values.deploymentAnnotations | indent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + strategy: +{{ toYaml .Values.nextcloud.strategy | indent 4 }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: app + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: app + {{- if .Values.redis.enabled }} + {{ template "nextcloud.redis.fullname" . }}-client: "true" + {{- end }} + {{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8 }} + {{- end }} + spec: + {{- if .Values.image.pullSecrets }} + imagePullSecrets: + {{- range .Values.image.pullSecrets }} + - name: {{ . }} + {{- end}} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycle }} + lifecycle: + {{- if .Values.lifecycle.postStartCommand }} + postStart: + exec: + command: + {{- toYaml .Values.lifecycle.postStartCommand | nindent 16 -}} + {{- end }} + {{- if .Values.lifecycle.preStopCommand }} + preStop: + exec: + command: + {{- toYaml .Values.lifecycle.preStopCommand | nindent 16 -}} + {{- end }} + {{- end }} + env: + {{- if .Values.internalDatabase.enabled }} + - name: SQLITE_DATABASE + value: {{ .Values.internalDatabase.name | quote }} + {{- else if .Values.mariadb.enabled }} + - name: MYSQL_HOST + value: {{ template "nextcloud.mariadb.fullname" . }} + - name: MYSQL_DATABASE + value: {{ .Values.mariadb.db.name | quote }} + - name: MYSQL_USER + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} + {{- else }} + {{- if eq .Values.externalDatabase.type "postgresql" }} + - name: POSTGRES_HOST + value: {{ .Values.externalDatabase.host | quote }} + - name: POSTGRES_DB + value: {{ .Values.externalDatabase.database | quote }} + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} + {{- else }} + - name: MYSQL_HOST + value: {{ .Values.externalDatabase.host | quote }} + - name: MYSQL_DATABASE + value: {{ .Values.externalDatabase.database | quote }} + - name: MYSQL_USER + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} + key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} + {{- end }} + {{- end }} + - name: NEXTCLOUD_ADMIN_USER + valueFrom: + secretKeyRef: + name: {{ template "nextcloud.fullname" . }} + key: nextcloud-username + - name: NEXTCLOUD_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "nextcloud.fullname" . }} + key: nextcloud-password + - name: NEXTCLOUD_TRUSTED_DOMAINS + value: {{ .Values.nextcloud.host }} + {{- if ne (int .Values.nextcloud.update) 0 }} + - name: NEXTCLOUD_UPDATE + value: {{ .Values.nextcloud.update | quote }} + {{- end }} + - name: NEXTCLOUD_DATA_DIR + value: {{ .Values.nextcloud.datadir | quote }} + {{- if .Values.nextcloud.tableprefix }} + - name: NEXTCLOUD_TABLE_PREFIX + value: {{ .Values.nextcloud.tableprefix | quote }} + {{- end }} + {{- if .Values.nextcloud.mail.enabled }} + - name: MAIL_FROM_ADDRESS + value: {{ .Values.nextcloud.mail.fromAddress | quote }} + - name: MAIL_DOMAIN + value: {{ .Values.nextcloud.mail.domain | quote }} + - name: SMTP_HOST + value: {{ .Values.nextcloud.mail.smtp.host | quote }} + - name: SMTP_SECURE + value: {{ .Values.nextcloud.mail.smtp.secure | quote }} + - name: SMTP_PORT + value: {{ .Values.nextcloud.mail.smtp.port | quote }} + - name: SMTP_AUTHTYPE + value: {{ .Values.nextcloud.mail.smtp.authtype | quote }} + - name: SMTP_NAME + valueFrom: + secretKeyRef: + name: {{ template "nextcloud.fullname" . }} + key: smtp-username + - name: SMTP_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "nextcloud.fullname" . }} + key: smtp-password + {{- end }} + {{- if .Values.redis.enabled }} + - name: REDIS_HOST + value: {{ template "nextcloud.redis.fullname" . }}-master + - name: REDIS_HOST_PORT + value: {{ .Values.redis.redisPort | quote }} + {{- end }} + {{- if .Values.nextcloud.extraEnv }} +{{ toYaml .Values.nextcloud.extraEnv | indent 8 }} + {{- end }} + {{- if not .Values.nginx.enabled }} + ports: + - name: http + containerPort: 80 + protocol: TCP + {{- end }} + {{- if and .Values.livenessProbe.enabled (not .Values.nginx.enabled) }} + livenessProbe: + httpGet: + path: /status.php + port: http + httpHeaders: + - name: Host + value: {{ .Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if and .Values.readinessProbe.enabled (not .Values.nginx.enabled) }} + readinessProbe: + httpGet: + path: /status.php + port: http + httpHeaders: + - name: Host + value: {{ .Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + resources: +{{ toYaml .Values.resources | indent 10 }} + volumeMounts: + - name: nextcloud-data + mountPath: /var/www/ + subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/html + subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: {{ .Values.nextcloud.datadir }} + subPath: {{ ternary "data" (printf "%s/%s" .Values.nextcloud.persistence.subPath "data") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/html/config + subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/html/custom_apps + subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/tmp + subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/html/themes + subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }} + {{- range $key, $value := .Values.nextcloud.configs }} + - name: nextcloud-config + mountPath: /var/www/html/config/{{ $key }} + subPath: {{ $key }} + {{- end }} + {{- if .Values.nextcloud.configs }} + {{- range $key, $value := .Values.nextcloud.defaultConfigs }} + {{- if $value }} + - name: nextcloud-config + mountPath: /var/www/html/config/{{ $key }} + subPath: {{ $key }} + {{- end }} + {{- end }} + {{- end }} + {{- range $key, $value := .Values.nextcloud.phpConfigs }} + - name: nextcloud-phpconfig + mountPath: /usr/local/etc/php/conf.d/{{ $key }} + subPath: {{ $key }} + {{- end }} + {{- if .Values.nextcloud.extraVolumeMounts }} +{{ toYaml .Values.nextcloud.extraVolumeMounts | indent 8 }} + {{- end }} + {{- if .Values.nginx.enabled }} + - name: {{ .Chart.Name }}-nginx + image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}" + imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /status.php + port: http + httpHeaders: + - name: Host + value: {{ .Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /status.php + port: http + httpHeaders: + - name: Host + value: {{ .Values.nextcloud.host | quote }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + resources: +{{ toYaml .Values.nginx.resources | indent 10 }} + volumeMounts: + - name: nextcloud-data + mountPath: /var/www/ + subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/html + subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: {{ .Values.nextcloud.datadir }} + subPath: {{ ternary "data" (printf "%s/%s" .Values.nextcloud.persistence.subPath "data") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/html/config + subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/html/custom_apps + subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/tmp + subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-data + mountPath: /var/www/html/themes + subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }} + - name: nextcloud-nginx-config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: nextcloud-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} + {{- else }} + emptyDir: {} + {{- end }} + {{- if .Values.nextcloud.configs }} + - name: nextcloud-config + configMap: + name: {{ template "nextcloud.fullname" . }}-config + {{- end }} + {{- if .Values.nextcloud.phpConfigs }} + - name: nextcloud-phpconfig + configMap: + name: {{ template "nextcloud.fullname" . }}-phpconfig + {{- end }} + {{- if .Values.nginx.enabled }} + - name: nextcloud-nginx-config + configMap: + name: {{ template "nextcloud.fullname" . }}-nginxconfig + {{- end }} + {{- if .Values.nextcloud.extraVolumes }} +{{ toYaml .Values.nextcloud.extraVolumes | indent 6 }} + {{- end }} + {{- if .Values.nginx.enabled }} + # Will mount configuration files as www-data (id: 82) for nextcloud + securityContext: + fsGroup: 82 + {{- else }} + # Will mount configuration files as www-data (id: 33) for nextcloud + securityContext: + fsGroup: 33 + {{- end }} diff --git a/test/nextcloud/2.3.2/templates/hpa.yaml b/test/nextcloud/2.3.2/templates/hpa.yaml new file mode 100644 index 00000000000..52a30043a5c --- /dev/null +++ b/test/nextcloud/2.3.2/templates/hpa.yaml @@ -0,0 +1,20 @@ +{{- if .Values.hpa.enabled -}} +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "nextcloud.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app +spec: + scaleTargetRef: + kind: Deployment + apiVersion: apps/v1 + name: {{ template "nextcloud.fullname" . }} + minReplicas: {{ .Values.hpa.minPods }} + maxReplicas: {{ .Values.hpa.maxPods }} + targetCPUUtilizationPercentage: {{ .Values.hpa.cputhreshold }} +{{- end }} \ No newline at end of file diff --git a/test/nextcloud/2.3.2/templates/ingress.yaml b/test/nextcloud/2.3.2/templates/ingress.yaml new file mode 100644 index 00000000000..980c79a29dc --- /dev/null +++ b/test/nextcloud/2.3.2/templates/ingress.yaml @@ -0,0 +1,31 @@ +{{- if .Values.ingress.enabled }} +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: {{ template "nextcloud.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app +{{- if .Values.ingress.labels }} +{{ toYaml .Values.ingress.labels | indent 4 }} +{{- end }} +{{- if .Values.ingress.annotations }} + annotations: +{{ toYaml .Values.ingress.annotations | indent 4 }} +{{- end }} +spec: + rules: + - host: {{ .Values.nextcloud.host }} + http: + paths: + - backend: + serviceName: {{ template "nextcloud.fullname" . }} + servicePort: {{ .Values.service.port }} +{{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} +{{- end -}} +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/metrics-deployment.yaml b/test/nextcloud/2.3.2/templates/metrics-deployment.yaml new file mode 100644 index 00000000000..66eb8421030 --- /dev/null +++ b/test/nextcloud/2.3.2/templates/metrics-deployment.yaml @@ -0,0 +1,55 @@ +{{- if .Values.metrics.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "nextcloud.fullname" . }}-metrics + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: metrics +spec: + replicas: {{ .Values.metrics.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: metrics + template: + metadata: + annotations: {{- toYaml .Values.metrics.podAnnotations | nindent 8 }} + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: metrics + {{- if .Values.metrics.podLabels }} +{{ toYaml .Values.metrics.podLabels | indent 8 }} + {{- end }} + spec: + containers: + - name: metrics-exporter + image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}" + imagePullPolicy: {{ .Values.metrics.image.pullPolicy }} + env: + - name: NEXTCLOUD_USERNAME + valueFrom: + secretKeyRef: + name: {{ template "nextcloud.fullname" . }} + key: nextcloud-username + - name: NEXTCLOUD_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "nextcloud.fullname" . }} + key: nextcloud-password + - name: NEXTCLOUD_SERVER + value: http{{ if .Values.metrics.https }}s{{ end }}://{{ .Values.nextcloud.host }} + - name: NEXTCLOUD_TIMEOUT + value: {{ .Values.metrics.timeout }} + ports: + - name: metrics + containerPort: 9205 + {{- if .Values.metrics.resources }} + resources: {{- toYaml .Values.metrics.resources | nindent 10 }} + {{- end }} +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/metrics-service.yaml b/test/nextcloud/2.3.2/templates/metrics-service.yaml new file mode 100644 index 00000000000..b349751cf20 --- /dev/null +++ b/test/nextcloud/2.3.2/templates/metrics-service.yaml @@ -0,0 +1,31 @@ +{{- if .Values.metrics.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "nextcloud.fullname" . }}-metrics + labels: + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- if .Values.metrics.service.labels -}} + {{ toYaml .Values.metrics.service.labels | nindent 4 }} + {{- end -}} + {{- if .Values.metrics.service.annotations }} + annotations: {{ toYaml .Values.metrics.service.annotations | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.metrics.service.type }} + {{ if eq .Values.metrics.service.type "LoadBalancer" -}} {{ if .Values.metrics.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} + {{ end -}} + {{- end -}} + ports: + - name: metrics + port: 9205 + targetPort: metrics + selector: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml b/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml new file mode 100644 index 00000000000..8c1789afdb3 --- /dev/null +++ b/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml @@ -0,0 +1,31 @@ +{{- if .Values.persistence.enabled -}} +{{- if not .Values.persistence.existingClaim -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "nextcloud.fullname" . }}-nextcloud + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app +{{- if .Values.persistence.annotations }} + annotations: +{{ toYaml .Values.persistence.annotations | indent 4 }} +{{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end -}} +{{- end -}} diff --git a/test/nextcloud/2.3.2/templates/nginx-config.yaml b/test/nextcloud/2.3.2/templates/nginx-config.yaml new file mode 100644 index 00000000000..c4b20871026 --- /dev/null +++ b/test/nextcloud/2.3.2/templates/nginx-config.yaml @@ -0,0 +1,185 @@ +{{- if .Values.nginx.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "nextcloud.fullname" . }}-nginxconfig + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +data: + nginx.conf: |- +{{- if .Values.nginx.config.default }} + worker_processes auto; + + error_log /var/log/nginx/error.log warn; + pid /var/run/nginx.pid; + + + events { + worker_connections 1024; + } + + + http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + upstream php-handler { + server 127.0.0.1:9000; + } + + server { + listen 80; + + # Add headers to serve security related headers + # Before enabling Strict-Transport-Security headers please read into this + # topic first. + #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; + # + # WARNING: Only add the preload option once you read about + # the consequences in https://hstspreload.org/. This option + # will add the domain to a hardcoded list that is shipped + # in all major browsers and getting removed from this list + # could take several months. + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Download-Options "noopen" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "none" always; + add_header X-XSS-Protection "1; mode=block" always; + + # Remove X-Powered-By, which is an information leak + fastcgi_hide_header X-Powered-By; + + # Path to the root of your installation + root /var/www/html; + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + # The following 2 rules are only needed for the user_webfinger app. + # Uncomment it if you're planning to use this app. + #rewrite ^/.well-known/host-meta /public.php?service=host-meta last; + #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; + + # The following rule is only needed for the Social app. + # Uncomment it if you're planning to use this app. + #rewrite ^/.well-known/webfinger /public.php?service=webfinger last; + + location = /.well-known/carddav { + return 301 $scheme://$host:$server_port/remote.php/dav; + } + + location = /.well-known/caldav { + return 301 $scheme://$host:$server_port/remote.php/dav; + } + + # set max upload size + client_max_body_size 10G; + fastcgi_buffers 64 4K; + + # Enable gzip but do not remove ETag headers + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + # Uncomment if your server is build with the ngx_pagespeed module + # This module is currently not supported. + #pagespeed off; + + location / { + rewrite ^ /index.php; + } + + location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { + deny all; + } + location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) { + deny all; + } + + location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) { + fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; + set $path_info $fastcgi_path_info; + try_files $fastcgi_script_name =404; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + # fastcgi_param HTTPS on; + + # Avoid sending the security headers twice + fastcgi_param modHeadersAvailable true; + + # Enable pretty urls + fastcgi_param front_controller_active true; + fastcgi_pass php-handler; + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + + location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) { + try_files $uri/ =404; + index index.php; + } + + # Adding the cache control header for js, css and map files + # Make sure it is BELOW the PHP block + location ~ \.(?:css|js|woff2?|svg|gif|map)$ { + try_files $uri /index.php$request_uri; + add_header Cache-Control "public, max-age=15778463"; + # Add headers to serve security related headers (It is intended to + # have those duplicated to the ones above) + # Before enabling Strict-Transport-Security headers please read into + # this topic first. + #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; + # + # WARNING: Only add the preload option once you read about + # the consequences in https://hstspreload.org/. This option + # will add the domain to a hardcoded list that is shipped + # in all major browsers and getting removed from this list + # could take several months. + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Download-Options "noopen" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "none" always; + add_header X-XSS-Protection "1; mode=block" always; + + # Optional: Don't log access to assets + access_log off; + } + + location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { + try_files $uri /index.php$request_uri; + # Optional: Don't log access to other assets + access_log off; + } + } + } +{{- else }} +{{ .Values.nginx.config.custom | indent 4 }} +{{- end }} +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/php-config.yaml b/test/nextcloud/2.3.2/templates/php-config.yaml new file mode 100644 index 00000000000..3ff9e95a9ac --- /dev/null +++ b/test/nextcloud/2.3.2/templates/php-config.yaml @@ -0,0 +1,16 @@ +{{- if .Values.nextcloud.phpConfigs -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "nextcloud.fullname" . }}-phpconfig + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +data: +{{- range $key, $value := .Values.nextcloud.phpConfigs }} + {{ $key }}: |- +{{ $value | indent 4 }} +{{- end }} +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/secrets.yaml b/test/nextcloud/2.3.2/templates/secrets.yaml new file mode 100644 index 00000000000..8473eba0526 --- /dev/null +++ b/test/nextcloud/2.3.2/templates/secrets.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "nextcloud.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +type: Opaque +data: + nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }} + {{ if .Values.nextcloud.password }} + nextcloud-password: {{ .Values.nextcloud.password | b64enc | quote }} + {{ else }} + nextcloud-password: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} + {{- if .Values.nextcloud.mail.enabled }} + smtp-username: {{ default "" .Values.nextcloud.mail.smtp.name | b64enc | quote }} + smtp-password: {{ default "" .Values.nextcloud.mail.smtp.password | b64enc | quote }} + {{- end }} diff --git a/test/nextcloud/2.3.2/templates/service.yaml b/test/nextcloud/2.3.2/templates/service.yaml new file mode 100644 index 00000000000..68f67e94825 --- /dev/null +++ b/test/nextcloud/2.3.2/templates/service.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "nextcloud.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app +spec: + type: {{ .Values.service.type }} + {{- if eq .Values.service.type "LoadBalancer" }} + loadBalancerIP: {{ default "" .Values.service.loadBalancerIP }} + {{- end }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + {{- if eq .Values.service.type "NodePort" }} + nodePort: {{ default "" .Values.service.nodePort}} + {{- end }} + selector: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml new file mode 100644 index 00000000000..546238caa1c --- /dev/null +++ b/test/nextcloud/2.3.2/values.yaml @@ -0,0 +1,399 @@ +## Official nextcloud image version +## ref: https://hub.docker.com/r/library/nextcloud/tags/ +## +image: + repository: nextcloud + tag: 19.0.3-apache + pullPolicy: IfNotPresent + # pullSecrets: + # - myRegistrKeySecretName + +nameOverride: "" +fullnameOverride: "" + +# Number of replicas to be deployed +replicaCount: 1 + +## Allowing use of ingress controllers +## ref: https://kubernetes.io/docs/concepts/services-networking/ingress/ +## +ingress: + enabled: false + annotations: {} + # nginx.ingress.kubernetes.io/proxy-body-size: 4G + # kubernetes.io/tls-acme: "true" + # certmanager.k8s.io/cluster-issuer: letsencrypt-prod + # nginx.ingress.kubernetes.io/server-snippet: |- + # server_tokens off; + # proxy_hide_header X-Powered-By; + + # rewrite ^/.well-known/webfinger /public.php?service=webfinger last; + # rewrite ^/.well-known/host-meta /public.php?service=host-meta last; + # rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json; + # location = /.well-known/carddav { + # return 301 $scheme://$host/remote.php/dav; + # } + # location = /.well-known/caldav { + # return 301 $scheme://$host/remote.php/dav; + # } + # location = /robots.txt { + # allow all; + # log_not_found off; + # access_log off; + # } + # location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { + # deny all; + # } + # location ~ ^/(?:autotest|occ|issue|indie|db_|console) { + # deny all; + # } + # tls: + # - secretName: nextcloud-tls + # hosts: + # - nextcloud.kube.home + labels: {} + + +# Allow configuration of lifecycle hooks +# ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ +lifecycle: {} + # postStartCommand: [] + # preStopCommand: [] + +nextcloud: + host: nextcloud.kube.home + username: admin + password: changeme + update: 0 + datadir: /var/www/html/data + tableprefix: + persistence: + subPath: + mail: + enabled: false + fromAddress: user + domain: domain.com + smtp: + host: domain.com + secure: ssl + port: 465 + authtype: LOGIN + name: user + password: pass + # PHP Configuration files + # Will be injected in /usr/local/etc/php/conf.d + phpConfigs: {} + # Default config files + # IMPORTANT: Will be used only if you put extra configs, otherwise default will come from nextcloud itself + # Default confgurations can be found here: https://github.com/nextcloud/docker/tree/master/16.0/apache/config + defaultConfigs: + # To protect /var/www/html/config + .htaccess: true + # Redis default configuration + redis.config.php: true + # Apache configuration for rewrite urls + apache-pretty-urls.config.php: true + # Define APCu as local cache + apcu.config.php: true + # Apps directory configs + apps.config.php: true + # Used for auto configure database + autoconfig.php: true + # SMTP default configuration + smtp.config.php: true + # Extra config files created in /var/www/html/config/ + # ref: https://docs.nextcloud.com/server/15/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file + configs: {} + + # For example, to use S3 as primary storage + # ref: https://docs.nextcloud.com/server/13/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3 + # + # configs: + # s3.config.php: |- + # array( + # 'class' => '\\OC\\Files\\ObjectStore\\S3', + # 'arguments' => array( + # 'bucket' => 'my-bucket', + # 'autocreate' => true, + # 'key' => 'xxx', + # 'secret' => 'xxx', + # 'region' => 'us-east-1', + # 'use_ssl' => true + # ) + # ) + # ); + + ## 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 + # rollingUpdate: + # maxSurge: 1 + # maxUnavailable: 0 + + ## + ## Extra environment variables + extraEnv: + # - name: SOME_SECRET_ENV + # valueFrom: + # secretKeyRef: + # name: nextcloud + # key: secret_key + + # Extra mounts for the pods. Example shown is for connecting a legacy NFS volume + # to NextCloud pods in Kubernetes. This can then be configured in External Storage + extraVolumes: + # - name: nfs + # nfs: + # server: "10.0.0.1" + # path: "/nextcloud_data" + # readOnly: false + extraVolumeMounts: + # - name: nfs + # mountPath: "/legacy_data" + +nginx: + ## You need to set an fpm version of the image for nextcloud if you want to use nginx! + enabled: false + image: + repository: nginx + tag: alpine + pullPolicy: IfNotPresent + + config: + # This generates the default nginx config as per the nextcloud documentation + default: true + # custom: |- + # worker_processes 1;.. + + resources: {} + +internalDatabase: + enabled: true + name: nextcloud + +## +## External database configuration +## +externalDatabase: + enabled: false + + ## Supported database engines: mysql or postgresql + type: mysql + + ## Database host + host: + + ## Database user + user: nextcloud + + ## Database password + password: + + ## Database name + database: nextcloud + + ## Use a existing secret + existingSecret: + enabled: false + # secretName: nameofsecret + # usernameKey: username + # passwordKey: password + +## +## MariaDB chart configuration +## +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 + enabled: false + + db: + name: nextcloud + user: nextcloud + password: changeme + + replication: + enabled: false + + ## Enable persistence using Persistent Volume Claims + ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + master: + persistence: + enabled: false + # storageClass: "" + accessMode: ReadWriteOnce + size: 8Gi + +postgresql: + enabled: false + global: + postgresql: + postgresqlUsername: nextcloud + postgresqlPassword: changeme + postgresqlDatabase: nextcloud + persistence: + enabled: false + # storageClass: "" + +redis: + enabled: false + usePassword: false + +## Cronjob to execute Nextcloud background tasks +## ref: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#webcron +## +cronjob: + enabled: false + # Nexcloud image is used as default but only curl is needed + image: {} + # repository: nextcloud + # tag: 16.0.3-apache + # pullPolicy: IfNotPresent + # pullSecrets: + # - myRegistrKeySecretName + # Every 5 minutes + # Note: Setting this to any any other value than 5 minutes might + # cause issues with how nextcloud background jobs are executed + schedule: "*/5 * * * *" + annotations: {} + # Set curl's insecure option if you use e.g. self-signed certificates + curlInsecure: false + failedJobsHistoryLimit: 5 + successfulJobsHistoryLimit: 2 + # If not set, nextcloud deployment one will be set + # 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 + + # If not set, nextcloud deployment one will be set + # nodeSelector: {} + + # If not set, nextcloud deployment one will be set + # tolerations: [] + + # If not set, nextcloud deployment one will be set + # affinity: {} + +service: + type: ClusterIP + port: 8080 + loadBalancerIP: nil + nodePort: nil + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + # Nextcloud Data (/var/www/html) + enabled: false + annotations: {} + ## nextcloud data 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: + + accessMode: ReadWriteOnce + size: 8Gi + +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 + +## Liveness and readiness probe values +## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes +## +livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 15 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 +readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 15 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + +## Enable pod autoscaling using HorizontalPodAutoscaler +## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ +## +hpa: + enabled: false + cputhreshold: 60 + minPods: 1 + maxPods: 10 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + + +## Prometheus Exporter / Metrics +## +metrics: + enabled: false + + replicaCount: 1 + # The metrics exporter needs to know how you serve Nextcloud either http or https + https: false + timeout: 5s + + image: + repository: xperimental/nextcloud-exporter + tag: v0.3.0 + pullPolicy: IfNotPresent + + ## Metrics exporter resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + # resources: {} + + ## Metrics exporter pod Annotation and Labels + # podAnnotations: {} + + # podLabels: {} + + service: + type: ClusterIP + ## Use serviceLoadBalancerIP to request a specific static IP, + ## otherwise leave blank + # loadBalancerIP: + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9205" + labels: {} From aa49bf1741f80889507efebbc8d1f4baec1038b2 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 3 Dec 2020 20:04:41 +0500 Subject: [PATCH 02/29] Add item configuration file --- test/nextcloud/2.3.2/README.md | 35 ------------------------------ test/nextcloud/2.3.2/app-readme.md | 3 +++ test/nextcloud/item.yaml | 2 ++ 3 files changed, 5 insertions(+), 35 deletions(-) create mode 100644 test/nextcloud/2.3.2/app-readme.md create mode 100644 test/nextcloud/item.yaml diff --git a/test/nextcloud/2.3.2/README.md b/test/nextcloud/2.3.2/README.md index 6520e833a12..77ec115d17a 100644 --- a/test/nextcloud/2.3.2/README.md +++ b/test/nextcloud/2.3.2/README.md @@ -2,47 +2,12 @@ [nextcloud](https://nextcloud.com/) is a file sharing server that puts the control and security of your own data back into your hands. -## TL;DR; - -```console -helm repo add nextcloud https://nextcloud.github.io/helm/ -helm install my-release nextcloud/nextcloud -``` - ## Introduction This chart bootstraps an [nextcloud](https://hub.docker.com/_/nextcloud/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. It also packages the [Bitnami MariaDB chart](https://github.com/kubernetes/charts/tree/master/stable/mariadb) which is required for bootstrapping a MariaDB deployment for the database requirements of the nextcloud application. -## Prerequisites - -- Kubernetes 1.9+ with Beta APIs enabled -- PV provisioner support in the underlying infrastructure - -## Installing the Chart - -To install the chart with the release name `my-release`: - -```console -helm repo add nextcloud https://nextcloud.github.io/helm/ -helm install my-release nextcloud/nextcloud -``` - -The command deploys nextcloud on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. - -> **Tip**: List all releases using `helm list` - -## 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. - ## Configuration The following table lists the configurable parameters of the nextcloud chart and their default values. diff --git a/test/nextcloud/2.3.2/app-readme.md b/test/nextcloud/2.3.2/app-readme.md new file mode 100644 index 00000000000..f2e78c31f9c --- /dev/null +++ b/test/nextcloud/2.3.2/app-readme.md @@ -0,0 +1,3 @@ +# nextcloud + +[nextcloud](https://nextcloud.com/) is a file sharing server that puts the control and security of your own data back into your hands. diff --git a/test/nextcloud/item.yaml b/test/nextcloud/item.yaml new file mode 100644 index 00000000000..f06426856f0 --- /dev/null +++ b/test/nextcloud/item.yaml @@ -0,0 +1,2 @@ +categories: + - productivity From b56a40cec3e7790b26d216930fafa42afd78749a Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 3 Dec 2020 20:46:02 +0500 Subject: [PATCH 03/29] Add basic questions.yaml allowing chart to be deployed via middleware api --- test/nextcloud/2.3.2/questions.yaml | 104 ++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 test/nextcloud/2.3.2/questions.yaml diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml new file mode 100644 index 00000000000..57dd9d03301 --- /dev/null +++ b/test/nextcloud/2.3.2/questions.yaml @@ -0,0 +1,104 @@ +groups: + - name: "Container Images" + description: "Image to be used for container" + - name: "Nextcloud Configuration" + description: "Configuration details for Nextcloud workload" + +questions: + # Image related + - variable: image + description: "Docker Image Details" + label: "Docker Image" + group: "Container Images" + schema: + type: dict + required: true + attrs: + - variable: repository + description: "Docker image repository" + label: "Image repository" + schema: + type: string + default: "nextcloud" + required: true + - variable: tag + description: "Tag to use for specified image" + label: "Image Tag" + schema: + type: string + default: "latest" + - variable: pullPolicy + description: "Docker Image Pull Policy" + label: "Image Pull Policy" + schema: + type: string + default: "IfNotPresent" + enum: + - value: "IfNotPresent" + description: "Only pull image if not present on host" + - value: "Always" + description: "Always pull image even if present on host" + - value: "Never" + description: "Never pull image even if it's not present on host" + + - variable: nextcloud + description: "Nextcloud configuration details" + label: "Nextcloud Configuration" + group: "Nextcloud Configuration" + schema: + type: dict + required: true + attrs: + - variable: host + description: "Nextcloud host to create application URLs" + label: "Nextcloud host" + schema: + type: string + default: "nextcloud.kube.home" + - variable: username + label: "Username" + schema: + type: string + default: "admin" + required: true + - variable: password + label: "Password" + schema: + type: string + private: true + default: "changeme" + required: true + - variable: datadir + label: "Nextcloud data directory" + schema: + type: path + default: "/var/www/html/data" + required: true + - variable: strategy + label: "Nextcloud update strategy" + schema: + type: string + default: "Recreate" + enum: + - value: "RollingUpdate" + description: "Create new pods and then kill old ones" + - value: "Recreate" + description: "Kill existing pods before creating new ones" + - variable: extraEnv + + - variable: service + description: "Nextcloud Service Configuration" + label: "Nextcloud Service Configuration" + group: "Nextcloud Configuration" + schema: + type: dict + required: true + attrs: + - variable: nodePort + label: "Node Port to use for Nextcloud" + schema: + type: int + min: 9000 + max: 65535 + default: 9000 + required: true From a91f3fe2f10cf55738bc44d8f5488c018bed14e8 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 3 Dec 2020 20:48:34 +0500 Subject: [PATCH 04/29] Use nodeport for nextcloud --- test/nextcloud/2.3.2/questions.yaml | 1 - test/nextcloud/2.3.2/values.yaml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 57dd9d03301..ed104821677 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -84,7 +84,6 @@ questions: description: "Create new pods and then kill old ones" - value: "Recreate" description: "Kill existing pods before creating new ones" - - variable: extraEnv - variable: service description: "Nextcloud Service Configuration" diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index 546238caa1c..b62441bcab8 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -288,10 +288,10 @@ cronjob: # affinity: {} service: - type: ClusterIP + type: NodePort port: 8080 loadBalancerIP: nil - nodePort: nil + nodePort: 9000 ## Enable persistence using Persistent Volume Claims ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ From aa33f73fdaaa86ac883c4a3d9e5892a7ed0b0f62 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 3 Dec 2020 22:08:13 +0500 Subject: [PATCH 05/29] Use port 80 for nodeport service --- test/nextcloud/2.3.2/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index b62441bcab8..cdb6ec43939 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -289,7 +289,7 @@ cronjob: service: type: NodePort - port: 8080 + port: 80 loadBalancerIP: nil nodePort: 9000 From 8e719a47870319d511d8c50b2e5bcf72c2b9b7f6 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 4 Dec 2020 00:48:31 +0500 Subject: [PATCH 06/29] Allow using host path or ix volume for persistent data storage --- test/nextcloud/2.3.2/questions.yaml | 51 +++++++++++++++++++ test/nextcloud/2.3.2/templates/_helpers.tpl | 14 +++++ .../nextcloud/2.3.2/templates/deployment.yaml | 3 ++ 3 files changed, 68 insertions(+) diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index ed104821677..fafc322b0ec 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -3,6 +3,8 @@ groups: description: "Image to be used for container" - name: "Nextcloud Configuration" description: "Configuration details for Nextcloud workload" + - name: "Storage Configuration" + description: "Configure Storage for Nextcloud" questions: # Image related @@ -101,3 +103,52 @@ questions: max: 65535 default: 9000 required: true + + - variable: configureiXVolume + label: "Configure iX Volume" + group: "Storage Configuration" + description: "Use iX Volume for persistent storage" + schema: + type: boolean + default: true + required: true + show_subquestions_if: true + subquestions: + - variable: volume + label: "Configure iXVolume" + group: "Storage Configuration" + schema: + type: dict + $ref: + - "normalize/ixVolume" + attrs: + - variable: mountPath + label: "Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + editable: false + default: "/var/www" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + required: true + + - variable: configureHostPath + label: "Configure Host Path for storage" + description: "Use a path on host for persistent data storage" + group: "Storage Configuration" + schema: + type: boolean + default: false + required: true + show_if: [["configureiXVolume", "=", false]] + show_subquestions_if: true + subquestions: + - variable: volumeHostPath + label: "Host Path" + group: "Storage Configuration" + schema: + type: hostpath + required: true diff --git a/test/nextcloud/2.3.2/templates/_helpers.tpl b/test/nextcloud/2.3.2/templates/_helpers.tpl index 87c6e91d1bd..0761b84d9c0 100644 --- a/test/nextcloud/2.3.2/templates/_helpers.tpl +++ b/test/nextcloud/2.3.2/templates/_helpers.tpl @@ -47,3 +47,17 @@ Create chart name and version as used by the chart label. {{- define "nextcloud.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Retrieve host path defined in volume +*/}} +{{- define "configuredHostPath" -}} +{{- if .Values.configureiXVolume -}} +{{- $volDict := first .Values.ixVolumes -}} +{{- $volDict.hostPath -}} +{{- else if .Values.configureHostPath -}} +{{- .Values.volumeHostPath -}} +{{- else -}} +{{- printf "" -}} +{{- end -}} +{{- end -}} diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index fad0d7a3b6d..ad73b1fd298 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -328,6 +328,9 @@ spec: {{- if .Values.persistence.enabled }} persistentVolumeClaim: claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} + {{- else if ne (include "configuredHostPath" .) "" }} + hostPath: + path: {{ template "configuredHostPath" . }} {{- else }} emptyDir: {} {{- end }} From c0552c3c33614d637b2cdde634b5ba364ade5663 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 4 Dec 2020 03:59:31 +0500 Subject: [PATCH 07/29] Remove nextcloud chart deps --- test/nextcloud/2.3.2/Chart.yaml | 13 -- test/nextcloud/2.3.2/questions.yaml | 65 ++++++- .../nextcloud/2.3.2/templates/deployment.yaml | 2 +- test/nextcloud/2.3.2/values.yaml | 161 +----------------- 4 files changed, 66 insertions(+), 175 deletions(-) diff --git a/test/nextcloud/2.3.2/Chart.yaml b/test/nextcloud/2.3.2/Chart.yaml index a72306391b8..c9c10ccfd7c 100644 --- a/test/nextcloud/2.3.2/Chart.yaml +++ b/test/nextcloud/2.3.2/Chart.yaml @@ -21,16 +21,3 @@ maintainers: email: christian.ingenhaag@googlemail.com - name: billimek email: jeff@billimek.com -dependencies: -- name: postgresql - version: 9.8.9 - repository: https://charts.bitnami.com/bitnami - condition: postgresql.enabled -- name: mariadb - version: 7.10.2 - repository: https://charts.bitnami.com/bitnami - condition: mariadb.enabled -- name: redis - version: 11.0.5 - repository: https://charts.bitnami.com/bitnami - condition: redis.enabled diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index fafc322b0ec..09c79bc2d3c 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -5,6 +5,10 @@ groups: description: "Configuration details for Nextcloud workload" - name: "Storage Configuration" description: "Configure Storage for Nextcloud" + - name: "Container Configuration" + description: "Configure nextcloud container parameters" + - name: "Nginx Configuration" + description: "Use nginx with Nextcloud" questions: # Image related @@ -50,6 +54,7 @@ questions: schema: type: dict required: true + additional_attrs: true attrs: - variable: host description: "Nextcloud host to create application URLs" @@ -94,6 +99,7 @@ questions: schema: type: dict required: true + additional_attrs: true attrs: - variable: nodePort label: "Node Port to use for Nextcloud" @@ -151,4 +157,61 @@ questions: group: "Storage Configuration" schema: type: hostpath - required: true + + - variable: lifecycle + label: "Define container Lifecycle" + group: "Container Configuration" + schema: + type: dict + additional_attrs: true + attrs: [] + + - variable: nginx + label: "Configure Nginx" + group: "Nginx Configuration" + schema: + type: dict + additional_attrs: true + attrs: [] + + - variable: internalDatabase + label: "REMOVEME" + schema: + type: dict + additional_attrs: true + attrs: [] + + - variable: externalDatabase + label: "REMOVEME" + schema: + type: dict + additional_attrs: true + attrs: [] + + - variable: postgresql + label: "REMOVEME" + schema: + type: dict + additional_attrs: true + attrs: [] + + - variable: cronjob + label: "REMOVEME" + schema: + type: dict + additional_attrs: true + attrs: [] + + - variable: livenessProbe + label: "REMOVEME" + schema: + type: dict + additional_attrs: true + attrs: [] + + - variable: readinessProbe + label: "REMOVEME" + schema: + type: dict + additional_attrs: true + attrs: [] diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index ad73b1fd298..e520e753411 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -15,7 +15,7 @@ metadata: spec: replicas: {{ .Values.replicaCount }} strategy: -{{ toYaml .Values.nextcloud.strategy | indent 4 }} + type: {{ .Values.nextcloud.strategy }} selector: matchLabels: app.kubernetes.io/name: {{ include "nextcloud.name" . }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index cdb6ec43939..c1f02cfae10 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -8,51 +8,9 @@ image: # pullSecrets: # - myRegistrKeySecretName -nameOverride: "" -fullnameOverride: "" - -# Number of replicas to be deployed -replicaCount: 1 - ## Allowing use of ingress controllers ## ref: https://kubernetes.io/docs/concepts/services-networking/ingress/ ## -ingress: - enabled: false - annotations: {} - # nginx.ingress.kubernetes.io/proxy-body-size: 4G - # kubernetes.io/tls-acme: "true" - # certmanager.k8s.io/cluster-issuer: letsencrypt-prod - # nginx.ingress.kubernetes.io/server-snippet: |- - # server_tokens off; - # proxy_hide_header X-Powered-By; - - # rewrite ^/.well-known/webfinger /public.php?service=webfinger last; - # rewrite ^/.well-known/host-meta /public.php?service=host-meta last; - # rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json; - # location = /.well-known/carddav { - # return 301 $scheme://$host/remote.php/dav; - # } - # location = /.well-known/caldav { - # return 301 $scheme://$host/remote.php/dav; - # } - # location = /robots.txt { - # allow all; - # log_not_found off; - # access_log off; - # } - # location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { - # deny all; - # } - # location ~ ^/(?:autotest|occ|issue|indie|db_|console) { - # deny all; - # } - # tls: - # - secretName: nextcloud-tls - # hosts: - # - nextcloud.kube.home - labels: {} - # Allow configuration of lifecycle hooks # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ @@ -128,8 +86,7 @@ nextcloud: ## 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 + strategy: "Recreate" # type: RollingUpdate # rollingUpdate: # maxSurge: 1 @@ -204,31 +161,6 @@ externalDatabase: # usernameKey: username # passwordKey: password -## -## MariaDB chart configuration -## -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 - enabled: false - - db: - name: nextcloud - user: nextcloud - password: changeme - - replication: - enabled: false - - ## Enable persistence using Persistent Volume Claims - ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ - ## - master: - persistence: - enabled: false - # storageClass: "" - accessMode: ReadWriteOnce - size: 8Gi - postgresql: enabled: false global: @@ -240,10 +172,6 @@ postgresql: enabled: false # storageClass: "" -redis: - enabled: false - usePassword: false - ## Cronjob to execute Nextcloud background tasks ## ref: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#webcron ## @@ -293,42 +221,6 @@ service: loadBalancerIP: nil nodePort: 9000 -## Enable persistence using Persistent Volume Claims -## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ -## -persistence: - # Nextcloud Data (/var/www/html) - enabled: false - annotations: {} - ## nextcloud data 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: - - accessMode: ReadWriteOnce - size: 8Gi - -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 - ## Liveness and readiness probe values ## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes ## @@ -346,54 +238,3 @@ readinessProbe: timeoutSeconds: 5 failureThreshold: 3 successThreshold: 1 - -## Enable pod autoscaling using HorizontalPodAutoscaler -## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ -## -hpa: - enabled: false - cputhreshold: 60 - minPods: 1 - maxPods: 10 - -nodeSelector: {} - -tolerations: [] - -affinity: {} - - -## Prometheus Exporter / Metrics -## -metrics: - enabled: false - - replicaCount: 1 - # The metrics exporter needs to know how you serve Nextcloud either http or https - https: false - timeout: 5s - - image: - repository: xperimental/nextcloud-exporter - tag: v0.3.0 - pullPolicy: IfNotPresent - - ## Metrics exporter resource requests and limits - ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ - ## - # resources: {} - - ## Metrics exporter pod Annotation and Labels - # podAnnotations: {} - - # podLabels: {} - - service: - type: ClusterIP - ## Use serviceLoadBalancerIP to request a specific static IP, - ## otherwise leave blank - # loadBalancerIP: - annotations: - prometheus.io/scrape: "true" - prometheus.io/port: "9205" - labels: {} From 918fbb0963b0d07ba54f637d314e9b8e6bb4a1c4 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 4 Dec 2020 04:12:04 +0500 Subject: [PATCH 08/29] Clean service configuration --- test/nextcloud/2.3.2/questions.yaml | 1 - test/nextcloud/2.3.2/templates/NOTES.txt | 93 +------------------ test/nextcloud/2.3.2/templates/db-secret.yaml | 7 +- .../nextcloud/2.3.2/templates/deployment.yaml | 29 +----- test/nextcloud/2.3.2/templates/hpa.yaml | 20 ---- test/nextcloud/2.3.2/templates/ingress.yaml | 31 ------- .../2.3.2/templates/metrics-deployment.yaml | 55 ----------- .../2.3.2/templates/metrics-service.yaml | 31 ------- .../2.3.2/templates/nextcloud-pvc.yaml | 31 ------- test/nextcloud/2.3.2/templates/service.yaml | 9 +- test/nextcloud/2.3.2/values.yaml | 3 - 11 files changed, 5 insertions(+), 305 deletions(-) delete mode 100644 test/nextcloud/2.3.2/templates/hpa.yaml delete mode 100644 test/nextcloud/2.3.2/templates/ingress.yaml delete mode 100644 test/nextcloud/2.3.2/templates/metrics-deployment.yaml delete mode 100644 test/nextcloud/2.3.2/templates/metrics-service.yaml delete mode 100644 test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 09c79bc2d3c..38a89adef32 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -99,7 +99,6 @@ questions: schema: type: dict required: true - additional_attrs: true attrs: - variable: nodePort label: "Node Port to use for Nextcloud" diff --git a/test/nextcloud/2.3.2/templates/NOTES.txt b/test/nextcloud/2.3.2/templates/NOTES.txt index f1428c5e10a..e876825c056 100644 --- a/test/nextcloud/2.3.2/templates/NOTES.txt +++ b/test/nextcloud/2.3.2/templates/NOTES.txt @@ -1,94 +1,3 @@ -{{- if or .Values.mariadb.enabled .Values.externalDatabase.host -}} - -{{- if empty .Values.nextcloud.host -}} -################################################################################# -### WARNING: You did not provide an external host in your 'helm install' call ### -################################################################################# - -This deployment will be incomplete until you configure nextcloud with a resolvable -host. To configure nextcloud with the URL of your service: - 1. Get the nextcloud URL by running: - {{- if contains "NodePort" .Values.service.type }} - - export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") - export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - - {{- else if contains "LoadBalancer" .Values.service.type }} - - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "nextcloud.fullname" . }}' - - export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") - export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) - {{- if .Values.mariadb.db.password }} - export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.mariadb.fullname" . }} -o jsonpath="{.data.mariadb-password}" | base64 --decode) - {{- end }} - {{- end }} - -2. Complete your nextcloud deployment by running: - -{{- if .Values.mariadb.enabled }} - - helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ - --set nextcloud.host=$APP_HOST,nextcloud.password=$APP_PASSWORD{{ if .Values.mariadb.db.password }},mariadb.db.password=$APP_DATABASE_PASSWORD{{ end }} -{{- else }} - - ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## - - helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ - --set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type={{ .Values.service.type }},mariadb.enabled=false{{- if not (empty .Values.externalDatabase.host) }},externalDatabase.host={{ .Values.externalDatabase.host }}{{- end }}{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }} -{{- end }} - -{{- else -}} -1. Get the nextcloud URL by running: - -{{- if eq .Values.service.type "ClusterIP" }} - - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "nextcloud.fullname" . }}" -o jsonpath="{.items[0].metadata.name}") - echo http://127.0.0.1:8080/ - kubectl port-forward $POD_NAME 8080:80 -{{- else }} - - echo http://{{ .Values.nextcloud.host }}/ -{{- end }} - -2. Get your nextcloud login credentials by running: - - echo User: {{ .Values.nextcloud.username }} - echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) -{{- end }} - -{{- else -}} - -####################################################################################################### -## WARNING: You did not provide an external database host in your 'helm install' call ## -## Running Nextcloud with the integrated sqlite database is not recommended for production instances ## -####################################################################################################### - -For better performance etc. you have to configure nextcloud with a resolvable database -host. To configure nextcloud to use and external database host: - - -1. Complete your nextcloud deployment by running: - -{{- if contains "NodePort" .Values.service.type }} - export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") -{{- else if contains "LoadBalancer" .Values.service.type }} - - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "nextcloud.fullname" . }}' - - export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") -{{- else }} - - export APP_HOST=127.0.0.1 -{{- end }} - export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode) - - ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## - - helm upgrade {{ .Release.Name }} nextcloud/nextcloud \ - --set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type={{ .Values.service.type }},mariadb.enabled=false{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }},externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST -{{- end }} + echo http://{{ .Values.nextcloud.host }}:{{ .Values.service.type }}/ diff --git a/test/nextcloud/2.3.2/templates/db-secret.yaml b/test/nextcloud/2.3.2/templates/db-secret.yaml index 790b65b75be..22149b92b07 100644 --- a/test/nextcloud/2.3.2/templates/db-secret.yaml +++ b/test/nextcloud/2.3.2/templates/db-secret.yaml @@ -1,4 +1,4 @@ -{{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled }} +{{- if .Values.externalDatabase.enabled }} {{- if not .Values.externalDatabase.existingSecret.enabled }} apiVersion: v1 kind: Secret @@ -11,12 +11,7 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} type: Opaque data: - {{- if .Values.mariadb.enabled }} - db-password: {{ default "" .Values.mariadb.db.password | b64enc | quote }} - db-username: {{ default "" .Values.mariadb.db.user | b64enc | quote }} - {{- else }} db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} db-username: {{ default "" .Values.externalDatabase.user | b64enc | quote }} - {{- end }} {{- end }} {{- end }} \ No newline at end of file diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index e520e753411..d9fc472d9ca 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -27,9 +27,6 @@ spec: app.kubernetes.io/name: {{ include "nextcloud.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: app - {{- if .Values.redis.enabled }} - {{ template "nextcloud.redis.fullname" . }}-client: "true" - {{- end }} {{- if .Values.podAnnotations }} annotations: {{ toYaml .Values.podAnnotations | indent 8 }} @@ -64,21 +61,6 @@ spec: {{- if .Values.internalDatabase.enabled }} - name: SQLITE_DATABASE value: {{ .Values.internalDatabase.name | quote }} - {{- else if .Values.mariadb.enabled }} - - name: MYSQL_HOST - value: {{ template "nextcloud.mariadb.fullname" . }} - - name: MYSQL_DATABASE - value: {{ .Values.mariadb.db.name | quote }} - - name: MYSQL_USER - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - - name: MYSQL_PASSWORD - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} {{- else }} {{- if eq .Values.externalDatabase.type "postgresql" }} - name: POSTGRES_HOST @@ -158,12 +140,6 @@ spec: name: {{ template "nextcloud.fullname" . }} key: smtp-password {{- end }} - {{- if .Values.redis.enabled }} - - name: REDIS_HOST - value: {{ template "nextcloud.redis.fullname" . }}-master - - name: REDIS_HOST_PORT - value: {{ .Values.redis.redisPort | quote }} - {{- end }} {{- if .Values.nextcloud.extraEnv }} {{ toYaml .Values.nextcloud.extraEnv | indent 8 }} {{- end }} @@ -325,10 +301,7 @@ spec: {{- end }} volumes: - name: nextcloud-data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} - {{- else if ne (include "configuredHostPath" .) "" }} + {{- if ne (include "configuredHostPath" .) "" }} hostPath: path: {{ template "configuredHostPath" . }} {{- else }} diff --git a/test/nextcloud/2.3.2/templates/hpa.yaml b/test/nextcloud/2.3.2/templates/hpa.yaml deleted file mode 100644 index 52a30043a5c..00000000000 --- a/test/nextcloud/2.3.2/templates/hpa.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if .Values.hpa.enabled -}} -apiVersion: autoscaling/v1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ template "nextcloud.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app -spec: - scaleTargetRef: - kind: Deployment - apiVersion: apps/v1 - name: {{ template "nextcloud.fullname" . }} - minReplicas: {{ .Values.hpa.minPods }} - maxReplicas: {{ .Values.hpa.maxPods }} - targetCPUUtilizationPercentage: {{ .Values.hpa.cputhreshold }} -{{- end }} \ No newline at end of file diff --git a/test/nextcloud/2.3.2/templates/ingress.yaml b/test/nextcloud/2.3.2/templates/ingress.yaml deleted file mode 100644 index 980c79a29dc..00000000000 --- a/test/nextcloud/2.3.2/templates/ingress.yaml +++ /dev/null @@ -1,31 +0,0 @@ -{{- if .Values.ingress.enabled }} -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: - name: {{ template "nextcloud.fullname" . }} - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app -{{- if .Values.ingress.labels }} -{{ toYaml .Values.ingress.labels | indent 4 }} -{{- end }} -{{- if .Values.ingress.annotations }} - annotations: -{{ toYaml .Values.ingress.annotations | indent 4 }} -{{- end }} -spec: - rules: - - host: {{ .Values.nextcloud.host }} - http: - paths: - - backend: - serviceName: {{ template "nextcloud.fullname" . }} - servicePort: {{ .Values.service.port }} -{{- if .Values.ingress.tls }} - tls: -{{ toYaml .Values.ingress.tls | indent 4 }} -{{- end -}} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/metrics-deployment.yaml b/test/nextcloud/2.3.2/templates/metrics-deployment.yaml deleted file mode 100644 index 66eb8421030..00000000000 --- a/test/nextcloud/2.3.2/templates/metrics-deployment.yaml +++ /dev/null @@ -1,55 +0,0 @@ -{{- if .Values.metrics.enabled }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "nextcloud.fullname" . }}-metrics - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: metrics -spec: - replicas: {{ .Values.metrics.replicaCount }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: metrics - template: - metadata: - annotations: {{- toYaml .Values.metrics.podAnnotations | nindent 8 }} - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: metrics - {{- if .Values.metrics.podLabels }} -{{ toYaml .Values.metrics.podLabels | indent 8 }} - {{- end }} - spec: - containers: - - name: metrics-exporter - image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}" - imagePullPolicy: {{ .Values.metrics.image.pullPolicy }} - env: - - name: NEXTCLOUD_USERNAME - valueFrom: - secretKeyRef: - name: {{ template "nextcloud.fullname" . }} - key: nextcloud-username - - name: NEXTCLOUD_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "nextcloud.fullname" . }} - key: nextcloud-password - - name: NEXTCLOUD_SERVER - value: http{{ if .Values.metrics.https }}s{{ end }}://{{ .Values.nextcloud.host }} - - name: NEXTCLOUD_TIMEOUT - value: {{ .Values.metrics.timeout }} - ports: - - name: metrics - containerPort: 9205 - {{- if .Values.metrics.resources }} - resources: {{- toYaml .Values.metrics.resources | nindent 10 }} - {{- end }} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/metrics-service.yaml b/test/nextcloud/2.3.2/templates/metrics-service.yaml deleted file mode 100644 index b349751cf20..00000000000 --- a/test/nextcloud/2.3.2/templates/metrics-service.yaml +++ /dev/null @@ -1,31 +0,0 @@ -{{- if .Values.metrics.enabled }} -apiVersion: v1 -kind: Service -metadata: - name: {{ template "nextcloud.fullname" . }}-metrics - labels: - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - {{- if .Values.metrics.service.labels -}} - {{ toYaml .Values.metrics.service.labels | nindent 4 }} - {{- end -}} - {{- if .Values.metrics.service.annotations }} - annotations: {{ toYaml .Values.metrics.service.annotations | nindent 4 }} - {{- end }} -spec: - type: {{ .Values.metrics.service.type }} - {{ if eq .Values.metrics.service.type "LoadBalancer" -}} {{ if .Values.metrics.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} - {{ end -}} - {{- end -}} - ports: - - name: metrics - port: 9205 - targetPort: metrics - selector: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml b/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml deleted file mode 100644 index 8c1789afdb3..00000000000 --- a/test/nextcloud/2.3.2/templates/nextcloud-pvc.yaml +++ /dev/null @@ -1,31 +0,0 @@ -{{- if .Values.persistence.enabled -}} -{{- if not .Values.persistence.existingClaim -}} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ template "nextcloud.fullname" . }}-nextcloud - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app -{{- if .Values.persistence.annotations }} - annotations: -{{ toYaml .Values.persistence.annotations | indent 4 }} -{{- end }} -spec: - accessModes: - - {{ .Values.persistence.accessMode | quote }} - resources: - requests: - storage: {{ .Values.persistence.size | quote }} -{{- if .Values.persistence.storageClass }} -{{- if (eq "-" .Values.persistence.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.storageClass }}" -{{- end }} -{{- end }} -{{- end -}} -{{- end -}} diff --git a/test/nextcloud/2.3.2/templates/service.yaml b/test/nextcloud/2.3.2/templates/service.yaml index 68f67e94825..7f307f5caf7 100644 --- a/test/nextcloud/2.3.2/templates/service.yaml +++ b/test/nextcloud/2.3.2/templates/service.yaml @@ -9,17 +9,12 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: app spec: - type: {{ .Values.service.type }} - {{- if eq .Values.service.type "LoadBalancer" }} - loadBalancerIP: {{ default "" .Values.service.loadBalancerIP }} - {{- end }} + type: NodePort ports: - - port: {{ .Values.service.port }} + - port: 80 targetPort: http protocol: TCP name: http - {{- if eq .Values.service.type "NodePort" }} nodePort: {{ default "" .Values.service.nodePort}} - {{- end }} selector: app.kubernetes.io/name: {{ include "nextcloud.name" . }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index c1f02cfae10..ee2b903969f 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -216,9 +216,6 @@ cronjob: # affinity: {} service: - type: NodePort - port: 80 - loadBalancerIP: nil nodePort: 9000 ## Liveness and readiness probe values From eb3c7a6ae606afbb6bafedf3c6f3270bbeb93f7c Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 4 Dec 2020 07:13:12 +0500 Subject: [PATCH 09/29] Initial postgres support --- test/nextcloud/2.3.2/questions.yaml | 55 +++++++++++++++---- test/nextcloud/2.3.2/templates/_helpers.tpl | 16 ++++++ .../2.3.2/templates/postgres-service.yaml | 18 ++++++ test/nextcloud/2.3.2/templates/service.yaml | 2 +- test/nextcloud/2.3.2/values.yaml | 32 ++--------- 5 files changed, 82 insertions(+), 41 deletions(-) create mode 100644 test/nextcloud/2.3.2/templates/postgres-service.yaml diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 38a89adef32..979029b6261 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -7,8 +7,8 @@ groups: description: "Configure Storage for Nextcloud" - name: "Container Configuration" description: "Configure nextcloud container parameters" - - name: "Nginx Configuration" - description: "Use nginx with Nextcloud" + - name: "Postgresql Configuration" + description: "Configure Postgresql for nextcloud" questions: # Image related @@ -165,14 +165,6 @@ questions: additional_attrs: true attrs: [] - - variable: nginx - label: "Configure Nginx" - group: "Nginx Configuration" - schema: - type: dict - additional_attrs: true - attrs: [] - - variable: internalDatabase label: "REMOVEME" schema: @@ -188,11 +180,50 @@ questions: attrs: [] - variable: postgresql - label: "REMOVEME" + label: "Configure Postgresql" + group: "Postgresql Configuration" schema: type: dict additional_attrs: true - attrs: [] + attrs: + - variable: backupVolume + label: "Backup Volume" + schema: + type: dict + $ref: + - "normalize/ixVolume" + attrs: + - variable: mountPath + label: "Mount Path" + schema: + type: path + editable: false + default: "/postgres_backups" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + default: "ix-postgres_backups" + editable: false + - variable: dataVolume + label: "Postgresql Data Volume" + schema: + type: dict + $ref: + - "normalize/ixVolume" + attrs: + - variable: mountPath + label: "Mount Path" + schema: + type: path + editable: false + default: "/var/lib/postgresql/data" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + default: "ix-postgres_data" + editable: false - variable: cronjob label: "REMOVEME" diff --git a/test/nextcloud/2.3.2/templates/_helpers.tpl b/test/nextcloud/2.3.2/templates/_helpers.tpl index 0761b84d9c0..a376df3b00d 100644 --- a/test/nextcloud/2.3.2/templates/_helpers.tpl +++ b/test/nextcloud/2.3.2/templates/_helpers.tpl @@ -61,3 +61,19 @@ Retrieve host path defined in volume {{- printf "" -}} {{- end -}} {{- end -}} + +{{/* +Selector labels +*/}} +{{- define "nextcloud.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nextcloud.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Postgres Selector labels +*/}} +{{- define "nextcloud.postgres.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres +app.kubernetes.io/instance: {{ .Release.Name }}-postgres +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/postgres-service.yaml b/test/nextcloud/2.3.2/templates/postgres-service.yaml new file mode 100644 index 00000000000..4d2837e4d5a --- /dev/null +++ b/test/nextcloud/2.3.2/templates/postgres-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "nextcloud.fullname" . }}-postgres + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app +spec: + type: ClusterIP + ports: + - port: 5432 + protocol: TCP + name: postgres-tcp + selector: + {{- include "nextcloud.postgres.selectorLabels" . | nindent 4 }} diff --git a/test/nextcloud/2.3.2/templates/service.yaml b/test/nextcloud/2.3.2/templates/service.yaml index 7f307f5caf7..3e2287d1960 100644 --- a/test/nextcloud/2.3.2/templates/service.yaml +++ b/test/nextcloud/2.3.2/templates/service.yaml @@ -17,4 +17,4 @@ spec: name: http nodePort: {{ default "" .Values.service.nodePort}} selector: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} + {{- include "nextcloud.selectorLabels" . | nindent 4 }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index ee2b903969f..25692bd61ee 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -113,34 +113,18 @@ nextcloud: # - name: nfs # mountPath: "/legacy_data" -nginx: - ## You need to set an fpm version of the image for nextcloud if you want to use nginx! - enabled: false - image: - repository: nginx - tag: alpine - pullPolicy: IfNotPresent - - config: - # This generates the default nginx config as per the nextcloud documentation - default: true - # custom: |- - # worker_processes 1;.. - - resources: {} - internalDatabase: - enabled: true + enabled: false name: nextcloud ## ## External database configuration ## externalDatabase: - enabled: false + enabled: true ## Supported database engines: mysql or postgresql - type: mysql + type: postgresql ## Database host host: @@ -162,15 +146,7 @@ externalDatabase: # passwordKey: password postgresql: - enabled: false - global: - postgresql: - postgresqlUsername: nextcloud - postgresqlPassword: changeme - postgresqlDatabase: nextcloud - persistence: - enabled: false - # storageClass: "" + host: ## Cronjob to execute Nextcloud background tasks ## ref: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#webcron From 43ab3e05fe159f6d795254e302a71f5d48896403 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 19:17:20 +0500 Subject: [PATCH 10/29] Add postgresql deployment --- test/nextcloud/2.3.2/templates/_helpers.tpl | 16 ++++++ .../2.3.2/templates/postgres-deployment.yaml | 51 +++++++++++++++++++ .../2.3.2/templates/postgres-secret.yaml | 12 +++++ 3 files changed, 79 insertions(+) create mode 100644 test/nextcloud/2.3.2/templates/postgres-deployment.yaml create mode 100644 test/nextcloud/2.3.2/templates/postgres-secret.yaml diff --git a/test/nextcloud/2.3.2/templates/_helpers.tpl b/test/nextcloud/2.3.2/templates/_helpers.tpl index a376df3b00d..004ec38d447 100644 --- a/test/nextcloud/2.3.2/templates/_helpers.tpl +++ b/test/nextcloud/2.3.2/templates/_helpers.tpl @@ -62,6 +62,22 @@ Retrieve host path defined in volume {{- end -}} {{- end -}} +{{/* +Retrieve backup postgresql host path defined in volume +*/}} +{{- define "configuredBackupPostgresHostPath" -}} +{{- $backupVolDict := first .Values.postgresql.backupVolume -}} +{{- $backupVolDict.hostPath -}} +{{- end -}} + +{{/* +Retrieve postgresql data host path defined in volume +*/}} +{{- define "configuredPostgresHostPath" -}} +{{- $dataVolDict := first .Values.postgresql.dataVolume -}} +{{- $dataVolDict.hostPath -}} +{{- end -}} + {{/* Selector labels */}} diff --git a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml new file mode 100644 index 00000000000..ecc6e56a934 --- /dev/null +++ b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "nextcloud.fullname" . }}-postgres + labels: + helm.sh/chart: {{ include "nextcloud.chart" . }} + {{- include "nextcloud.postgres.selectorLabels" . | nindent 4 }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: database +spec: + replicas: 1 + strategy: + type: {{ .Values.nextcloud.strategy }} + selector: + matchLabels: + {{- include "nextcloud.postgres.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: database + template: + metadata: + labels: + {{- include "nextcloud.postgres.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: database + annotations: + rollme: {{ randAlphaNum 5 | quote }} + spec: + containers: + - name: {{ .Chart.Name }}-postgres + image: "postgres:13.1" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: db-details + key: db-password + volumeMounts: + - name: postgres-data + mountPath: /var/lib/postgresql/data + - name: postgres-backup + mountPath: /postgres_backups + ports: + - name: postgres-tcp + containerPort: 5432 + protocol: TCP + volumes: + - name: postgres-data + hostPath: + path: {{ template "configuredPostgresHostPath" . }} + - name: postgres-backup + hostPath: + path: {{ template "configuredBackupPostgresHostPath" . }} diff --git a/test/nextcloud/2.3.2/templates/postgres-secret.yaml b/test/nextcloud/2.3.2/templates/postgres-secret.yaml new file mode 100644 index 00000000000..c19e626e65b --- /dev/null +++ b/test/nextcloud/2.3.2/templates/postgres-secret.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Secret +metadata: + name: db-details +data: + {{- if .Release.IsInstall }} + db-password: {{ randAlphaNum 15 | b64enc | quote }} + {{ else }} + # `index` function is necessary because the property name contains a dash. + # Otherwise (...).data.db_password would have worked too. + db-password: {{ index (lookup "v1" "Secret" .Release.Namespace "db-details").data "db-password" }} + {{ end }} From f323a2ce5a18735d6a578201a36fb8702fc4c683 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 19:25:23 +0500 Subject: [PATCH 11/29] Clean nextcloud deployment removing nginx traces --- .../nextcloud/2.3.2/templates/deployment.yaml | 168 +----------------- test/nextcloud/2.3.2/values.yaml | 24 --- 2 files changed, 3 insertions(+), 189 deletions(-) diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index d9fc472d9ca..4930131aeb8 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -13,7 +13,7 @@ metadata: {{ toYaml .Values.deploymentAnnotations | indent 4 }} {{- end }} spec: - replicas: {{ .Values.replicaCount }} + replicas: 1 strategy: type: {{ .Values.nextcloud.strategy }} selector: @@ -42,21 +42,6 @@ spec: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- if .Values.lifecycle }} - lifecycle: - {{- if .Values.lifecycle.postStartCommand }} - postStart: - exec: - command: - {{- toYaml .Values.lifecycle.postStartCommand | nindent 16 -}} - {{- end }} - {{- if .Values.lifecycle.preStopCommand }} - preStop: - exec: - command: - {{- toYaml .Values.lifecycle.preStopCommand | nindent 16 -}} - {{- end }} - {{- end }} env: {{- if .Values.internalDatabase.enabled }} - name: SQLITE_DATABASE @@ -73,21 +58,6 @@ spec: name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} - {{- else }} - - name: MYSQL_HOST - value: {{ .Values.externalDatabase.host | quote }} - - name: MYSQL_DATABASE - value: {{ .Values.externalDatabase.database | quote }} - - name: MYSQL_USER - valueFrom: - secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} - - name: MYSQL_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} @@ -106,50 +76,13 @@ spec: key: nextcloud-password - name: NEXTCLOUD_TRUSTED_DOMAINS value: {{ .Values.nextcloud.host }} - {{- if ne (int .Values.nextcloud.update) 0 }} - - name: NEXTCLOUD_UPDATE - value: {{ .Values.nextcloud.update | quote }} - {{- end }} - name: NEXTCLOUD_DATA_DIR value: {{ .Values.nextcloud.datadir | quote }} - {{- if .Values.nextcloud.tableprefix }} - - name: NEXTCLOUD_TABLE_PREFIX - value: {{ .Values.nextcloud.tableprefix | quote }} - {{- end }} - {{- if .Values.nextcloud.mail.enabled }} - - name: MAIL_FROM_ADDRESS - value: {{ .Values.nextcloud.mail.fromAddress | quote }} - - name: MAIL_DOMAIN - value: {{ .Values.nextcloud.mail.domain | quote }} - - name: SMTP_HOST - value: {{ .Values.nextcloud.mail.smtp.host | quote }} - - name: SMTP_SECURE - value: {{ .Values.nextcloud.mail.smtp.secure | quote }} - - name: SMTP_PORT - value: {{ .Values.nextcloud.mail.smtp.port | quote }} - - name: SMTP_AUTHTYPE - value: {{ .Values.nextcloud.mail.smtp.authtype | quote }} - - name: SMTP_NAME - valueFrom: - secretKeyRef: - name: {{ template "nextcloud.fullname" . }} - key: smtp-username - - name: SMTP_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "nextcloud.fullname" . }} - key: smtp-password - {{- end }} - {{- if .Values.nextcloud.extraEnv }} -{{ toYaml .Values.nextcloud.extraEnv | indent 8 }} - {{- end }} - {{- if not .Values.nginx.enabled }} ports: - name: http containerPort: 80 protocol: TCP - {{- end }} - {{- if and .Values.livenessProbe.enabled (not .Values.nginx.enabled) }} + {{- if .Values.livenessProbe.enabled }} livenessProbe: httpGet: path: /status.php @@ -163,7 +96,7 @@ spec: successThreshold: {{ .Values.livenessProbe.successThreshold }} failureThreshold: {{ .Values.livenessProbe.failureThreshold }} {{- end }} - {{- if and .Values.readinessProbe.enabled (not .Values.nginx.enabled) }} + {{- if .Values.readinessProbe.enabled}} readinessProbe: httpGet: path: /status.php @@ -177,8 +110,6 @@ spec: successThreshold: {{ .Values.readinessProbe.successThreshold }} failureThreshold: {{ .Values.readinessProbe.failureThreshold }} {{- end }} - resources: -{{ toYaml .Values.resources | indent 10 }} volumeMounts: - name: nextcloud-data mountPath: /var/www/ @@ -220,85 +151,6 @@ spec: mountPath: /usr/local/etc/php/conf.d/{{ $key }} subPath: {{ $key }} {{- end }} - {{- if .Values.nextcloud.extraVolumeMounts }} -{{ toYaml .Values.nextcloud.extraVolumeMounts | indent 8 }} - {{- end }} - {{- if .Values.nginx.enabled }} - - name: {{ .Chart.Name }}-nginx - image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}" - imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - {{- if .Values.livenessProbe.enabled }} - livenessProbe: - httpGet: - path: /status.php - port: http - httpHeaders: - - name: Host - value: {{ .Values.nextcloud.host | quote }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - {{- end }} - {{- if .Values.readinessProbe.enabled }} - readinessProbe: - httpGet: - path: /status.php - port: http - httpHeaders: - - name: Host - value: {{ .Values.nextcloud.host | quote }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - {{- end }} - resources: -{{ toYaml .Values.nginx.resources | indent 10 }} - volumeMounts: - - name: nextcloud-data - mountPath: /var/www/ - subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-data - mountPath: /var/www/html - subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-data - mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/%s" .Values.nextcloud.persistence.subPath "data") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-data - mountPath: /var/www/html/config - subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-data - mountPath: /var/www/html/custom_apps - subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-data - mountPath: /var/www/tmp - subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-data - mountPath: /var/www/html/themes - subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }} - - name: nextcloud-nginx-config - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} volumes: - name: nextcloud-data {{- if ne (include "configuredHostPath" .) "" }} @@ -317,20 +169,6 @@ spec: configMap: name: {{ template "nextcloud.fullname" . }}-phpconfig {{- end }} - {{- if .Values.nginx.enabled }} - - name: nextcloud-nginx-config - configMap: - name: {{ template "nextcloud.fullname" . }}-nginxconfig - {{- end }} - {{- if .Values.nextcloud.extraVolumes }} -{{ toYaml .Values.nextcloud.extraVolumes | indent 6 }} - {{- end }} - {{- if .Values.nginx.enabled }} - # Will mount configuration files as www-data (id: 82) for nextcloud - securityContext: - fsGroup: 82 - {{- else }} # Will mount configuration files as www-data (id: 33) for nextcloud securityContext: fsGroup: 33 - {{- end }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index 25692bd61ee..43a7344ef65 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -5,18 +5,6 @@ image: repository: nextcloud tag: 19.0.3-apache pullPolicy: IfNotPresent - # pullSecrets: - # - myRegistrKeySecretName - -## Allowing use of ingress controllers -## ref: https://kubernetes.io/docs/concepts/services-networking/ingress/ -## - -# Allow configuration of lifecycle hooks -# ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ -lifecycle: {} - # postStartCommand: [] - # preStopCommand: [] nextcloud: host: nextcloud.kube.home @@ -24,20 +12,8 @@ nextcloud: password: changeme update: 0 datadir: /var/www/html/data - tableprefix: persistence: subPath: - mail: - enabled: false - fromAddress: user - domain: domain.com - smtp: - host: domain.com - secure: ssl - port: 465 - authtype: LOGIN - name: user - password: pass # PHP Configuration files # Will be injected in /usr/local/etc/php/conf.d phpConfigs: {} From 817de8f1b0577a1d5a747d538c48a8d939e87cae Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 19:26:28 +0500 Subject: [PATCH 12/29] Remove liveness/readiness probes --- test/nextcloud/2.3.2/questions.yaml | 22 --------------- .../nextcloud/2.3.2/templates/deployment.yaml | 28 ------------------- test/nextcloud/2.3.2/values.yaml | 20 +------------ 3 files changed, 1 insertion(+), 69 deletions(-) diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 979029b6261..ff3cc82e765 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -157,14 +157,6 @@ questions: schema: type: hostpath - - variable: lifecycle - label: "Define container Lifecycle" - group: "Container Configuration" - schema: - type: dict - additional_attrs: true - attrs: [] - - variable: internalDatabase label: "REMOVEME" schema: @@ -231,17 +223,3 @@ questions: type: dict additional_attrs: true attrs: [] - - - variable: livenessProbe - label: "REMOVEME" - schema: - type: dict - additional_attrs: true - attrs: [] - - - variable: readinessProbe - label: "REMOVEME" - schema: - type: dict - additional_attrs: true - attrs: [] diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index 4930131aeb8..e0f1dde442b 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -82,34 +82,6 @@ spec: - name: http containerPort: 80 protocol: TCP - {{- if .Values.livenessProbe.enabled }} - livenessProbe: - httpGet: - path: /status.php - port: http - httpHeaders: - - name: Host - value: {{ .Values.nextcloud.host | quote }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - {{- end }} - {{- if .Values.readinessProbe.enabled}} - readinessProbe: - httpGet: - path: /status.php - port: http - httpHeaders: - - name: Host - value: {{ .Values.nextcloud.host | quote }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - {{- end }} volumeMounts: - name: nextcloud-data mountPath: /var/www/ diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index 43a7344ef65..73a3d448814 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -168,22 +168,4 @@ cronjob: # affinity: {} service: - nodePort: 9000 - -## Liveness and readiness probe values -## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes -## -livenessProbe: - enabled: true - initialDelaySeconds: 30 - periodSeconds: 15 - timeoutSeconds: 5 - failureThreshold: 3 - successThreshold: 1 -readinessProbe: - enabled: true - initialDelaySeconds: 30 - periodSeconds: 15 - timeoutSeconds: 5 - failureThreshold: 3 - successThreshold: 1 + nodePort: 9000 \ No newline at end of file From 0995fc49235582f9b407a5abc96a42837cf5f1b9 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 19:33:33 +0500 Subject: [PATCH 13/29] Set postgres credentials in nextcloud deployment --- test/nextcloud/2.3.2/templates/deployment.yaml | 12 ++++++------ .../2.3.2/templates/postgres-deployment.yaml | 5 +++++ test/nextcloud/2.3.2/templates/postgres-secret.yaml | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index e0f1dde442b..10ee90fcd99 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -49,19 +49,19 @@ spec: {{- else }} {{- if eq .Values.externalDatabase.type "postgresql" }} - name: POSTGRES_HOST - value: {{ .Values.externalDatabase.host | quote }} + value: {{ template "nextcloud.fullname" . }}-postgres:5432 - name: POSTGRES_DB - value: {{ .Values.externalDatabase.database | quote }} + value: "nextcloud" - name: POSTGRES_USER valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }} + name: db-details + key: db-user - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: - name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }} - key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }} + name: db-details + key: db-password {{- end }} {{- end }} - name: NEXTCLOUD_ADMIN_USER diff --git a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml index ecc6e56a934..2214fc340b5 100644 --- a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml +++ b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml @@ -28,6 +28,11 @@ spec: image: "postgres:13.1" imagePullPolicy: {{ .Values.image.pullPolicy }} env: + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: db-details + key: db-user - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: diff --git a/test/nextcloud/2.3.2/templates/postgres-secret.yaml b/test/nextcloud/2.3.2/templates/postgres-secret.yaml index c19e626e65b..c6b3743dcac 100644 --- a/test/nextcloud/2.3.2/templates/postgres-secret.yaml +++ b/test/nextcloud/2.3.2/templates/postgres-secret.yaml @@ -9,4 +9,5 @@ data: # `index` function is necessary because the property name contains a dash. # Otherwise (...).data.db_password would have worked too. db-password: {{ index (lookup "v1" "Secret" .Release.Namespace "db-details").data "db-password" }} + db-user: postgres {{ end }} From ed7270ecc00d1949802e2346a42e085df458de1f Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 19:34:19 +0500 Subject: [PATCH 14/29] Only use postgres and remove sqlite support --- test/nextcloud/2.3.2/templates/deployment.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index 10ee90fcd99..97dfba7d9e6 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -43,11 +43,6 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - {{- if .Values.internalDatabase.enabled }} - - name: SQLITE_DATABASE - value: {{ .Values.internalDatabase.name | quote }} - {{- else }} - {{- if eq .Values.externalDatabase.type "postgresql" }} - name: POSTGRES_HOST value: {{ template "nextcloud.fullname" . }}-postgres:5432 - name: POSTGRES_DB @@ -62,8 +57,6 @@ spec: secretKeyRef: name: db-details key: db-password - {{- end }} - {{- end }} - name: NEXTCLOUD_ADMIN_USER valueFrom: secretKeyRef: From 0beb16ffe9d77438940acade22544e0eb50dc271 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 21:36:58 +0500 Subject: [PATCH 15/29] Properly initialise nextcloud with postgres --- .../nextcloud/2.3.2/templates/deployment.yaml | 1 + .../2.3.2/templates/nginx-config.yaml | 185 ------------------ .../2.3.2/templates/postgres-deployment.yaml | 4 +- .../2.3.2/templates/postgres-secret.yaml | 2 +- test/nextcloud/2.3.2/templates/secrets.yaml | 4 - test/nextcloud/2.3.2/values.yaml | 1 - 6 files changed, 4 insertions(+), 193 deletions(-) delete mode 100644 test/nextcloud/2.3.2/templates/nginx-config.yaml diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index 97dfba7d9e6..4af94c6ce0e 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -57,6 +57,7 @@ spec: secretKeyRef: name: db-details key: db-password + {{- end }} - name: NEXTCLOUD_ADMIN_USER valueFrom: secretKeyRef: diff --git a/test/nextcloud/2.3.2/templates/nginx-config.yaml b/test/nextcloud/2.3.2/templates/nginx-config.yaml deleted file mode 100644 index c4b20871026..00000000000 --- a/test/nextcloud/2.3.2/templates/nginx-config.yaml +++ /dev/null @@ -1,185 +0,0 @@ -{{- if .Values.nginx.enabled -}} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "nextcloud.fullname" . }}-nginxconfig - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -data: - nginx.conf: |- -{{- if .Values.nginx.config.default }} - worker_processes auto; - - error_log /var/log/nginx/error.log warn; - pid /var/run/nginx.pid; - - - events { - worker_connections 1024; - } - - - http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - upstream php-handler { - server 127.0.0.1:9000; - } - - server { - listen 80; - - # Add headers to serve security related headers - # Before enabling Strict-Transport-Security headers please read into this - # topic first. - #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; - # - # WARNING: Only add the preload option once you read about - # the consequences in https://hstspreload.org/. This option - # will add the domain to a hardcoded list that is shipped - # in all major browsers and getting removed from this list - # could take several months. - add_header Referrer-Policy "no-referrer" always; - add_header X-Content-Type-Options "nosniff" always; - add_header X-Download-Options "noopen" always; - add_header X-Frame-Options "SAMEORIGIN" always; - add_header X-Permitted-Cross-Domain-Policies "none" always; - add_header X-Robots-Tag "none" always; - add_header X-XSS-Protection "1; mode=block" always; - - # Remove X-Powered-By, which is an information leak - fastcgi_hide_header X-Powered-By; - - # Path to the root of your installation - root /var/www/html; - - location = /robots.txt { - allow all; - log_not_found off; - access_log off; - } - - # The following 2 rules are only needed for the user_webfinger app. - # Uncomment it if you're planning to use this app. - #rewrite ^/.well-known/host-meta /public.php?service=host-meta last; - #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; - - # The following rule is only needed for the Social app. - # Uncomment it if you're planning to use this app. - #rewrite ^/.well-known/webfinger /public.php?service=webfinger last; - - location = /.well-known/carddav { - return 301 $scheme://$host:$server_port/remote.php/dav; - } - - location = /.well-known/caldav { - return 301 $scheme://$host:$server_port/remote.php/dav; - } - - # set max upload size - client_max_body_size 10G; - fastcgi_buffers 64 4K; - - # Enable gzip but do not remove ETag headers - gzip on; - gzip_vary on; - gzip_comp_level 4; - gzip_min_length 256; - gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; - gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; - - # Uncomment if your server is build with the ngx_pagespeed module - # This module is currently not supported. - #pagespeed off; - - location / { - rewrite ^ /index.php; - } - - location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { - deny all; - } - location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) { - deny all; - } - - location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) { - fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; - set $path_info $fastcgi_path_info; - try_files $fastcgi_script_name =404; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $path_info; - # fastcgi_param HTTPS on; - - # Avoid sending the security headers twice - fastcgi_param modHeadersAvailable true; - - # Enable pretty urls - fastcgi_param front_controller_active true; - fastcgi_pass php-handler; - fastcgi_intercept_errors on; - fastcgi_request_buffering off; - } - - location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) { - try_files $uri/ =404; - index index.php; - } - - # Adding the cache control header for js, css and map files - # Make sure it is BELOW the PHP block - location ~ \.(?:css|js|woff2?|svg|gif|map)$ { - try_files $uri /index.php$request_uri; - add_header Cache-Control "public, max-age=15778463"; - # Add headers to serve security related headers (It is intended to - # have those duplicated to the ones above) - # Before enabling Strict-Transport-Security headers please read into - # this topic first. - #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; - # - # WARNING: Only add the preload option once you read about - # the consequences in https://hstspreload.org/. This option - # will add the domain to a hardcoded list that is shipped - # in all major browsers and getting removed from this list - # could take several months. - add_header Referrer-Policy "no-referrer" always; - add_header X-Content-Type-Options "nosniff" always; - add_header X-Download-Options "noopen" always; - add_header X-Frame-Options "SAMEORIGIN" always; - add_header X-Permitted-Cross-Domain-Policies "none" always; - add_header X-Robots-Tag "none" always; - add_header X-XSS-Protection "1; mode=block" always; - - # Optional: Don't log access to assets - access_log off; - } - - location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { - try_files $uri /index.php$request_uri; - # Optional: Don't log access to other assets - access_log off; - } - } - } -{{- else }} -{{ .Values.nginx.config.custom | indent 4 }} -{{- end }} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml index 2214fc340b5..fb63d918f06 100644 --- a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml +++ b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml @@ -50,7 +50,7 @@ spec: volumes: - name: postgres-data hostPath: - path: {{ template "configuredPostgresHostPath" . }} + path: "/mnt/evo/ix-applications/releases/nextcloud/volumes/ix_volumes/ix-postgres_data" - name: postgres-backup hostPath: - path: {{ template "configuredBackupPostgresHostPath" . }} + path: "/mnt/evo/ix-applications/releases/nextcloud/volumes/ix_volumes/ix-postgres_backups" diff --git a/test/nextcloud/2.3.2/templates/postgres-secret.yaml b/test/nextcloud/2.3.2/templates/postgres-secret.yaml index c6b3743dcac..6b08b701a98 100644 --- a/test/nextcloud/2.3.2/templates/postgres-secret.yaml +++ b/test/nextcloud/2.3.2/templates/postgres-secret.yaml @@ -3,11 +3,11 @@ kind: Secret metadata: name: db-details data: + db-user: postgres {{- if .Release.IsInstall }} db-password: {{ randAlphaNum 15 | b64enc | quote }} {{ else }} # `index` function is necessary because the property name contains a dash. # Otherwise (...).data.db_password would have worked too. db-password: {{ index (lookup "v1" "Secret" .Release.Namespace "db-details").data "db-password" }} - db-user: postgres {{ end }} diff --git a/test/nextcloud/2.3.2/templates/secrets.yaml b/test/nextcloud/2.3.2/templates/secrets.yaml index 8473eba0526..687560016db 100644 --- a/test/nextcloud/2.3.2/templates/secrets.yaml +++ b/test/nextcloud/2.3.2/templates/secrets.yaml @@ -15,7 +15,3 @@ data: {{ else }} nextcloud-password: {{ randAlphaNum 10 | b64enc | quote }} {{ end }} - {{- if .Values.nextcloud.mail.enabled }} - smtp-username: {{ default "" .Values.nextcloud.mail.smtp.name | b64enc | quote }} - smtp-password: {{ default "" .Values.nextcloud.mail.smtp.password | b64enc | quote }} - {{- end }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index 73a3d448814..ae5e26006d9 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -122,7 +122,6 @@ externalDatabase: # passwordKey: password postgresql: - host: ## Cronjob to execute Nextcloud background tasks ## ref: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#webcron From 7a148e5a3ffbf01047c99abda69730247cebb682 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 23:03:57 +0500 Subject: [PATCH 16/29] Properly configure postgres host path --- test/nextcloud/2.3.2/questions.yaml | 3 ++- test/nextcloud/2.3.2/templates/_helpers.tpl | 24 ++++++++++++++----- .../nextcloud/2.3.2/templates/deployment.yaml | 1 - .../2.3.2/templates/postgres-deployment.yaml | 4 ++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index ff3cc82e765..6e5e14bfd34 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -138,7 +138,8 @@ questions: label: "Dataset Name" schema: type: string - required: true + default: "nextcloud_data" + editable: false - variable: configureHostPath label: "Configure Host Path for storage" diff --git a/test/nextcloud/2.3.2/templates/_helpers.tpl b/test/nextcloud/2.3.2/templates/_helpers.tpl index 004ec38d447..1719889fd6d 100644 --- a/test/nextcloud/2.3.2/templates/_helpers.tpl +++ b/test/nextcloud/2.3.2/templates/_helpers.tpl @@ -48,13 +48,25 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Retrieve host path from ix volumes based on dataset name +*/}} +{{- define "retrieveHostPathFromiXVolume" -}} +{{- range $index, $hostPathConfiguration := $.ixVolumes }} +{{- $dsName := base $hostPathConfiguration.hostPath -}} +{{- if eq $.datasetName $dsName -}} +{{- $hostPathConfiguration.hostPath -}} +{{- end -}} +{{- end }} +{{- end -}} + {{/* Retrieve host path defined in volume */}} {{- define "configuredHostPath" -}} {{- if .Values.configureiXVolume -}} -{{- $volDict := first .Values.ixVolumes -}} -{{- $volDict.hostPath -}} +{{- $volDict := dict "datasetName" $.Values.volume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- include "retrieveHostPathFromiXVolume" $volDict -}} {{- else if .Values.configureHostPath -}} {{- .Values.volumeHostPath -}} {{- else -}} @@ -66,16 +78,16 @@ Retrieve host path defined in volume Retrieve backup postgresql host path defined in volume */}} {{- define "configuredBackupPostgresHostPath" -}} -{{- $backupVolDict := first .Values.postgresql.backupVolume -}} -{{- $backupVolDict.hostPath -}} +{{- $volDict := dict "datasetName" $.Values.postgresql.backupVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- include "retrieveHostPathFromiXVolume" $volDict -}} {{- end -}} {{/* Retrieve postgresql data host path defined in volume */}} {{- define "configuredPostgresHostPath" -}} -{{- $dataVolDict := first .Values.postgresql.dataVolume -}} -{{- $dataVolDict.hostPath -}} +{{- $volDict := dict "datasetName" $.Values.postgresql.dataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- include "retrieveHostPathFromiXVolume" $volDict -}} {{- end -}} {{/* diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index 4af94c6ce0e..97dfba7d9e6 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -57,7 +57,6 @@ spec: secretKeyRef: name: db-details key: db-password - {{- end }} - name: NEXTCLOUD_ADMIN_USER valueFrom: secretKeyRef: diff --git a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml index fb63d918f06..2214fc340b5 100644 --- a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml +++ b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml @@ -50,7 +50,7 @@ spec: volumes: - name: postgres-data hostPath: - path: "/mnt/evo/ix-applications/releases/nextcloud/volumes/ix_volumes/ix-postgres_data" + path: {{ template "configuredPostgresHostPath" . }} - name: postgres-backup hostPath: - path: "/mnt/evo/ix-applications/releases/nextcloud/volumes/ix_volumes/ix-postgres_backups" + path: {{ template "configuredBackupPostgresHostPath" . }} From 8b7530d3bda53afb49ae39609c1a3b91fbdce6ae Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 23:12:06 +0500 Subject: [PATCH 17/29] Add init container to nextcloud pod to make sure it's not started until postgres is up --- test/nextcloud/2.3.2/templates/deployment.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index 97dfba7d9e6..dd48c8cf0c4 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -38,6 +38,10 @@ spec: - name: {{ . }} {{- end}} {{- end }} + initContainers: + - name: init-postgresdb + image: busybox:latest + command: ['sh', '-c', "until nslookup {{ template "nextcloud.fullname" . }}-postgres; do echo waiting for postgres; sleep 2; done"] containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" From 74e79292073aa55c3a9effa077c544dd5abbb564 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sat, 5 Dec 2020 23:19:21 +0500 Subject: [PATCH 18/29] Clean internal/external db references --- test/nextcloud/2.3.2/questions.yaml | 22 ----- test/nextcloud/2.3.2/templates/cronjob.yaml | 75 ----------------- test/nextcloud/2.3.2/templates/db-secret.yaml | 17 ---- test/nextcloud/2.3.2/values.yaml | 81 ++----------------- 4 files changed, 6 insertions(+), 189 deletions(-) delete mode 100644 test/nextcloud/2.3.2/templates/cronjob.yaml delete mode 100644 test/nextcloud/2.3.2/templates/db-secret.yaml diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 6e5e14bfd34..f4440d787f4 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -158,26 +158,11 @@ questions: schema: type: hostpath - - variable: internalDatabase - label: "REMOVEME" - schema: - type: dict - additional_attrs: true - attrs: [] - - - variable: externalDatabase - label: "REMOVEME" - schema: - type: dict - additional_attrs: true - attrs: [] - - variable: postgresql label: "Configure Postgresql" group: "Postgresql Configuration" schema: type: dict - additional_attrs: true attrs: - variable: backupVolume label: "Backup Volume" @@ -217,10 +202,3 @@ questions: type: string default: "ix-postgres_data" editable: false - - - variable: cronjob - label: "REMOVEME" - schema: - type: dict - additional_attrs: true - attrs: [] diff --git a/test/nextcloud/2.3.2/templates/cronjob.yaml b/test/nextcloud/2.3.2/templates/cronjob.yaml deleted file mode 100644 index 3a2eded29eb..00000000000 --- a/test/nextcloud/2.3.2/templates/cronjob.yaml +++ /dev/null @@ -1,75 +0,0 @@ -{{- if .Values.cronjob.enabled }} -apiVersion: batch/v1beta1 -kind: CronJob -metadata: - name: {{ template "nextcloud.fullname" . }}-cron - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - annotations: -{{ toYaml .Values.cronjob.annotations | indent 4 }} -spec: - schedule: "{{ .Values.cronjob.schedule }}" - concurrencyPolicy: Forbid - {{- with .Values.cronjob.failedJobsHistoryLimit }} - failedJobsHistoryLimit: {{ . }} - {{- end }} - {{- with .Values.cronjob.successfulJobsHistoryLimit }} - successfulJobsHistoryLimit: {{ . }} - {{- end }} - jobTemplate: - metadata: - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - spec: - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - spec: - restartPolicy: Never - {{- if (default .Values.image.pullSecrets .Values.cronjob.image.pullSecrets) }} - imagePullSecrets: - {{- range (default .Values.image.pullSecrets .Values.cronjob.image.pullSecrets) }} - - name: {{ . }} - {{- end }} - {{- end }} - containers: - - name: {{ .Chart.Name }} - image: "{{ default .Values.image.repository .Values.cronjob.image.repository }}:{{ default .Values.image.tag .Values.cronjob.image.tag }}" - imagePullPolicy: {{ default .Values.image.pullPolicy .Values.cronjob.image.pullPolicy }} - command: [ "curl" ] - args: - {{- if .Values.ingress.enabled }} - {{- if .Values.cronjob.curlInsecure }} - - "-k" - {{- end }} - - "--fail" - - "-L" - {{- if .Values.ingress.tls }} - - "https://{{ .Values.nextcloud.host }}/cron.php" - {{- else }} - - "http://{{ .Values.nextcloud.host }}/cron.php" - {{- end }} - {{- else }} - - "http://{{ template "nextcloud.fullname" . }}:{{ .Values.service.port }}/cron.php" - {{- end }} - resources: -{{ toYaml (default .Values.resources .Values.cronjob.resources) | indent 16 }} - {{- with (default .Values.nodeSelector .Values.cronjob.nodeSelector) }} - nodeSelector: -{{ toYaml . | indent 12 }} - {{- end }} - {{- with (default .Values.affinity .Values.cronjob.affinity) }} - affinity: -{{ toYaml . | indent 12 }} - {{- end }} - {{- with (default .Values.tolerations .Values.cronjob.tolerations) }} - tolerations: -{{ toYaml . | indent 12 }}: - {{- end }} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/db-secret.yaml b/test/nextcloud/2.3.2/templates/db-secret.yaml deleted file mode 100644 index 22149b92b07..00000000000 --- a/test/nextcloud/2.3.2/templates/db-secret.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if .Values.externalDatabase.enabled }} -{{- if not .Values.externalDatabase.existingSecret.enabled }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ printf "%s-%s" .Release.Name "db" }} - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -type: Opaque -data: - db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} - db-username: {{ default "" .Values.externalDatabase.user | b64enc | quote }} -{{- end }} -{{- end }} \ No newline at end of file diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index ae5e26006d9..3cfaf93ae11 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -89,82 +89,13 @@ nextcloud: # - name: nfs # mountPath: "/legacy_data" -internalDatabase: - enabled: false - name: nextcloud - -## -## External database configuration -## -externalDatabase: - enabled: true - - ## Supported database engines: mysql or postgresql - type: postgresql - - ## Database host - host: - - ## Database user - user: nextcloud - - ## Database password - password: - - ## Database name - database: nextcloud - - ## Use a existing secret - existingSecret: - enabled: false - # secretName: nameofsecret - # usernameKey: username - # passwordKey: password - postgresql: - -## Cronjob to execute Nextcloud background tasks -## ref: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#webcron -## -cronjob: - enabled: false - # Nexcloud image is used as default but only curl is needed - image: {} - # repository: nextcloud - # tag: 16.0.3-apache - # pullPolicy: IfNotPresent - # pullSecrets: - # - myRegistrKeySecretName - # Every 5 minutes - # Note: Setting this to any any other value than 5 minutes might - # cause issues with how nextcloud background jobs are executed - schedule: "*/5 * * * *" - annotations: {} - # Set curl's insecure option if you use e.g. self-signed certificates - curlInsecure: false - failedJobsHistoryLimit: 5 - successfulJobsHistoryLimit: 2 - # If not set, nextcloud deployment one will be set - # 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 - - # If not set, nextcloud deployment one will be set - # nodeSelector: {} - - # If not set, nextcloud deployment one will be set - # tolerations: [] - - # If not set, nextcloud deployment one will be set - # affinity: {} + backupVolume: + mountPath: "/postgres_backups" + datasetName: "ix-postgres_backups" + dataVolume: + mountPath: "/var/lib/postgresql/data" + datasetName: "ix-postgres_data" service: nodePort: 9000 \ No newline at end of file From f85006a283ac6d5573f0f9e822b81d386c8ca071 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sun, 6 Dec 2020 23:52:28 +0500 Subject: [PATCH 19/29] Clean values --- test/nextcloud/2.3.2/values.yaml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index 3cfaf93ae11..23b90c4b829 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -10,7 +10,6 @@ nextcloud: host: nextcloud.kube.home username: admin password: changeme - update: 0 datadir: /var/www/html/data persistence: subPath: @@ -63,31 +62,6 @@ nextcloud: ## 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: "Recreate" - # type: RollingUpdate - # rollingUpdate: - # maxSurge: 1 - # maxUnavailable: 0 - - ## - ## Extra environment variables - extraEnv: - # - name: SOME_SECRET_ENV - # valueFrom: - # secretKeyRef: - # name: nextcloud - # key: secret_key - - # Extra mounts for the pods. Example shown is for connecting a legacy NFS volume - # to NextCloud pods in Kubernetes. This can then be configured in External Storage - extraVolumes: - # - name: nfs - # nfs: - # server: "10.0.0.1" - # path: "/nextcloud_data" - # readOnly: false - extraVolumeMounts: - # - name: nfs - # mountPath: "/legacy_data" postgresql: backupVolume: From af0148456d0a3fb948573bcefcb1ffda8ac720f8 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 7 Dec 2020 22:05:06 +0500 Subject: [PATCH 20/29] Clean nextcloud chart stripping to basics --- test/nextcloud/2.3.2/README.md | 223 +----------------- test/nextcloud/2.3.2/templates/config.yaml | 127 ---------- .../nextcloud/2.3.2/templates/deployment.yaml | 43 +--- .../nextcloud/2.3.2/templates/php-config.yaml | 16 -- test/nextcloud/2.3.2/values.yaml | 52 +--- 5 files changed, 9 insertions(+), 452 deletions(-) delete mode 100644 test/nextcloud/2.3.2/templates/config.yaml delete mode 100644 test/nextcloud/2.3.2/templates/php-config.yaml diff --git a/test/nextcloud/2.3.2/README.md b/test/nextcloud/2.3.2/README.md index 77ec115d17a..b2b5bc91ba8 100644 --- a/test/nextcloud/2.3.2/README.md +++ b/test/nextcloud/2.3.2/README.md @@ -10,225 +10,4 @@ It also packages the [Bitnami MariaDB chart](https://github.com/kubernetes/chart ## Configuration -The following table lists the configurable parameters of the nextcloud chart and their default values. - -| Parameter | Description | Default | -| ------------------------------------------------------------ | ------------------------------------------------------- | ------------------------------------------- | -| `image.repository` | nextcloud Image name | `nextcloud` | -| `image.tag` | nextcloud Image tag | `{VERSION}` | -| `image.pullPolicy` | Image pull policy | `IfNotPresent` | -| `image.pullSecrets` | Specify image pull secrets | `nil` | -| `ingress.enabled` | Enable use of ingress controllers | `false` | -| `ingress.servicePort` | Ingress' backend servicePort | `http` | -| `ingress.annotations` | An array of service annotations | `nil` | -| `ingress.labels` | An array of service labels | `nil` | -| `ingress.tls` | Ingress TLS configuration | `[]` | -| `nextcloud.host` | nextcloud host to create application URLs | `nextcloud.kube.home` | -| `nextcloud.username` | User of the application | `admin` | -| `nextcloud.password` | Application password | `changeme` | -| `nextcloud.update` | Trigger update if custom command is used | `0` | -| `nextcloud.datadir` | nextcloud data dir location | `/var/www/html/data` | -| `nextcloud.tableprefix` | nextcloud db table prefix | `''` | -| `nextcloud.mail.enabled` | Whether to enable/disable email settings | `false` | -| `nextcloud.mail.fromAddress` | nextcloud mail send from field | `nil` | -| `nextcloud.mail.domain` | nextcloud mail domain | `nil` | -| `nextcloud.mail.smtp.host` | SMTP hostname | `nil` | -| `nextcloud.mail.smtp.secure` | SMTP connection `ssl` or empty | `''` | -| `nextcloud.mail.smtp.port` | Optional SMTP port | `nil` | -| `nextcloud.mail.smtp.authtype` | SMTP authentication method | `LOGIN` | -| `nextcloud.mail.smtp.name` | SMTP username | `''` | -| `nextcloud.mail.smtp.password` | SMTP password | `''` | -| `nextcloud.configs` | Config files created in `/var/www/html/config` | `{}` | -| `nextcloud.persistence.subPath` | Set the subPath for nextcloud to use in volume | `nil` | -| `nextcloud.phpConfigs` | PHP Config files created in `/usr/local/etc/php/conf.d` | `{}` | -| `nextcloud.defaultConfigs.\.htaccess` | Default .htaccess to protect `/var/www/html/config` | `true` | -| `nextcloud.defaultConfigs.\.redis\.config\.php` | Default Redis configuration | `true` | -| `nextcloud.defaultConfigs.\.apache-pretty-urls\.config\.php` | Default Apache configuration for rewrite urls | `true` | -| `nextcloud.defaultConfigs.\.apcu\.config\.php` | Default configuration to define APCu as local cache | `true` | -| `nextcloud.defaultConfigs.\.apps\.config\.php` | Default configuration for apps | `true` | -| `nextcloud.defaultConfigs.\.autoconfig\.php` | Default auto-configuration for databases | `true` | -| `nextcloud.defaultConfigs.\.smtp\.config\.php` | Default configuration for smtp | `true` | -| `nextcloud.strategy` | specifies the strategy used to replace old Pods by new ones | `type: Recreate` | -| `nextcloud.extraEnv` | specify additional environment variables | `{}` | -| `nextcloud.extraVolumes` | specify additional volumes for the NextCloud pod | `{}` | -| `nextcloud.extraVolumeMounts` | specify additional volume mounts for the NextCloud pod | `{}` | -| `nginx.enabled` | Enable nginx (requires you use php-fpm image) | `false` | -| `nginx.image.repository` | nginx Image name | `nginx` | -| `nginx.image.tag` | nginx Image tag | `alpine` | -| `nginx.image.pullPolicy` | nginx Image pull policy | `IfNotPresent` | -| `nginx.config.default` | Whether to use nextclouds recommended nginx config | `true` | -| `nginx.config.custom` | Specify a custom config for nginx | `{}` | -| `nginx.resources` | nginx resources | `{}` | -| `lifecycle.postStartCommand` | Specify deployment lifecycle hook postStartCommand | `nil` | -| `lifecycle.preStopCommand` | Specify deployment lifecycle hook preStopCommand | `nil` | -| `internalDatabase.enabled` | Whether to use internal sqlite database | `true` | -| `internalDatabase.database` | Name of the existing database | `nextcloud` | -| `externalDatabase.enabled` | Whether to use external database | `false` | -| `externalDatabase.type` | External database type: `mysql`, `postgresql` | `mysql` | -| `externalDatabase.host` | Host of the external database | `nil` | -| `externalDatabase.database` | Name of the existing database | `nextcloud` | -| `externalDatabase.user` | Existing username in the external db | `nextcloud` | -| `externalDatabase.password` | Password for the above username | `nil` | -| `externalDatabase.existingSecret.enabled` | Whether to use a existing secret or not | `false` | -| `externalDatabase.existingSecret.secretName` | Name of the existing secret | `nil` | -| `externalDatabase.existingSecret.usernameKey` | Name of the key that contains the username | `nil` | -| `externalDatabase.existingSecret.passwordKey` | Name of the key that contains the password | `nil` | -| `mariadb.enabled` | Whether to use the MariaDB chart | `false` | -| `mariadb.db.name` | Database name to create | `nextcloud` | -| `mariadb.db.password` | Password for the database | `changeme` | -| `mariadb.db.user` | Database user to create | `nextcloud` | -| `mariadb.rootUser.password` | MariaDB admin password | `nil` | -| `redis.enabled` | Whether to install/use redis for locking | `false` | -| `cronjob.enabled` | Whether to enable/disable cronjob | `false` | -| `cronjob.schedule` | Schedule for the CronJob | `*/15 * * * *` | -| `cronjob.annotations` | Annotations to add to the cronjob | {} | -| `cronjob.curlInsecure` | Set insecure (-k) option to curl | false | -| `cronjob.failedJobsHistoryLimit` | Specify the number of failed Jobs to keep | `5` | -| `cronjob.successfulJobsHistoryLimit` | Specify the number of completed Jobs to keep | `2` | -| `cronjob.resources` | Cronjob Resources | `nil` | -| `cronjob.nodeSelector` | Cronjob Node selector | `nil` | -| `cronjob.tolerations` | Cronjob tolerations | `nil` | -| `cronjob.affinity` | Cronjob affinity | `nil` | -| `service.type` | Kubernetes Service type | `ClusterIp` | -| `service.loadBalancerIP` | LoadBalancerIp for service type LoadBalancer | `nil` | -| `service.nodePort` | NodePort for service type NodePort | `nil` | -| `persistence.enabled` | Enable persistence using PVC | `false` | -| `persistence.annotations` | PVC annotations | `{}` | -| `persistence.storageClass` | PVC Storage Class for nextcloud volume | `nil` (uses alpha storage class annotation) | -| `persistence.existingClaim` | An Existing PVC name for nextcloud volume | `nil` (uses alpha storage class annotation) | -| `persistence.accessMode` | PVC Access Mode for nextcloud volume | `ReadWriteOnce` | -| `persistence.size` | PVC Storage Request for nextcloud volume | `8Gi` | -| `resources` | CPU/Memory resource requests/limits | `{}` | -| `livenessProbe.enabled` | Turn on and off liveness probe | `true` | -| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | -| `livenessProbe.periodSeconds` | How often to perform the probe | `15` | -| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | -| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | `3` | -| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | -| `readinessProbe.enabled` | Turn on and off readiness probe | `true` | -| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | -| `readinessProbe.periodSeconds` | How often to perform the probe | `15` | -| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | -| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | `3` | -| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | -| `hpa.enabled` | Boolean to create a HorizontalPodAutoscaler | `false` | -| `hpa.cputhreshold` | CPU threshold percent for the HorizontalPodAutoscale | `60` | -| `hpa.minPods` | Min. pods for the Nextcloud HorizontalPodAutoscaler | `1` | -| `hpa.maxPods` | Max. pods for the Nextcloud HorizontalPodAutoscaler | `10` | -| `deploymentAnnotations` | Annotations to be added at 'deployment' level | not set | -| `podAnnotations` | Annotations to be added at 'pod' level | not set | -| `metrics.enabled` | Start Prometheus metrics exporter | `false` | -| `metrics.https` | Defines if https is used to connect to nextcloud | `false` (uses http) | -| `metrics.timeout` | When the scrape times out | `5s` | -| `metrics.image.repository` | Nextcloud metrics exporter image name | `xperimental/nextcloud-exporter` | -| `metrics.image.tag` | Nextcloud metrics exporter image tag | `v0.3.0` | -| `metrics.image.pullPolicy` | Nextcloud metrics exporter image pull policy | `IfNotPresent` | -| `metrics.podAnnotations` | Additional annotations for metrics exporter | not set | -| `metrics.podLabels` | Additional labels for metrics exporter | not set | -| `metrics.service.type` | Metrics: Kubernetes Service type | `ClusterIP` | -| `metrics.service.loadBalancerIP` | Metrics: LoadBalancerIp for service type LoadBalancer | `nil` | -| `metrics.service.nodePort` | Metrics: NodePort for service type NodePort | `nil` | -| `metrics.service.annotations` | Additional annotations for service metrics exporter | `{prometheus.io/scrape: "true", prometheus.io/port: "9205"}` | -| `metrics.service.labels` | Additional labels for service metrics exporter | `{}` | - -> **Note**: -> -> For nextcloud to function correctly, you should specify the `nextcloud.host` parameter to specify the FQDN (recommended) or the public IP address of the nextcloud service. -> -> Optionally, you can specify the `service.loadBalancerIP` parameter to assign a reserved IP address to the nextcloud service of the chart. However please note that this feature is only available on a few cloud providers (f.e. GKE). -> -> To reserve a public IP address on GKE: -> -> ```bash -> gcloud compute addresses create nextcloud-public-ip -> ``` -> -> The reserved IP address can be associated to the nextcloud service by specifying it as the value of the `service.loadBalancerIP` parameter while installing the chart. - -Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, - -```console -helm install --name my-release \ - --set nextcloud.username=admin,nextcloud.password=password,mariadb.rootUser.password=secretpassword \ - nextcloud/nextcloud -``` - -The above command sets the nextcloud administrator account username and password to `admin` and `password` respectively. Additionally, it sets the MariaDB `root` user password to `secretpassword`. - -Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, - -```console -helm install --name my-release -f values.yaml nextcloud/nextcloud -``` - -> **Tip**: You can use the default [values.yaml](values.yaml) - -## Persistence - -The [Nextcloud](https://hub.docker.com/_/nextcloud/) image stores the nextcloud data and configurations at the `/var/www/html` paths of the container. - -Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube. -See the [Configuration](#configuration) section to enable persistence and configuration of the PVC. - -## Cronjob - -This chart can utilize Kubernetes `CronJob` resource to execute [background tasks](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html). - -To use this functionality, set `cronjob.enabled` parameter to `true` and switch background mode to Webcron in your nextcloud settings page. -See the [Configuration](#configuration) section for further configuration of the cronjob resource. - -> **Note**: For the cronjobs to work correctly, ingress must be also enabled (set `ingress.enabled` to `true`) and `nextcloud.host` has to be publicly resolvable. - -## Multiple config.php file - -Nextcloud supports loading configuration parameters from multiple files. -You can add arbitrary files ending with `.config.php` in the `config/` directory. -See [documentation](https://docs.nextcloud.com/server/15/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file). - -For example, following config will configure Nextcloud with [S3 as primary storage](https://docs.nextcloud.com/server/13/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3) by creating file `/var/www/html/config/s3.config.php`: - -```yaml -nextcloud: - configs: - s3.config.php: |- - array( - 'class' => '\\OC\\Files\\ObjectStore\\S3', - 'arguments' => array( - 'bucket' => 'my-bucket', - 'autocreate' => true, - 'key' => 'xxx', - 'secret' => 'xxx', - 'region' => 'us-east-1', - 'use_ssl' => true - ) - ) - ); -``` - -## Hugepages - -If your node has hugepages enabled, but you do not map any into the container, it could fail to start with a bus error in Apache. This is due -to Apache attempting to memory map a file and use hugepages. The fix is to either disable huge pages on the node or map hugepages into the container: - -```yaml -nextcloud: - extraVolumes: - - name: hugepages - emptyDir: - medium: HugePages-2Mi - extraVolumeMounts: - - name: hugepages - mountPath: /dev/hugepages - resources: - requests: - hugepages-2Mi: 500Mi - # note that Kubernetes currently requires cpu or memory requests and limits before hugepages are allowed. - memory: 500Mi - limits: - # limit and request must be the same for hugepages. They are a fixed resource. - hugepages-2Mi: 500Mi - # note that Kubernetes currently requires cpu or memory requests and limits before hugepages are allowed. - memory: 1Gi -``` +Please refer to questions.yaml for a detailed overview on supported configurable values. diff --git a/test/nextcloud/2.3.2/templates/config.yaml b/test/nextcloud/2.3.2/templates/config.yaml deleted file mode 100644 index 7fb2ade68a5..00000000000 --- a/test/nextcloud/2.3.2/templates/config.yaml +++ /dev/null @@ -1,127 +0,0 @@ -{{- if .Values.nextcloud.configs -}} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "nextcloud.fullname" . }}-config - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -data: -{{- range $key, $value := .Values.nextcloud.configs }} - {{ $key }}: |- -{{ $value | indent 4 }} -{{- end }} -{{- if .Values.nextcloud.defaultConfigs }} -{{- if index .Values.nextcloud.defaultConfigs ".htaccess" }} - .htaccess: |- - # line below if for Apache 2.4 - - Require all denied - - # line below if for Apache 2.2 - - deny from all - - # section for Apache 2.2 and 2.4 - - IndexIgnore * - -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "redis.config.php" }} - redis.config.php: |- - '\OC\Memcache\Redis', - 'memcache.locking' => '\OC\Memcache\Redis', - 'redis' => array( - 'host' => getenv('REDIS_HOST'), - 'port' => getenv('REDIS_HOST_PORT') ?: 6379, - ), - ); - } -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "apache-pretty-urls.config.php" }} - apache-pretty-urls.config.php: |- - '/', - ); -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "apcu.config.php" }} - apcu.config.php: |- - '\OC\Memcache\APCu', - ); -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "apps.config.php" }} - apps.config.php: |- - array ( - 0 => array ( - "path" => OC::$SERVERROOT."/apps", - "url" => "/apps", - "writable" => false, - ), - 1 => array ( - "path" => OC::$SERVERROOT."/custom_apps", - "url" => "/custom_apps", - "writable" => true, - ), - ), - ); -{{- end }} -{{- if index .Values.nextcloud.defaultConfigs "autoconfig.php" }} - autoconfig.php: |- - 'smtp', - 'mail_smtphost' => getenv('SMTP_HOST'), - 'mail_smtpport' => getenv('SMTP_PORT') ?: (getenv('SMTP_SECURE') ? 465 : 25), - 'mail_smtpsecure' => getenv('SMTP_SECURE') ?: '', - 'mail_smtpauth' => getenv('SMTP_NAME') && getenv('SMTP_PASSWORD'), - 'mail_smtpauthtype' => getenv('SMTP_AUTHTYPE') ?: 'LOGIN', - 'mail_smtpname' => getenv('SMTP_NAME') ?: '', - 'mail_smtppassword' => getenv('SMTP_PASSWORD') ?: '', - 'mail_from_address' => getenv('MAIL_FROM_ADDRESS'), - 'mail_domain' => getenv('MAIL_DOMAIN'), - ); - } -{{- end }} -{{- end }} -{{- end }} diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index dd48c8cf0c4..ecbc4a0a34f 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -82,44 +82,25 @@ spec: volumeMounts: - name: nextcloud-data mountPath: /var/www/ - subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }} + subPath: "root" - name: nextcloud-data mountPath: /var/www/html - subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }} + subPath: "html" - name: nextcloud-data mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/%s" .Values.nextcloud.persistence.subPath "data") (empty .Values.nextcloud.persistence.subPath) }} + subPath: "data" - name: nextcloud-data mountPath: /var/www/html/config - subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }} + subPath: "config" - name: nextcloud-data mountPath: /var/www/html/custom_apps - subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }} + subPath: "custom_apps" - name: nextcloud-data mountPath: /var/www/tmp - subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }} + subPath: "tmp" - name: nextcloud-data mountPath: /var/www/html/themes - subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }} - {{- range $key, $value := .Values.nextcloud.configs }} - - name: nextcloud-config - mountPath: /var/www/html/config/{{ $key }} - subPath: {{ $key }} - {{- end }} - {{- if .Values.nextcloud.configs }} - {{- range $key, $value := .Values.nextcloud.defaultConfigs }} - {{- if $value }} - - name: nextcloud-config - mountPath: /var/www/html/config/{{ $key }} - subPath: {{ $key }} - {{- end }} - {{- end }} - {{- end }} - {{- range $key, $value := .Values.nextcloud.phpConfigs }} - - name: nextcloud-phpconfig - mountPath: /usr/local/etc/php/conf.d/{{ $key }} - subPath: {{ $key }} - {{- end }} + subPath: "themes" volumes: - name: nextcloud-data {{- if ne (include "configuredHostPath" .) "" }} @@ -128,16 +109,6 @@ spec: {{- else }} emptyDir: {} {{- end }} - {{- if .Values.nextcloud.configs }} - - name: nextcloud-config - configMap: - name: {{ template "nextcloud.fullname" . }}-config - {{- end }} - {{- if .Values.nextcloud.phpConfigs }} - - name: nextcloud-phpconfig - configMap: - name: {{ template "nextcloud.fullname" . }}-phpconfig - {{- end }} # Will mount configuration files as www-data (id: 33) for nextcloud securityContext: fsGroup: 33 diff --git a/test/nextcloud/2.3.2/templates/php-config.yaml b/test/nextcloud/2.3.2/templates/php-config.yaml deleted file mode 100644 index 3ff9e95a9ac..00000000000 --- a/test/nextcloud/2.3.2/templates/php-config.yaml +++ /dev/null @@ -1,16 +0,0 @@ -{{- if .Values.nextcloud.phpConfigs -}} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "nextcloud.fullname" . }}-phpconfig - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} -data: -{{- range $key, $value := .Values.nextcloud.phpConfigs }} - {{ $key }}: |- -{{ $value | indent 4 }} -{{- end }} -{{- end }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index 23b90c4b829..8a8958bc512 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -11,56 +11,6 @@ nextcloud: username: admin password: changeme datadir: /var/www/html/data - persistence: - subPath: - # PHP Configuration files - # Will be injected in /usr/local/etc/php/conf.d - phpConfigs: {} - # Default config files - # IMPORTANT: Will be used only if you put extra configs, otherwise default will come from nextcloud itself - # Default confgurations can be found here: https://github.com/nextcloud/docker/tree/master/16.0/apache/config - defaultConfigs: - # To protect /var/www/html/config - .htaccess: true - # Redis default configuration - redis.config.php: true - # Apache configuration for rewrite urls - apache-pretty-urls.config.php: true - # Define APCu as local cache - apcu.config.php: true - # Apps directory configs - apps.config.php: true - # Used for auto configure database - autoconfig.php: true - # SMTP default configuration - smtp.config.php: true - # Extra config files created in /var/www/html/config/ - # ref: https://docs.nextcloud.com/server/15/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-config-php-file - configs: {} - - # For example, to use S3 as primary storage - # ref: https://docs.nextcloud.com/server/13/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3 - # - # configs: - # s3.config.php: |- - # array( - # 'class' => '\\OC\\Files\\ObjectStore\\S3', - # 'arguments' => array( - # 'bucket' => 'my-bucket', - # 'autocreate' => true, - # 'key' => 'xxx', - # 'secret' => 'xxx', - # 'region' => 'us-east-1', - # 'use_ssl' => true - # ) - # ) - # ); - - ## 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: "Recreate" postgresql: @@ -72,4 +22,4 @@ postgresql: datasetName: "ix-postgres_data" service: - nodePort: 9000 \ No newline at end of file + nodePort: 9000 From 126ba367c89cc04a9ee230efdd2762666d4dff67 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 7 Dec 2020 22:51:19 +0500 Subject: [PATCH 21/29] Add test values yaml file --- test/nextcloud/2.3.2/test_values.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/nextcloud/2.3.2/test_values.yaml diff --git a/test/nextcloud/2.3.2/test_values.yaml b/test/nextcloud/2.3.2/test_values.yaml new file mode 100644 index 00000000000..8a8958bc512 --- /dev/null +++ b/test/nextcloud/2.3.2/test_values.yaml @@ -0,0 +1,25 @@ +## Official nextcloud image version +## ref: https://hub.docker.com/r/library/nextcloud/tags/ +## +image: + repository: nextcloud + tag: 19.0.3-apache + pullPolicy: IfNotPresent + +nextcloud: + host: nextcloud.kube.home + username: admin + password: changeme + datadir: /var/www/html/data + strategy: "Recreate" + +postgresql: + backupVolume: + mountPath: "/postgres_backups" + datasetName: "ix-postgres_backups" + dataVolume: + mountPath: "/var/lib/postgresql/data" + datasetName: "ix-postgres_data" + +service: + nodePort: 9000 From 5f1283b4c4205fbc00dce0f9409fc64aac73f2f8 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 7 Dec 2020 23:24:05 +0500 Subject: [PATCH 22/29] Fix deployment test --- test/nextcloud/2.3.2/templates/postgres-deployment.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml index 2214fc340b5..da39a2cd76d 100644 --- a/test/nextcloud/2.3.2/templates/postgres-deployment.yaml +++ b/test/nextcloud/2.3.2/templates/postgres-deployment.yaml @@ -49,8 +49,16 @@ spec: protocol: TCP volumes: - name: postgres-data + {{- if ne (include "configuredPostgresHostPath" .) "" }} hostPath: path: {{ template "configuredPostgresHostPath" . }} + {{- else }} + emptyDir: {} + {{- end }} - name: postgres-backup + {{- if ne (include "configuredBackupPostgresHostPath" .) "" }} hostPath: path: {{ template "configuredBackupPostgresHostPath" . }} + {{- else }} + emptyDir: {} + {{- end }} From 3750f4bdbd72463afcdaac25de0200c14d34fd5e Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 7 Dec 2020 23:26:50 +0500 Subject: [PATCH 23/29] Fix nodeport for ci test --- test/nextcloud/2.3.2/test_values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nextcloud/2.3.2/test_values.yaml b/test/nextcloud/2.3.2/test_values.yaml index 8a8958bc512..f58524c7a73 100644 --- a/test/nextcloud/2.3.2/test_values.yaml +++ b/test/nextcloud/2.3.2/test_values.yaml @@ -22,4 +22,4 @@ postgresql: datasetName: "ix-postgres_data" service: - nodePort: 9000 + nodePort: 31000 From 254ff0ab4d3dbd4df5c7cacbdfad29d2dec89f9b Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 8 Dec 2020 02:11:04 +0500 Subject: [PATCH 24/29] Correctly populate storage fields --- test/nextcloud/2.3.2/questions.yaml | 144 +++++++++----------- test/nextcloud/2.3.2/templates/_helpers.tpl | 18 +-- test/nextcloud/2.3.2/values.yaml | 8 -- 3 files changed, 72 insertions(+), 98 deletions(-) diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index f4440d787f4..59262e9d010 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -3,7 +3,7 @@ groups: description: "Image to be used for container" - name: "Nextcloud Configuration" description: "Configuration details for Nextcloud workload" - - name: "Storage Configuration" + - name: "Storage" description: "Configure Storage for Nextcloud" - name: "Container Configuration" description: "Configure nextcloud container parameters" @@ -109,96 +109,78 @@ questions: default: 9000 required: true - - variable: configureiXVolume - label: "Configure iX Volume" - group: "Storage Configuration" - description: "Use iX Volume for persistent storage" - schema: - type: boolean - default: true - required: true - show_subquestions_if: true - subquestions: - - variable: volume - label: "Configure iXVolume" - group: "Storage Configuration" - schema: - type: dict - $ref: - - "normalize/ixVolume" - attrs: - - variable: mountPath - label: "Mount Path" - description: "Path where the volume will be mounted inside the pod" - schema: - type: path - editable: false - default: "/var/www" - - variable: datasetName - label: "Dataset Name" - schema: - type: string - default: "nextcloud_data" - editable: false - - - variable: configureHostPath - label: "Configure Host Path for storage" - description: "Use a path on host for persistent data storage" - group: "Storage Configuration" + - variable: nextcloudDataHostPathEnabled + label: "Configure Host Path for Nextcloud data" schema: type: boolean default: false - required: true - show_if: [["configureiXVolume", "=", false]] show_subquestions_if: true subquestions: - - variable: volumeHostPath - label: "Host Path" - group: "Storage Configuration" + - variable: nextcloudHostPath + label: "Specify HostPath for Nextcloud data" schema: type: hostpath - - variable: postgresql - label: "Configure Postgresql" - group: "Postgresql Configuration" + - variable: nextcloudDataVolume + label: "Configure iXVolume" schema: type: dict + $ref: + - "normalize/ixVolume" + show_if: [["nextcloudDataHostPathEnabled", "=", false]] attrs: - - variable: backupVolume - label: "Backup Volume" + - variable: mountPath + label: "Mount Path" + description: "Path where the volume will be mounted inside the pod" schema: - type: dict - $ref: - - "normalize/ixVolume" - attrs: - - variable: mountPath - label: "Mount Path" - schema: - type: path - editable: false - default: "/postgres_backups" - - variable: datasetName - label: "Dataset Name" - schema: - type: string - default: "ix-postgres_backups" - editable: false - - variable: dataVolume - label: "Postgresql Data Volume" + type: path + editable: false + default: "/var/www" + - variable: datasetName + label: "Dataset Name" schema: - type: dict - $ref: - - "normalize/ixVolume" - attrs: - - variable: mountPath - label: "Mount Path" - schema: - type: path - editable: false - default: "/var/lib/postgresql/data" - - variable: datasetName - label: "Dataset Name" - schema: - type: string - default: "ix-postgres_data" - editable: false + type: string + default: "ix-nextcloud_data" + editable: false + + - variable: postgresBackupVolume + label: "Postgres Backup Volume" + group: "Storage" + schema: + type: dict + $ref: + - "normalize/ixVolume" + attrs: + - variable: mountPath + label: "Mount Path" + schema: + type: path + editable: false + default: "/postgres_backups" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + default: "ix-postgres_backups" + editable: false + + - variable: postgresDataVolume + label: "Postgresql Data Volume" + group: "Storage" + schema: + type: dict + $ref: + - "normalize/ixVolume" + attrs: + - variable: mountPath + label: "Mount Path" + schema: + type: path + editable: false + default: "/var/lib/postgresql/data" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + default: "ix-postgres_data" + editable: false diff --git a/test/nextcloud/2.3.2/templates/_helpers.tpl b/test/nextcloud/2.3.2/templates/_helpers.tpl index 1719889fd6d..8a6ff9150ce 100644 --- a/test/nextcloud/2.3.2/templates/_helpers.tpl +++ b/test/nextcloud/2.3.2/templates/_helpers.tpl @@ -57,20 +57,20 @@ Retrieve host path from ix volumes based on dataset name {{- if eq $.datasetName $dsName -}} {{- $hostPathConfiguration.hostPath -}} {{- end -}} -{{- end }} +{{- end -}} {{- end -}} {{/* Retrieve host path defined in volume */}} {{- define "configuredHostPath" -}} -{{- if .Values.configureiXVolume -}} -{{- $volDict := dict "datasetName" $.Values.volume.datasetName "ixVolumes" $.Values.ixVolumes -}} -{{- include "retrieveHostPathFromiXVolume" $volDict -}} -{{- else if .Values.configureHostPath -}} -{{- .Values.volumeHostPath -}} -{{- else -}} +{{- if .Values.emptyDirVolumes -}} {{- printf "" -}} +{{- else if .Values.nextcloudDataHostPathEnabled -}} +{{- required "Please specify a host path for nextcloud" .Values.nextcloudHostPath -}} +{{- else -}} +{{- $volDict := dict "datasetName" $.Values.nextcloudDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- include "retrieveHostPathFromiXVolume" $volDict -}} {{- end -}} {{- end -}} @@ -78,7 +78,7 @@ Retrieve host path defined in volume Retrieve backup postgresql host path defined in volume */}} {{- define "configuredBackupPostgresHostPath" -}} -{{- $volDict := dict "datasetName" $.Values.postgresql.backupVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- $volDict := dict "datasetName" $.Values.postgresBackupVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} {{- include "retrieveHostPathFromiXVolume" $volDict -}} {{- end -}} @@ -86,7 +86,7 @@ Retrieve backup postgresql host path defined in volume Retrieve postgresql data host path defined in volume */}} {{- define "configuredPostgresHostPath" -}} -{{- $volDict := dict "datasetName" $.Values.postgresql.dataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- $volDict := dict "datasetName" $.Values.postgresDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} {{- include "retrieveHostPathFromiXVolume" $volDict -}} {{- end -}} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index 8a8958bc512..12ee59bff9b 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -13,13 +13,5 @@ nextcloud: datadir: /var/www/html/data strategy: "Recreate" -postgresql: - backupVolume: - mountPath: "/postgres_backups" - datasetName: "ix-postgres_backups" - dataVolume: - mountPath: "/var/lib/postgresql/data" - datasetName: "ix-postgres_data" - service: nodePort: 9000 From 23892730f30c584fac62ff35082527f7fec2171f Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 8 Dec 2020 02:13:26 +0500 Subject: [PATCH 25/29] Use emptydir volumes for nextcloud chart test --- test/nextcloud/2.3.2/templates/_helpers.tpl | 8 ++++++++ test/nextcloud/2.3.2/test_values.yaml | 2 ++ 2 files changed, 10 insertions(+) diff --git a/test/nextcloud/2.3.2/templates/_helpers.tpl b/test/nextcloud/2.3.2/templates/_helpers.tpl index 8a6ff9150ce..3c582e14d7b 100644 --- a/test/nextcloud/2.3.2/templates/_helpers.tpl +++ b/test/nextcloud/2.3.2/templates/_helpers.tpl @@ -78,17 +78,25 @@ Retrieve host path defined in volume Retrieve backup postgresql host path defined in volume */}} {{- define "configuredBackupPostgresHostPath" -}} +{{- if .Values.emptyDirVolumes -}} +{{- printf "" -}} +{{- else -}} {{- $volDict := dict "datasetName" $.Values.postgresBackupVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} {{- include "retrieveHostPathFromiXVolume" $volDict -}} {{- end -}} +{{- end -}} {{/* Retrieve postgresql data host path defined in volume */}} {{- define "configuredPostgresHostPath" -}} +{{- if .Values.emptyDirVolumes -}} +{{- printf "" -}} +{{- else -}} {{- $volDict := dict "datasetName" $.Values.postgresDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} {{- include "retrieveHostPathFromiXVolume" $volDict -}} {{- end -}} +{{- end -}} {{/* Selector labels diff --git a/test/nextcloud/2.3.2/test_values.yaml b/test/nextcloud/2.3.2/test_values.yaml index f58524c7a73..d087f4c6f7c 100644 --- a/test/nextcloud/2.3.2/test_values.yaml +++ b/test/nextcloud/2.3.2/test_values.yaml @@ -23,3 +23,5 @@ postgresql: service: nodePort: 31000 + +emptyDirVolumes: true From 926b781bffde554f868d3d61b0ca1f45b2ed819e Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 8 Dec 2020 02:23:32 +0500 Subject: [PATCH 26/29] Define image pull policy for init container --- test/nextcloud/2.3.2/questions.yaml | 2 ++ test/nextcloud/2.3.2/templates/deployment.yaml | 1 + 2 files changed, 3 insertions(+) diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 59262e9d010..4e23bd88494 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -111,6 +111,7 @@ questions: - variable: nextcloudDataHostPathEnabled label: "Configure Host Path for Nextcloud data" + group: "Storage" schema: type: boolean default: false @@ -123,6 +124,7 @@ questions: - variable: nextcloudDataVolume label: "Configure iXVolume" + group: "Storage" schema: type: dict $ref: diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index ecbc4a0a34f..a99a9d7a257 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -42,6 +42,7 @@ spec: - name: init-postgresdb image: busybox:latest command: ['sh', '-c', "until nslookup {{ template "nextcloud.fullname" . }}-postgres; do echo waiting for postgres; sleep 2; done"] + imagePullPolicy: {{ .Values.image.pullPolicy }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" From 7abbec70ef496d6624c740ce860844c29446d7ac Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 8 Dec 2020 19:01:51 +0500 Subject: [PATCH 27/29] Add web portal uri for nextcloud --- test/nextcloud/2.3.2/Chart.yaml | 8 -------- test/nextcloud/2.3.2/README.md | 2 -- test/nextcloud/2.3.2/questions.yaml | 9 +++++++++ test/nextcloud/2.3.2/templates/NOTES.txt | 2 +- test/nextcloud/item.yaml | 1 + 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/nextcloud/2.3.2/Chart.yaml b/test/nextcloud/2.3.2/Chart.yaml index c9c10ccfd7c..7b57ad512c2 100644 --- a/test/nextcloud/2.3.2/Chart.yaml +++ b/test/nextcloud/2.3.2/Chart.yaml @@ -12,12 +12,4 @@ keywords: home: https://nextcloud.com/ icon: https://cdn.rawgit.com/docker-library/docs/defa5ffc7123177acd60ddef6e16bddf694cc35f/nextcloud/logo.svg sources: -- https://github.com/nextcloud/helm - https://github.com/nextcloud/docker -maintainers: -- name: skjnldsv - email: skjnldsv@protonmail.com -- name: chrisingenhaag - email: christian.ingenhaag@googlemail.com -- name: billimek - email: jeff@billimek.com diff --git a/test/nextcloud/2.3.2/README.md b/test/nextcloud/2.3.2/README.md index b2b5bc91ba8..28f3c664050 100644 --- a/test/nextcloud/2.3.2/README.md +++ b/test/nextcloud/2.3.2/README.md @@ -6,8 +6,6 @@ This chart bootstraps an [nextcloud](https://hub.docker.com/_/nextcloud/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. -It also packages the [Bitnami MariaDB chart](https://github.com/kubernetes/charts/tree/master/stable/mariadb) which is required for bootstrapping a MariaDB deployment for the database requirements of the nextcloud application. - ## Configuration Please refer to questions.yaml for a detailed overview on supported configurable values. diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 4e23bd88494..67b0ed3ef60 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -10,6 +10,15 @@ groups: - name: "Postgresql Configuration" description: "Configure Postgresql for nextcloud" +portals: + web_portal: + protocols: + - "http" + host: + - "$variable-nextcloud.host" + ports: + - "$variable-service.nodePort" + questions: # Image related - variable: image diff --git a/test/nextcloud/2.3.2/templates/NOTES.txt b/test/nextcloud/2.3.2/templates/NOTES.txt index e876825c056..9b2f7cd2d14 100644 --- a/test/nextcloud/2.3.2/templates/NOTES.txt +++ b/test/nextcloud/2.3.2/templates/NOTES.txt @@ -1,3 +1,3 @@ 1. Get the nextcloud URL by running: - echo http://{{ .Values.nextcloud.host }}:{{ .Values.service.type }}/ + echo http://{{ .Values.nextcloud.host }}:{{ .Values.service.nodePort }}/ diff --git a/test/nextcloud/item.yaml b/test/nextcloud/item.yaml index f06426856f0..14b174550dd 100644 --- a/test/nextcloud/item.yaml +++ b/test/nextcloud/item.yaml @@ -1,2 +1,3 @@ categories: - productivity +icon_url: https://cdn.rawgit.com/docker-library/docs/defa5ffc7123177acd60ddef6e16bddf694cc35f/nextcloud/logo.svg From f015c830abd7416694774e39e98805dad2fab448 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 8 Dec 2020 20:30:56 +0500 Subject: [PATCH 28/29] Always roll out deployment on update --- test/nextcloud/2.3.2/templates/deployment.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/nextcloud/2.3.2/templates/deployment.yaml b/test/nextcloud/2.3.2/templates/deployment.yaml index a99a9d7a257..6f0f36b4d5e 100644 --- a/test/nextcloud/2.3.2/templates/deployment.yaml +++ b/test/nextcloud/2.3.2/templates/deployment.yaml @@ -27,10 +27,8 @@ spec: app.kubernetes.io/name: {{ include "nextcloud.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: app - {{- if .Values.podAnnotations }} annotations: -{{ toYaml .Values.podAnnotations | indent 8 }} - {{- end }} + rollme: {{ randAlphaNum 5 | quote }} spec: {{- if .Values.image.pullSecrets }} imagePullSecrets: From e3658579c0d532afa7aa0cfc4dfea4755dbb6311 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 8 Dec 2020 21:00:53 +0500 Subject: [PATCH 29/29] Add nodeip default --- features_capability.json | 4 ++++ test/nextcloud/2.3.2/questions.yaml | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/features_capability.json b/features_capability.json index af1d4709aca..0a18d90692d 100644 --- a/features_capability.json +++ b/features_capability.json @@ -18,5 +18,9 @@ "definitions/timezone": { "stable": {"min": "20.12-ALPHA"}, "nightlies": {"min": "20.12-MASTER"} + }, + "definitions/nodeIP": { + "stable": {"min": "20.12-ALPHA"}, + "nightlies": {"min": "20.12-MASTER"} } } \ No newline at end of file diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 67b0ed3ef60..ab2ae990cf3 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -70,7 +70,8 @@ questions: label: "Nextcloud host" schema: type: string - default: "nextcloud.kube.home" + $ref: + - "definitions/nodeIP" - variable: username label: "Username" schema: