diff --git a/bookstack/.helmignore b/bookstack/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/bookstack/.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/bookstack/Chart.yaml b/bookstack/Chart.yaml new file mode 100644 index 0000000..a02cbba --- /dev/null +++ b/bookstack/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +appVersion: 0.27.5 +deprecated: true +description: DEPRECATED BookStack is a simple, self-hosted, easy-to-use platform for + organising and storing information. +home: https://www.bookstackapp.com/ +icon: https://github.com/BookStackApp/website/blob/master/static/images/logo.png +name: bookstack +sources: +- https://github.com/BookStackApp/BookStack +version: 1.2.4 diff --git a/bookstack/OWNERS b/bookstack/OWNERS new file mode 100644 index 0000000..bfc8a2c --- /dev/null +++ b/bookstack/OWNERS @@ -0,0 +1,4 @@ +approvers: +- verwilst +reviewers: +- verwilst diff --git a/bookstack/README.md b/bookstack/README.md new file mode 100644 index 0000000..b2433fd --- /dev/null +++ b/bookstack/README.md @@ -0,0 +1,152 @@ +# ⚠️ Repo Archive Notice + +As of Nov 13, 2020, charts in this repo will no longer be updated. +For more information, see the Helm Charts [Deprecation and Archive Notice](https://github.com/helm/charts#%EF%B8%8F-deprecation-and-archive-notice), and [Update](https://helm.sh/blog/charts-repo-deprecation/). + +# ⚠️ Chart Deprecated + +# Bookstack + +[Bookstack](https://www.bookstackapp.com) is a simple, easy-to-use platform for organising and storing information. + +## TL;DR; + +```bash +$ helm install stable/bookstack +``` + +## Introduction + +This chart bootstraps a [Bookstack](https://hub.docker.com/r/solidnerd/bookstack/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +It also uses the [MariaDB chart](https://github.com/kubernetes/charts/tree/master/stable/mariadb) which satisfies the database requirements of the 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`: + +```bash +$ helm update --install my-release stable/bookstack +``` + +The command deploys Bookstack 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: + +```bash +$ 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 Redmine chart and their default values. + +| Parameter | Description | Default | +| --------------------------------- | ---------------------------------------- | ------------------------------------------------------- | +| `env` | additional env variables | `{}` | +| `replicaCount` | Number of replicas to start | `1` | +| `image.repository` | Bookstack image name | `solidnerd/bookstack` | +| `image.tag` | Bookstack image tag | `0.27.5` | +| `image.pullPolicy` | Bookstack image pull policy | `IfNotPresent` | +| `externalDatabase.host` | Host of the external database | `nil` | +| `externalDatabase.port` | Port of the external database | `3306` | +| `externalDatabase.user` | Existing username in the external db | `bookstack` | +| `externalDatabase.password` | Password for the above username | `nil` | +| `externalDatabase.database` | Name of the existing database | `bookstack` | +| `mariadb.enabled` | Whether to use the MariaDB chart | `true` | +| `mariadb.db.name` | Database name to create | `bookstack` | +| `mariadb.db.user` | Database user to create | `bookstack` | +| `mariadb.db.password` | Password for the database | `nil` | +| `mariadb.rootUser.password` | MariaDB admin password | `nil` | +| `mariadb.master.persistence.enabled` | Enable MariaDB persistence using PVC | `false` | +| `mariadb.master.persistence.storageClass` | PVC Storage Class for MariaDB volume | `nil` (uses alpha storage class annotation) | +| `mariadb.master.persistence.accessMode` | PVC Access Mode for MariaDB volume | `ReadWriteOnce` | +| `mariadb.master.persistence.size` | PVC Storage Request for MariaDB volume | `8Gi` | +| `service.type` | Desired service type | `ClusterIP` | +| `service.port` | Service exposed port | `80` | +| `podSecurityPolicy.enabled` | Create & use Pod Security Policy resources | `false` | +| `rbac.create` | Use Role-based Access Control | `true` | +| `serviceAccount.create` | Should we create a ServiceAccount | `true` | +| `serviceAccount.name` | Name of the ServiceAccount to use | `null` | +| `persistence.uploads.enabled` | Enable persistence using PVC for uploads | `true` | +| `persistence.uploads.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) | +| `persistence.uploads.accessMode` | PVC Access Mode | `ReadWriteOnce` | +| `persistence.uploads.size` | PVC Storage Request | `8Gi` | +| `persistence.uploads.existingClaim` | If PVC exists & bounded for uploads | `nil` (when nil, new one is requested) | +| `persistence.storage.enabled` | Enable persistence using PVC for uploads | `true` | +| `persistence.storage.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) | +| `persistence.storage.accessMode` | PVC Access Mode | `ReadWriteOnce` | +| `persistence.storage.size` | PVC Storage Request | `8Gi` | +| `persistence.storage.existingClaim` | If PVC exists & bounded for storage | `nil` (when nil, new one is requested) | +| `ingress.enabled` | Enable or disable the ingress | `false` | +| `ingress.hosts` | The virtual host name(s) | `{}` | +| `ingress.annotations` | An array of service annotations | `nil` | +| `ingress.tls[i].secretName` | The secret kubernetes.io/tls | `nil` | +| `ingress.tls[i].hosts[j]` | The virtual host name | `nil` | +| `resources` | Resources allocation (Requests and Limits) | `{}` | +| `ldap.enabled` | Enable or disable LDAP authentication. [See official docs for details](https://www.bookstackapp.com/docs/admin/ldap-auth/) | `false` | +| `ldap.server` | LDAP server address | `nil` | +| `ldap.base_dn` | Base DN where users will be searched | `nil` | +| `ldap.dn` | User which will make search queries. Leave empty to search anonymously. | `nil` | +| `ldap.pass` | Password of user performing search queries. | `nil` | +| `ldap.userFilter` | A filter to use when searching for users | `nil` | +| `ldap.version` | Set the LDAP version to use when connecting to the server. Required especially when using AD. | `nil` | + +The above parameters map to the env variables defined in the [Bookstack image](https://hub.docker.com/r/solidnerd/bookstack/) and the MariaDB/MySQL database settings. For more information please refer to the [Bookstack](https://hub.docker.com/r/solidnerd/bookstack/) image documentation. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm upgrade --install my-release \ + --set podSecurityPolicy.enabled=true \ + stable/bookstack +``` + +The above command enables podSecurityPolicy. + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```bash +$ helm upgrade --install my-release -f values.yaml stable/bookstack +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Replicas + +Bookstack writes uploaded files to a persistent volume. By default that volume +cannot be shared between pods (RWO). In such a configuration the `replicas` option +must be set to `1`. If the persistent volume supports more than one writer +(RWX), ie NFS, `replicaCount` can be greater than `1`. + +## Persistence + +The [Bookstack](https://hub.docker.com/r/solidnerd/bookstack/) image stores the uploaded data at the `public/uploads` path, relative to the document root of the Bookstack application. Other misc. data is stored under the `public/storage` path, also relative to the document root of the application. + +Persistent Volume Claims are used to keep the data across deployments. The volume is created using dynamic volume provisioning. + +See the [Configuration](#configuration) section to configure the PVC or to disable persistence. + +### Existing PersistentVolumeClaims + +The following example includes two PVCs, one for uploads and another for misc. data. + +1. Create the PersistentVolume +1. Create the PersistentVolumeClaim +1. Create the directory, on a worker +1. Install the chart + +```bash +$ helm upgrade --install test --set persistence.uploads.existingClaim=PVC_UPLOADS,persistence.storage.existingClaim=PVC_STORAGE stable/bookstack +``` diff --git a/bookstack/charts/mariadb/.helmignore b/bookstack/charts/mariadb/.helmignore new file mode 100644 index 0000000..6b8710a --- /dev/null +++ b/bookstack/charts/mariadb/.helmignore @@ -0,0 +1 @@ +.git diff --git a/bookstack/charts/mariadb/Chart.yaml b/bookstack/charts/mariadb/Chart.yaml new file mode 100644 index 0000000..9ed88c0 --- /dev/null +++ b/bookstack/charts/mariadb/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +appVersion: 10.3.22 +deprecated: true +description: DEPRECATED Fast, reliable, scalable, and easy to use open-source relational + database system. MariaDB Server is intended for mission-critical, heavy-load production + systems as well as for embedding into mass-deployed software. Highly available MariaDB + cluster. +home: https://mariadb.org +icon: https://bitnami.com/assets/stacks/mariadb/img/mariadb-stack-220x234.png +keywords: +- mariadb +- mysql +- database +- sql +- prometheus +name: mariadb +sources: +- https://github.com/bitnami/bitnami-docker-mariadb +- https://github.com/prometheus/mysqld_exporter +version: 7.3.14 diff --git a/bookstack/charts/mariadb/OWNERS b/bookstack/charts/mariadb/OWNERS new file mode 100644 index 0000000..f87e010 --- /dev/null +++ b/bookstack/charts/mariadb/OWNERS @@ -0,0 +1,16 @@ +approvers: +- prydonius +- tompizmor +- sameersbn +- carrodher +- javsalgar +- juan131 +- miguelaeh +reviewers: +- prydonius +- tompizmor +- sameersbn +- carrodher +- javsalgar +- juan131 +- miguelaeh diff --git a/bookstack/charts/mariadb/README.md b/bookstack/charts/mariadb/README.md new file mode 100644 index 0000000..4d4aacc --- /dev/null +++ b/bookstack/charts/mariadb/README.md @@ -0,0 +1,353 @@ +# MariaDB + +[MariaDB](https://mariadb.org) is one of the most popular database servers in the world. It’s made by the original developers of MySQL and guaranteed to stay open source. Notable users include Wikipedia, Facebook and Google. + +MariaDB is developed as open source software and as a relational database it provides an SQL interface for accessing data. The latest versions of MariaDB also include GIS and JSON features. + +## This Helm chart is deprecated + +Given the [`stable` deprecation timeline](https://github.com/helm/charts#deprecation-timeline), the Bitnami maintained MariaDB Helm chart is now located at [bitnami/charts](https://github.com/bitnami/charts/). + +The Bitnami repository is already included in the Hubs and we will continue providing the same cadence of updates, support, etc that we've been keeping here these years. Installation instructions are very similar, just adding the _bitnami_ repo and using it during the installation (`bitnami/` instead of `stable/`) + +```bash +$ helm repo add bitnami https://charts.bitnami.com/bitnami +$ helm install my-release bitnami/ # Helm 3 +$ helm install --name my-release bitnami/ # Helm 2 +``` + +To update an exisiting _stable_ deployment with a chart hosted in the bitnami repository you can execute + +```bash +$ helm repo add bitnami https://charts.bitnami.com/bitnami +$ helm upgrade my-release bitnami/ +``` + +Issues and PRs related to the chart itself will be redirected to `bitnami/charts` GitHub repository. In the same way, we'll be happy to answer questions related to this migration process in [this issue](https://github.com/helm/charts/issues/20969) created as a common place for discussion. + +## TL;DR; + +```bash +$ helm install my-release stable/mariadb +``` + +## Introduction + +This chart bootstraps a [MariaDB](https://github.com/bitnami/bitnami-docker-mariadb) replication cluster deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the [BKPR](https://kubeprod.io/). + +## Prerequisites + +- Kubernetes 1.12+ +- Helm 2.11+ or Helm 3.0-beta3+ +- PV provisioner support in the underlying infrastructure + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install my-release stable/mariadb +``` + +The command deploys MariaDB on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) 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: + +```bash +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Parameters + +The following table lists the configurable parameters of the MariaDB chart and their default values. + +| Parameter | Description | Default | +|---------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------------| +| `global.imageRegistry` | Global Docker image registry | `nil` | +| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `global.storageClass` | Global storage class for dynamic provisioning | `nil` | +| `image.registry` | MariaDB image registry | `docker.io` | +| `image.repository` | MariaDB Image name | `bitnami/mariadb` | +| `image.tag` | MariaDB Image tag | `{TAG_NAME}` | +| `image.pullPolicy` | MariaDB image pull policy | `IfNotPresent` | +| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `image.debug` | Specify if debug logs should be enabled | `false` | +| `nameOverride` | String to partially override mariadb.fullname template with a string (will prepend the release name) | `nil` | +| `fullnameOverride` | String to fully override mariadb.fullname template with a string | `nil` | +| `volumePermissions.enabled` | Enable init container that changes volume permissions in the data directory (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` | +| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` | +| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` | +| `volumePermissions.image.tag` | Init container volume-permissions image tag | `buster` | +| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` | +| `volumePermissions.resources` | Init container resource requests/limit | `nil` | +| `service.type` | Kubernetes service type | `ClusterIP` | +| `service.clusterIp.master` | Specific cluster IP for master when service type is cluster IP. Use None for headless service | `nil` | +| `service.clusterIp.slave` | Specific cluster IP for slave when service type is cluster IP. Use None for headless service | `nil` | +| `service.port` | MySQL service port | `3306` | +| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `false` | +| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the mariadb.fullname template | +| `schedulerName` | Name of the k8s scheduler (other than default) | `nil` | +| `rbac.create` | Create and use RBAC resources | `false` | +| `securityContext.enabled` | Enable security context | `true` | +| `securityContext.fsGroup` | Group ID for the container | `1001` | +| `securityContext.runAsUser` | User ID for the container | `1001` | +| `existingSecret` | Use existing secret for password details (`rootUser.password`, `db.password`, `replication.password` will be ignored and picked up from this secret). The secret has to contain the keys `mariadb-root-password`, `mariadb-replication-password` and `mariadb-password`. | `nil` | +| `rootUser.password` | Password for the `root` user. Ignored if existing secret is provided. | _random 10 character alphanumeric string_ | +| `rootUser.forcePassword` | Force users to specify a password | `false` | +| `rootUser.injectSecretsAsVolume` | Mount admin user password as a file instead of using an environment variable | `false` | +| `db.name` | Name for new database to create | `my_database` | +| `db.user` | Username of new user to create | `""` | +| `db.password` | Password for the new user. Ignored if existing secret is provided. | _random 10 character alphanumeric string if `db.user` is defined_ | +| `db.forcePassword` | Force users to specify a password | `false` | +| `db.injectSecretsAsVolume` | Mount user password as a file instead of using an environment variable | `false` | +| `replication.enabled` | MariaDB replication enabled | `true` | +| `replication.user` | MariaDB replication user | `replicator` | +| `replication.password` | MariaDB replication user password. Ignored if existing secret is provided. | _random 10 character alphanumeric string_ | +| `replication.forcePassword` | Force users to specify a password | `false` | +| `replication.injectSecretsAsVolume` | Mount replication user password as a file instead of using an environment variable | `false` | +| `initdbScripts` | Dictionary of initdb scripts | `nil` | +| `initdbScriptsConfigMap` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`) | `nil` | +| `master.annotations[].key` | key for the the annotation list item | `nil` | +| `master.annotations[].value` | value for the the annotation list item | `nil` | +| `master.extraFlags` | MariaDB master additional command line flags | `nil` | +| `master.affinity` | Master affinity (in addition to master.antiAffinity when set) | `{}` | +| `master.antiAffinity` | Master pod anti-affinity policy | `soft` | +| `master.nodeSelector` | Master node labels for pod assignment | `{}` | +| `master.tolerations` | List of node taints to tolerate (master) | `[]` | +| `master.updateStrategy` | Master statefulset update strategy policy | `RollingUpdate` | +| `master.persistence.enabled` | Enable persistence using PVC | `true` | +| `master.persistence.existingClaim` | Provide an existing `PersistentVolumeClaim` | `nil` | +| `master.persistence.subPath` | Subdirectory of the volume to mount | `nil` | +| `master.persistence.mountPath` | Path to mount the volume at | `/bitnami/mariadb` | +| `master.persistence.annotations` | Persistent Volume Claim annotations | `{}` | +| `master.persistence.storageClass` | Persistent Volume Storage Class | `` | +| `master.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` | +| `master.persistence.size` | Persistent Volume Size | `8Gi` | +| `master.extraInitContainers` | Additional init containers as a string to be passed to the `tpl` function (master) | | +| `master.extraEnvVars` | Array containing extra env vars to configure MariaDB master replicas | `nil` | +| `master.config` | Config file for the MariaDB Master server | `_default values in the values.yaml file_` | +| `master.resources` | CPU/Memory resource requests/limits for master node | `{}` | +| `master.livenessProbe.enabled` | Turn on and off liveness probe (master) | `true` | +| `master.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated (master) | `120` | +| `master.livenessProbe.periodSeconds` | How often to perform the probe (master) | `10` | +| `master.livenessProbe.timeoutSeconds` | When the probe times out (master) | `1` | +| `master.livenessProbe.successThreshold` | Minimum consecutive successes for the probe (master)| `1` | +| `master.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe (master) | `3` | +| `master.readinessProbe.enabled` | Turn on and off readiness probe (master) | `true` | +| `master.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated (master) | `30` | +| `master.readinessProbe.periodSeconds` | How often to perform the probe (master) | `10` | +| `master.readinessProbe.timeoutSeconds` | When the probe times out (master) | `1` | +| `master.readinessProbe.successThreshold` | Minimum consecutive successes for the probe (master)| `1` | +| `master.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe (master) | `3` | +| `master.podDisruptionBudget.enabled` | If true, create a pod disruption budget for master pods. | `false` | +| `master.podDisruptionBudget.minAvailable` | Minimum number / percentage of pods that should remain scheduled | `1` | +| `master.podDisruptionBudget.maxUnavailable` | Maximum number / percentage of pods that may be made unavailable | `nil` | +| `master.service.annotations` | Master service annotations | `{}` | +| `slave.replicas` | Desired number of slave replicas | `1` | +| `slave.annotations[].key` | key for the the annotation list item | `nil` | +| `slave.annotations[].value` | value for the the annotation list item | `nil` | +| `slave.extraFlags` | MariaDB slave additional command line flags | `nil` | +| `slave.affinity` | Slave affinity (in addition to slave.antiAffinity when set) | `{}` | +| `slave.antiAffinity` | Slave pod anti-affinity policy | `soft` | +| `slave.nodeSelector` | Slave node labels for pod assignment | `{}` | +| `slave.tolerations` | List of node taints to tolerate for (slave) | `[]` | +| `slave.updateStrategy` | Slave statefulset update strategy policy | `RollingUpdate` | +| `slave.persistence.enabled` | Enable persistence using a `PersistentVolumeClaim` | `true` | +| `slave.persistence.annotations` | Persistent Volume Claim annotations | `{}` | +| `slave.persistence.storageClass` | Persistent Volume Storage Class | `` | +| `slave.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` | +| `slave.persistence.size` | Persistent Volume Size | `8Gi` | +| `slave.extraInitContainers` | Additional init containers as a string to be passed to the `tpl` function (slave) | `nil` | +| `slave.extraEnvVars` | Array containing extra env vars to configure MariaDB slave replicas | `nil` | +| `slave.config` | Config file for the MariaDB Slave replicas | `_default values in the values.yaml file_` | +| `slave.resources` | CPU/Memory resource requests/limits for slave node | `{}` | +| `slave.livenessProbe.enabled` | Turn on and off liveness probe (slave) | `true` | +| `slave.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated (slave) | `120` | +| `slave.livenessProbe.periodSeconds` | How often to perform the probe (slave) | `10` | +| `slave.livenessProbe.timeoutSeconds` | When the probe times out (slave) | `1` | +| `slave.livenessProbe.successThreshold` | Minimum consecutive successes for the probe (slave) | `1` | +| `slave.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe (slave) | `3` | +| `slave.readinessProbe.enabled` | Turn on and off readiness probe (slave) | `true` | +| `slave.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated (slave) | `45` | +| `slave.readinessProbe.periodSeconds` | How often to perform the probe (slave) | `10` | +| `slave.readinessProbe.timeoutSeconds` | When the probe times out (slave) | `1` | +| `slave.readinessProbe.successThreshold` | Minimum consecutive successes for the probe (slave) | `1` | +| `slave.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe (slave) | `3` | +| `slave.podDisruptionBudget.enabled` | If true, create a pod disruption budget for slave pods. | `false` | +| `slave.podDisruptionBudget.minAvailable` | Minimum number / percentage of pods that should remain scheduled | `1` | +| `slave.podDisruptionBudget.maxUnavailable` | Maximum number / percentage of pods that may be made unavailable | `nil` | +| `slave.service.annotations` | Slave service annotations | `{}` | +| `metrics.enabled` | Start a side-car prometheus exporter | `false` | +| `metrics.image.registry` | Exporter image registry | `docker.io` | +| `metrics.image.repository` | Exporter image name | `bitnami/mysqld-exporter` | +| `metrics.image.tag` | Exporter image tag | `{TAG_NAME}` | +| `metrics.image.pullPolicy` | Exporter image pull policy | `IfNotPresent` | +| `metrics.resources` | Exporter resource requests/limit | `nil` | +| `metrics.extraArgs.master` | Extra args to be passed to mysqld_exporter | `[]` | +| `metrics.extraArgs.slave` | Extra args to be passed to mysqld_exporter | `[]` | +| `metrics.livenessProbe.enabled` | Turn on and off liveness probe (metrics) | `true` | +| `metrics.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated (metrics) | `120` | +| `metrics.livenessProbe.periodSeconds` | How often to perform the probe (metrics) | `10` | +| `metrics.livenessProbe.timeoutSeconds` | When the probe times out (metrics) | `1` | +| `metrics.livenessProbe.successThreshold` | Minimum consecutive successes for the probe (metrics) | `1` | +| `metrics.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe (metrics) | `3` | +| `metrics.readinessProbe.enabled` | Turn on and off readiness probe (metrics) | `true` | +| `metrics.readinessProbe.initialDelaySeconds`| Delay before readiness probe is initiated (metrics) | `30` | +| `metrics.readinessProbe.periodSeconds` | How often to perform the probe (metrics) | `10` | +| `metrics.readinessProbe.timeoutSeconds` | When the probe times out (metrics) | `1` | +| `metrics.readinessProbe.successThreshold` | Minimum consecutive successes for the probe (metrics) | `1` | +| `metrics.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe (metrics) | `3` | +| `metrics.serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` | +| `metrics.serviceMonitor.namespace` | Optional namespace which Prometheus is running in | `nil` | +| `metrics.serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` | +| `metrics.serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` | +| `tests.enabled` | Provide tests to check if connect and authentication is possible | `true` | +| `tests.resources` | Resource definition for the test-runner pod | `nil` | +| `tests.testFramework.image.registry` | Test framework image registry (init container) | `docker.io` | +| `tests.testFramework.image.repository` | Test framework image name | `dduportal/bats` | +| `tests.testFramework.image.tag` | Test framework image tag | `0.4.0` | +| `tests.testFramework.resources` | Resource definition for the test framework | `nil` | + +The above parameters map to the env variables defined in [bitnami/mariadb](http://github.com/bitnami/bitnami-docker-mariadb). For more information please refer to the [bitnami/mariadb](http://github.com/bitnami/bitnami-docker-mariadb) image documentation. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install my-release \ + --set rootUser.password=secretpassword,db.user=app_database \ + stable/mariadb +``` + +The above command sets the MariaDB `root` account password to `secretpassword`. Additionally it creates a database named `my_database`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install my-release -f values.yaml stable/mariadb +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Configuration and installation details + +### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/) + +It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image. + +Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist. + +### Production configuration + +This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. You can use this file instead of the default one. + +- Force users to specify a password and mount secrets as volumes instead of using environment variables: + +```diff +- rootUser.forcePassword: false +- rootUser.injectSecretsAsVolume: false ++ rootUser.forcePassword: true ++ rootUser.injectSecretsAsVolume: true +- db.forcePassword: false +- db.injectSecretsAsVolume: false ++ db.forcePassword: true ++ db.injectSecretsAsVolume: true +- replication.forcePassword: false +- replication.injectSecretsAsVolume: false ++ replication.forcePassword: true ++ replication.injectSecretsAsVolume: true +``` + +- Desired number of slave replicas: + +```diff +- slave.replicas: 1 ++ slave.replicas: 2 +``` + +- Start a side-car prometheus exporter: + +```diff +- metrics.enabled: false ++ metrics.enabled: true +``` + +### Initialize a fresh instance + +The [Bitnami MariaDB](https://github.com/bitnami/bitnami-docker-mariadb) image allows you to use your custom scripts to initialize a fresh instance. In order to execute the scripts, they must be located inside the chart folder `files/docker-entrypoint-initdb.d` so they can be consumed as a ConfigMap. + +Alternatively, you can specify custom scripts using the `initdbScripts` parameter as dict. + +In addition to these options, you can also set an external ConfigMap with all the initialization scripts. This is done by setting the `initdbScriptsConfigMap` parameter. Note that this will override the two previous options. + +The allowed extensions are `.sh`, `.sql` and `.sql.gz`. + +### Extra Init Containers + +The feature allows for specifying a template string for a initContainer in the master/slave pod. Usecases include situations when you need some pre-run setup. For example, in IKS (IBM Cloud Kubernetes Service), non-root users do not have write permission on the volume mount path for NFS-powered file storage. So, you could use a initcontainer to `chown` the mount. See a example below, where we add an initContainer on the master pod that reports to an external resource that the db is going to starting. +`values.yaml` +```yaml +master: + extraInitContainers: | + - name: initcontainer + image: bitnami/minideb:buster + command: ["/bin/sh", "-c"] + args: + - install_packages curl && curl http://api-service.local/db/starting; +``` + +## Persistence + +The [Bitnami MariaDB](https://github.com/bitnami/bitnami-docker-mariadb) image stores the MariaDB data and configurations at the `/bitnami/mariadb` path of the container. + +The chart mounts a [Persistent Volume](kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning, by default. An existing PersistentVolumeClaim can be defined. + +### Adjust permissions of persistent volume mountpoint + +As the image run as non-root by default, it is necessary to adjust the ownership of the persistent volume so that the container can write data into it. + +By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volume. However, this feature does not work in all Kubernetes distributions. +As an alternative, this chart supports using an initContainer to change the ownership of the volume before mounting it in the final destination. + +You can enable this initContainer by setting `volumePermissions.enabled` to `true`. + +## Upgrading + +It's necessary to set the `rootUser.password` parameter when upgrading for readiness/liveness probes to work properly. When you install this chart for the first time, some notes will be displayed providing the credentials you must use under the 'Administrator credentials' section. Please note down the password and run the command below to upgrade your chart: + +```bash +$ helm upgrade my-release stable/mariadb --set rootUser.password=[ROOT_PASSWORD] +``` + +| Note: you need to substitute the placeholder _[ROOT_PASSWORD]_ with the value obtained in the installation notes. + +### To 7.0.0 + +Helm performs a lookup for the object based on its group (apps), version (v1), and kind (Deployment). Also known as its GroupVersionKind, or GVK. Changing the GVK is considered a compatibility breaker from Kubernetes' point of view, so you cannot "upgrade" those objects to the new GVK in-place. Earlier versions of Helm 3 did not perform the lookup correctly which has since been fixed to match the spec. + +In https://github.com/helm/charts/pull/17308 the `apiVersion` of the statefulset resources was updated to `apps/v1` in tune with the api's deprecated, resulting in compatibility breakage. + +This major version bump signifies this change. + +### To 6.0.0 + +MariaDB version was updated from 10.1 to 10.3, there are no changes in the chart itself. According to the official documentation, upgrading from 10.1 should be painless. However, there are some things that have changed which could affect an upgrade: + +- [Incompatible changes upgrading from MariaDB 10.1 to MariaDB 10.2](https://mariadb.com/kb/en/library/upgrading-from-mariadb-101-to-mariadb-102//#incompatible-changes-between-101-and-102) +- [Incompatible changes upgrading from MariaDB 10.2 to MariaDB 10.3](https://mariadb.com/kb/en/library/upgrading-from-mariadb-102-to-mariadb-103/#incompatible-changes-between-102-and-103) + +### To 5.0.0 + +Backwards compatibility is not guaranteed unless you modify the labels used on the chart's deployments. +Use the workaround below to upgrade from versions previous to 5.0.0. The following example assumes that the release name is mariadb: + +```console +$ kubectl delete statefulset opencart-mariadb --cascade=false +``` diff --git a/bookstack/charts/mariadb/files/docker-entrypoint-initdb.d/README.md b/bookstack/charts/mariadb/files/docker-entrypoint-initdb.d/README.md new file mode 100644 index 0000000..aaddde3 --- /dev/null +++ b/bookstack/charts/mariadb/files/docker-entrypoint-initdb.d/README.md @@ -0,0 +1,3 @@ +You can copy here your custom .sh, .sql or .sql.gz file so they are executed during the first boot of the image. + +More info in the [bitnami-docker-mariadb](https://github.com/bitnami/bitnami-docker-mariadb#initializing-a-new-instance) repository. \ No newline at end of file diff --git a/bookstack/charts/mariadb/templates/NOTES.txt b/bookstack/charts/mariadb/templates/NOTES.txt new file mode 100644 index 0000000..dac1243 --- /dev/null +++ b/bookstack/charts/mariadb/templates/NOTES.txt @@ -0,0 +1,69 @@ +This Helm chart is deprecated + +Given the `stable` deprecation timeline (https://github.com/helm/charts#deprecation-timeline), the Bitnami maintained Helm chart is now located at bitnami/charts (https://github.com/bitnami/charts/). + +The Bitnami repository is already included in the Hubs and we will continue providing the same cadence of updates, support, etc that we've been keeping here these years. Installation instructions are very similar, just adding the _bitnami_ repo and using it during the installation (`bitnami/` instead of `stable/`) + +```bash +$ helm repo add bitnami https://charts.bitnami.com/bitnami +$ helm install my-release bitnami/ # Helm 3 +$ helm install --name my-release bitnami/ # Helm 2 +``` + +To update an exisiting _stable_ deployment with a chart hosted in the bitnami repository you can execute + +```bash +$ helm repo add bitnami https://charts.bitnami.com/bitnami +$ helm upgrade my-release bitnami/ +``` + +Issues and PRs related to the chart itself will be redirected to `bitnami/charts` GitHub repository. In the same way, we'll be happy to answer questions related to this migration process in this issue (https://github.com/helm/charts/issues/20969) created as a common place for discussion. + +Please be patient while the chart is being deployed + +Tip: + + Watch the deployment status using the command: kubectl get pods -w --namespace {{ .Release.Namespace }} -l release={{ .Release.Name }} + +Services: + + echo Master: {{ template "mariadb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }} +{{- if .Values.replication.enabled }} + echo Slave: {{ template "slave.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }} +{{- end }} + +Administrator credentials: + + Username: root + Password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.secretName" . }} -o jsonpath="{.data.mariadb-root-password}" | base64 --decode) + +To connect to your database: + + 1. Run a pod that you can use as a client: + + kubectl run {{ template "mariadb.fullname" . }}-client --rm --tty -i --restart='Never' --image {{ template "mariadb.image" . }} --namespace {{ .Release.Namespace }} --command -- bash + + 2. To connect to master service (read/write): + + mysql -h {{ template "mariadb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local -uroot -p {{ .Values.db.name }} + +{{- if .Values.replication.enabled }} + + 3. To connect to slave service (read-only): + + mysql -h {{ template "slave.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local -uroot -p {{ .Values.db.name }} +{{- end }} + +To upgrade this helm chart: + + 1. Obtain the password as described on the 'Administrator credentials' section and set the 'rootUser.password' parameter as shown below: + + ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.secretName" . }} -o jsonpath="{.data.mariadb-root-password}" | base64 --decode) + helm upgrade {{ .Release.Name }} stable/mariadb --set rootUser.password=$ROOT_PASSWORD + +{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }} + +WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ + +{{- end }} diff --git a/bookstack/charts/mariadb/templates/_helpers.tpl b/bookstack/charts/mariadb/templates/_helpers.tpl new file mode 100644 index 0000000..a24be73 --- /dev/null +++ b/bookstack/charts/mariadb/templates/_helpers.tpl @@ -0,0 +1,289 @@ +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "mariadb.statefulset.apiVersion" -}} +{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "mariadb.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 "mariadb.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- printf .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- define "master.fullname" -}} +{{- if .Values.replication.enabled -}} +{{- printf "%s-%s" (include "mariadb.fullname" .) "master" | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- include "mariadb.fullname" . -}} +{{- end -}} +{{- end -}} + +{{- define "slave.fullname" -}} +{{- printf "%s-%s" (include "mariadb.fullname" .) "slave" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "mariadb.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Return the proper MariaDB image name +*/}} +{{- define "mariadb.image" -}} +{{- $registryName := .Values.image.registry -}} +{{- $repositoryName := .Values.image.repository -}} +{{- $tag := .Values.image.tag | toString -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. +Also, we can't use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} + {{- if .Values.global.imageRegistry }} + {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} + {{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} + {{- end -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper metrics image name +*/}} +{{- define "mariadb.metrics.image" -}} +{{- $registryName := .Values.metrics.image.registry -}} +{{- $repositoryName := .Values.metrics.image.repository -}} +{{- $tag := .Values.metrics.image.tag | toString -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. +Also, we can't use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} + {{- if .Values.global.imageRegistry }} + {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} + {{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} + {{- end -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{ template "mariadb.initdbScriptsCM" . }} +{{/* +Get the initialization scripts ConfigMap name. +*/}} +{{- define "mariadb.initdbScriptsCM" -}} +{{- if .Values.initdbScriptsConfigMap -}} +{{- printf "%s" .Values.initdbScriptsConfigMap -}} +{{- else -}} +{{- printf "%s-init-scripts" (include "master.fullname" .) -}} +{{- end -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "mariadb.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "mariadb.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "mariadb.imagePullSecrets" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +Also, we can not use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} +{{- if .Values.global.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.global.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets .Values.volumePermissions.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.metrics.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.volumePermissions.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets .Values.volumePermissions.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.metrics.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.volumePermissions.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- end -}} + +{{/* +Return the proper test image name +*/}} +{{- define "mariadb.tests.testFramework.image" -}} +{{- $registryName := .Values.tests.testFramework.image.registry -}} +{{- $repositoryName := .Values.tests.testFramework.image.repository -}} +{{- $tag := .Values.tests.testFramework.image.tag | toString -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. +Also, we can't use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} + {{- if .Values.global.imageRegistry }} + {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} + {{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} + {{- end -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "mariadb.volumePermissions.image" -}} +{{- $registryName := .Values.volumePermissions.image.registry -}} +{{- $repositoryName := .Values.volumePermissions.image.repository -}} +{{- $tag := .Values.volumePermissions.image.tag | toString -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. +Also, we can't use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} + {{- if .Values.global.imageRegistry }} + {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} + {{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} + {{- end -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Storage Class for the master +*/}} +{{- define "mariadb.master.storageClass" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +*/}} +{{- if .Values.global -}} + {{- if .Values.global.storageClass -}} + {{- if (eq "-" .Values.global.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.global.storageClass -}} + {{- end -}} + {{- else -}} + {{- if .Values.master.persistence.storageClass -}} + {{- if (eq "-" .Values.master.persistence.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.master.persistence.storageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.master.persistence.storageClass -}} + {{- if (eq "-" .Values.master.persistence.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.master.persistence.storageClass -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Storage Class for the slave +*/}} +{{- define "mariadb.slave.storageClass" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +*/}} +{{- if .Values.global -}} + {{- if .Values.global.storageClass -}} + {{- if (eq "-" .Values.global.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.global.storageClass -}} + {{- end -}} + {{- else -}} + {{- if .Values.slave.persistence.storageClass -}} + {{- if (eq "-" .Values.slave.persistence.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.slave.persistence.storageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.slave.persistence.storageClass -}} + {{- if (eq "-" .Values.slave.persistence.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.slave.persistence.storageClass -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Return the name of the Secret used to store the passwords +*/}} +{{- define "mariadb.secretName" -}} +{{- if .Values.existingSecret -}} +{{ .Values.existingSecret }} +{{- else -}} +{{ template "mariadb.fullname" . -}} +{{- end -}} +{{- end -}} diff --git a/bookstack/charts/mariadb/templates/initialization-configmap.yaml b/bookstack/charts/mariadb/templates/initialization-configmap.yaml new file mode 100644 index 0000000..172e6ae --- /dev/null +++ b/bookstack/charts/mariadb/templates/initialization-configmap.yaml @@ -0,0 +1,26 @@ +{{- if and (or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScripts) (not .Values.initdbScriptsConfigMap) }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "master.fullname" . }}-init-scripts + labels: + app: "{{ template "mariadb.name" . }}" + chart: "{{ template "mariadb.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} + component: "master" +{{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz") (not .Values.initdbScriptsConfigMap) }} +binaryData: +{{- $root := . }} +{{- range $path, $bytes := .Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz" }} + {{ base $path }}: {{ $root.Files.Get $path | b64enc | quote }} +{{- end }} +{{- end }} +data: +{{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql}") (not .Values.initdbScriptsConfigMap) }} +{{ (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql}").AsConfig | indent 2 }} +{{- end }} +{{- with .Values.initdbScripts }} +{{ toYaml . | indent 2 }} +{{- end }} +{{ end }} diff --git a/bookstack/charts/mariadb/templates/master-configmap.yaml b/bookstack/charts/mariadb/templates/master-configmap.yaml new file mode 100644 index 0000000..08bc10c --- /dev/null +++ b/bookstack/charts/mariadb/templates/master-configmap.yaml @@ -0,0 +1,15 @@ +{{- if .Values.master.config }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "master.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + component: "master" + chart: "{{ template "mariadb.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +data: + my.cnf: |- +{{ .Values.master.config | indent 4 }} +{{- end -}} diff --git a/bookstack/charts/mariadb/templates/master-pdb.yaml b/bookstack/charts/mariadb/templates/master-pdb.yaml new file mode 100644 index 0000000..b162ac0 --- /dev/null +++ b/bookstack/charts/mariadb/templates/master-pdb.yaml @@ -0,0 +1,24 @@ +{{- if .Values.master.podDisruptionBudget.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "mariadb.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + component: "master" + chart: {{ template "mariadb.chart" . }} + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +spec: +{{- if .Values.master.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.master.podDisruptionBudget.minAvailable }} +{{- end }} +{{- if .Values.master.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.master.podDisruptionBudget.maxUnavailable }} +{{- end }} + selector: + matchLabels: + app: "{{ template "mariadb.name" . }}" + component: "master" + release: {{ .Release.Name | quote }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/master-statefulset.yaml b/bookstack/charts/mariadb/templates/master-statefulset.yaml new file mode 100644 index 0000000..c6ee9ef --- /dev/null +++ b/bookstack/charts/mariadb/templates/master-statefulset.yaml @@ -0,0 +1,333 @@ +apiVersion: {{ template "mariadb.statefulset.apiVersion" . }} +kind: StatefulSet +metadata: + name: {{ template "master.fullname" . }} + labels: + app: {{ template "mariadb.name" . }} + chart: {{ template "mariadb.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: master +spec: + selector: + matchLabels: + app: {{ template "mariadb.name" . }} + release: {{ .Release.Name }} + component: master + serviceName: {{ template "master.fullname" . }} + replicas: 1 + updateStrategy: + type: {{ .Values.master.updateStrategy.type }} + {{- if (eq "Recreate" .Values.master.updateStrategy.type) }} + rollingUpdate: null + {{- end }} + template: + metadata: + {{- with .Values.master.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app: {{ template "mariadb.name" . }} + chart: {{ template "mariadb.chart" . }} + release: {{ .Release.Name }} + component: master + spec: + {{- if .Values.schedulerName }} + schedulerName: {{ .Values.schedulerName | quote }} + {{- end }} + serviceAccountName: {{ template "mariadb.serviceAccountName" . }} + {{- if .Values.securityContext.enabled }} + securityContext: + fsGroup: {{ .Values.securityContext.fsGroup }} + runAsUser: {{ .Values.securityContext.runAsUser }} + {{- end }} + {{- if eq .Values.master.antiAffinity "hard" }} + affinity: + {{- with .Values.master.affinity }} +{{ toYaml . | indent 8 }} + {{- end }} + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: "kubernetes.io/hostname" + labelSelector: + matchLabels: + app: {{ template "mariadb.name" . }} + release: {{ .Release.Name }} + {{- else if eq .Values.master.antiAffinity "soft" }} + affinity: + {{- with .Values.master.affinity }} +{{ toYaml . | indent 8 }} + {{- end }} + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + podAffinityTerm: + topologyKey: kubernetes.io/hostname + labelSelector: + matchLabels: + app: {{ template "mariadb.name" . }} + release: {{ .Release.Name }} + {{- else}} + {{- with .Values.master.affinity }} + affinity: {{ toYaml . | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.master.nodeSelector }} + nodeSelector: {{ toYaml .Values.master.nodeSelector | nindent 8 }} + {{- end -}} + {{- with .Values.master.tolerations }} + tolerations: {{ toYaml . | nindent 8 }} + {{- end }} +{{- include "mariadb.imagePullSecrets" . | indent 6 }} + initContainers: + {{- if .Values.master.extraInitContainers }} +{{ tpl .Values.master.extraInitContainers . | indent 8 }} + {{- end }} + {{- if and .Values.volumePermissions.enabled .Values.master.persistence.enabled }} + - name: volume-permissions + image: {{ template "mariadb.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "{{ .Values.master.persistence.mountPath }}"] + securityContext: + runAsUser: 0 + resources: {{ toYaml .Values.volumePermissions.resources | nindent 12 }} + volumeMounts: + - name: data + mountPath: {{ .Values.master.persistence.mountPath }} + {{- end }} + containers: + - name: "mariadb" + image: {{ template "mariadb.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + env: + {{- if .Values.image.debug}} + - name: BITNAMI_DEBUG + value: "true" + {{- end }} + {{- if .Values.master.extraFlags }} + - name: MARIADB_EXTRA_FLAGS + value: "{{ .Values.master.extraFlags }}" + {{- end }} + {{- if .Values.rootUser.injectSecretsAsVolume }} + - name: MARIADB_ROOT_PASSWORD_FILE + value: "/opt/bitnami/mariadb/secrets/mariadb-root-password" + {{- else }} + - name: MARIADB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.secretName" . }} + key: mariadb-root-password + {{- end }} + {{- if not (empty .Values.db.user) }} + - name: MARIADB_USER + value: "{{ .Values.db.user }}" + {{- if .Values.db.injectSecretsAsVolume }} + - name: MARIADB_PASSWORD_FILE + value: "/opt/bitnami/mariadb/secrets/mariadb-password" + {{- else }} + - name: MARIADB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.secretName" . }} + key: mariadb-password + {{- end }} + {{- end }} + - name: MARIADB_DATABASE + value: "{{ .Values.db.name }}" + {{- if .Values.replication.enabled }} + - name: MARIADB_REPLICATION_MODE + value: "master" + - name: MARIADB_REPLICATION_USER + value: "{{ .Values.replication.user }}" + {{- if .Values.replication.injectSecretsAsVolume }} + - name: MARIADB_REPLICATION_PASSWORD_FILE + value: "/opt/bitnami/mariadb/secrets/mariadb-replication-password" + {{- else }} + - name: MARIADB_REPLICATION_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.secretName" . }} + key: mariadb-replication-password + {{- end }} + {{- end }} + {{- if .Values.master.extraEnvVars }} + {{- tpl (toYaml .Values.master.extraEnvVars) $ | nindent 12 }} + {{- end }} + ports: + - name: mysql + containerPort: 3306 + {{- if .Values.master.livenessProbe.enabled }} + livenessProbe: + exec: + command: + - sh + - -c + - | + password_aux="${MARIADB_ROOT_PASSWORD:-}" + if [ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]; then + password_aux=$(cat $MARIADB_ROOT_PASSWORD_FILE) + fi + mysqladmin status -uroot -p$password_aux + initialDelaySeconds: {{ .Values.master.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.master.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.master.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.master.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.master.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.master.readinessProbe.enabled }} + readinessProbe: + exec: + command: + - sh + - -c + - | + password_aux="${MARIADB_ROOT_PASSWORD:-}" + if [ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]; then + password_aux=$(cat $MARIADB_ROOT_PASSWORD_FILE) + fi + mysqladmin status -uroot -p$password_aux + initialDelaySeconds: {{ .Values.master.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.master.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.master.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.master.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.master.readinessProbe.failureThreshold }} + {{- end }} + {{- if .Values.master.resources }} + resources: {{ toYaml .Values.master.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: data + mountPath: {{ .Values.master.persistence.mountPath }} + {{- if .Values.master.persistence.subPath }} + subPath: {{ .Values.master.persistence.subPath }} + {{- end }} + {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap .Values.initdbScripts }} + - name: custom-init-scripts + mountPath: /docker-entrypoint-initdb.d + {{- end }} + {{- if .Values.master.config }} + - name: config + mountPath: /opt/bitnami/mariadb/conf/my.cnf + subPath: my.cnf + {{- end }} + {{- if or .Values.rootUser.injectSecretsAsVolume .Values.db.injectSecretsAsVolume .Values.replication.injectSecretsAsVolume }} + - name: mariadb-credentials + mountPath: /opt/bitnami/mariadb/secrets/ + {{- end }} + {{- if .Values.metrics.enabled }} + - name: metrics + image: {{ template "mariadb.metrics.image" . }} + imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} + env: + {{- if .Values.rootUser.injectSecretsAsVolume }} + - name: MARIADB_ROOT_PASSWORD_FILE + value: "/opt/bitnami/mysqld-exporter/secrets/mariadb-root-password" + {{- else }} + - name: MARIADB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.secretName" . }} + key: mariadb-root-password + {{- end }} + command: + - sh + - -c + - | + password_aux="${MARIADB_ROOT_PASSWORD:-}" + if [ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]; then + password_aux=$(cat $MARIADB_ROOT_PASSWORD_FILE) + fi + DATA_SOURCE_NAME="root:${password_aux}@(localhost:3306)/" /bin/mysqld_exporter + {{- range .Values.metrics.extraArgs.master }} + {{ . }} + {{- end }} + ports: + - name: metrics + containerPort: 9104 + {{- if .Values.metrics.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.metrics.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }} + {{- end }} + {{- if .Values.metrics.resources }} + resources: {{ toYaml .Values.metrics.resources | nindent 12 }} + {{- end }} + {{- if .Values.rootUser.injectSecretsAsVolume }} + volumeMounts: + - name: mariadb-credentials + mountPath: /opt/bitnami/mysqld-exporter/secrets/ + {{- end }} + {{- end }} + volumes: + {{- if .Values.master.config }} + - name: config + configMap: + name: {{ template "master.fullname" . }} + {{- end }} + {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap .Values.initdbScripts }} + - name: custom-init-scripts + configMap: + name: {{ template "mariadb.initdbScriptsCM" . }} + {{- end }} + {{- if or .Values.rootUser.injectSecretsAsVolume .Values.db.injectSecretsAsVolume .Values.replication.injectSecretsAsVolume }} + - name: mariadb-credentials + secret: + secretName: {{ template "mariadb.fullname" . }} + items: + {{- if .Values.rootUser.injectSecretsAsVolume }} + - key: mariadb-root-password + path: mariadb-root-password + {{- end }} + {{- if .Values.db.injectSecretsAsVolume }} + - key: mariadb-password + path: mariadb-password + {{- end }} + {{- if and .Values.replication.enabled .Values.replication.injectSecretsAsVolume }} + - key: mariadb-replication-password + path: mariadb-replication-password + {{- end }} + {{- end }} +{{- if and .Values.master.persistence.enabled .Values.master.persistence.existingClaim }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.master.persistence.existingClaim }} +{{- else if not .Values.master.persistence.enabled }} + - name: data + emptyDir: {} +{{- else if and .Values.master.persistence.enabled (not .Values.master.persistence.existingClaim) }} + volumeClaimTemplates: + - metadata: + name: data + labels: + app: "{{ template "mariadb.name" . }}" + component: "master" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} + spec: + accessModes: + {{- range .Values.master.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.master.persistence.size | quote }} + {{ include "mariadb.master.storageClass" . }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/master-svc.yaml b/bookstack/charts/mariadb/templates/master-svc.yaml new file mode 100644 index 0000000..7f5d8af --- /dev/null +++ b/bookstack/charts/mariadb/templates/master-svc.yaml @@ -0,0 +1,46 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "mariadb.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + component: "master" + chart: "{{ template "mariadb.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +{{- if or .Values.metrics.enabled .Values.master.service.annotations }} + annotations: +{{- if .Values.metrics.enabled }} +{{ toYaml .Values.metrics.annotations | indent 4 }} +{{- end }} +{{- if .Values.master.service.annotations }} +{{ toYaml .Values.master.service.annotations | indent 4 }} +{{- end }} +{{- end }} +spec: + type: {{ .Values.service.type }} + {{- if eq .Values.service.type "ClusterIP" }} + {{- if .Values.service.clusterIp }} + clusterIP: {{ .Values.service.clusterIp.master }} + {{- end }} + {{- end }} + ports: + - name: mysql + port: {{ .Values.service.port }} + targetPort: mysql +{{- if eq .Values.service.type "NodePort" }} +{{- if .Values.service.nodePort }} +{{- if .Values.service.nodePort.master }} + nodePort: {{ .Values.service.nodePort.master }} +{{- end }} +{{- end }} +{{- end }} +{{- if .Values.metrics.enabled }} + - name: metrics + port: 9104 + targetPort: metrics +{{- end }} + selector: + app: "{{ template "mariadb.name" . }}" + component: "master" + release: "{{ .Release.Name }}" diff --git a/bookstack/charts/mariadb/templates/role.yaml b/bookstack/charts/mariadb/templates/role.yaml new file mode 100644 index 0000000..b54eeac --- /dev/null +++ b/bookstack/charts/mariadb/templates/role.yaml @@ -0,0 +1,18 @@ +{{- if and .Values.serviceAccount.create .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ template "master.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + chart: "{{ template "mariadb.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +rules: +- apiGroups: + - "" + resources: + - endpoints + verbs: + - get +{{- end }} diff --git a/bookstack/charts/mariadb/templates/rolebinding.yaml b/bookstack/charts/mariadb/templates/rolebinding.yaml new file mode 100644 index 0000000..c6669cf --- /dev/null +++ b/bookstack/charts/mariadb/templates/rolebinding.yaml @@ -0,0 +1,18 @@ +{{- if and .Values.serviceAccount.create .Values.rbac.create }} +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ template "master.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + chart: "{{ template "mariadb.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +subjects: +- kind: ServiceAccount + name: {{ template "mariadb.serviceAccountName" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ template "master.fullname" . }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/secrets.yaml b/bookstack/charts/mariadb/templates/secrets.yaml new file mode 100644 index 0000000..7d81e90 --- /dev/null +++ b/bookstack/charts/mariadb/templates/secrets.yaml @@ -0,0 +1,38 @@ +{{- if (not .Values.existingSecret) -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "mariadb.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + chart: "{{ template "mariadb.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +type: Opaque +data: + {{- if not (empty .Values.rootUser.password) }} + mariadb-root-password: "{{ .Values.rootUser.password | b64enc }}" + {{- else if (not .Values.rootUser.forcePassword) }} + mariadb-root-password: "{{ randAlphaNum 10 | b64enc }}" + {{ else }} + mariadb-root-password: {{ required "A MariaDB Root Password is required!" .Values.rootUser.password }} + {{- end }} + {{- if not (empty .Values.db.user) }} + {{- if not (empty .Values.db.password) }} + mariadb-password: "{{ .Values.db.password | b64enc }}" + {{- else if (not .Values.db.forcePassword) }} + mariadb-password: "{{ randAlphaNum 10 | b64enc }}" + {{- else }} + mariadb-password: {{ required "A MariaDB Database Password is required!" .Values.db.password }} + {{- end }} + {{- end }} + {{- if .Values.replication.enabled }} + {{- if not (empty .Values.replication.password) }} + mariadb-replication-password: "{{ .Values.replication.password | b64enc }}" + {{- else if (not .Values.replication.forcePassword) }} + mariadb-replication-password: "{{ randAlphaNum 10 | b64enc }}" + {{- else }} + mariadb-replication-password: {{ required "A MariaDB Replication Password is required!" .Values.replication.password }} + {{- end }} + {{- end }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/serviceaccount.yaml b/bookstack/charts/mariadb/templates/serviceaccount.yaml new file mode 100644 index 0000000..2d27739 --- /dev/null +++ b/bookstack/charts/mariadb/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "mariadb.serviceAccountName" . }} + labels: + app: "{{ template "mariadb.name" . }}" + chart: "{{ template "mariadb.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/servicemonitor.yaml b/bookstack/charts/mariadb/templates/servicemonitor.yaml new file mode 100644 index 0000000..65d71b6 --- /dev/null +++ b/bookstack/charts/mariadb/templates/servicemonitor.yaml @@ -0,0 +1,33 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "mariadb.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- end }} + labels: + app: "{{ template "mariadb.name" . }}" + chart: {{ template "mariadb.chart" . }} + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} + {{- range $key, $value := .Values.metrics.serviceMonitor.selector }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + selector: + matchLabels: + app: {{ template "mariadb.name" . }} + release: {{ .Release.Name | quote }} + endpoints: + - port: metrics + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/slave-configmap.yaml b/bookstack/charts/mariadb/templates/slave-configmap.yaml new file mode 100644 index 0000000..074568c --- /dev/null +++ b/bookstack/charts/mariadb/templates/slave-configmap.yaml @@ -0,0 +1,15 @@ +{{- if and .Values.replication.enabled .Values.slave.config }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "slave.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + component: "slave" + chart: "{{ template "mariadb.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +data: + my.cnf: |- +{{ .Values.slave.config | indent 4 }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/slave-pdb.yaml b/bookstack/charts/mariadb/templates/slave-pdb.yaml new file mode 100644 index 0000000..de36a08 --- /dev/null +++ b/bookstack/charts/mariadb/templates/slave-pdb.yaml @@ -0,0 +1,26 @@ +{{- if .Values.replication.enabled }} +{{- if .Values.slave.podDisruptionBudget.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "mariadb.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + component: "slave" + chart: {{ template "mariadb.chart" . }} + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +spec: +{{- if .Values.slave.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.slave.podDisruptionBudget.minAvailable }} +{{- end }} +{{- if .Values.slave.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.slave.podDisruptionBudget.maxUnavailable }} +{{- end }} + selector: + matchLabels: + app: "{{ template "mariadb.name" . }}" + component: "slave" + release: {{ .Release.Name | quote }} +{{- end }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/slave-statefulset.yaml b/bookstack/charts/mariadb/templates/slave-statefulset.yaml new file mode 100644 index 0000000..de506ed --- /dev/null +++ b/bookstack/charts/mariadb/templates/slave-statefulset.yaml @@ -0,0 +1,305 @@ +{{- if .Values.replication.enabled }} +apiVersion: {{ template "mariadb.statefulset.apiVersion" . }} +kind: StatefulSet +metadata: + name: {{ template "slave.fullname" . }} + labels: + app: {{ template "mariadb.name" . }} + chart: {{ template "mariadb.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: slave +spec: + selector: + matchLabels: + app: {{ template "mariadb.name" . }} + release: {{ .Release.Name }} + component: slave + serviceName: {{ template "slave.fullname" . }} + replicas: {{ .Values.slave.replicas }} + updateStrategy: + type: {{ .Values.slave.updateStrategy.type }} + {{- if (eq "Recreate" .Values.slave.updateStrategy.type) }} + rollingUpdate: null + {{- end }} + template: + metadata: + {{- if .Values.slave.annotations }} + annotations: + {{- range $key, $value := .Values.slave.annotations }} + {{ $key }}: {{ $value }} + {{- end }} + {{- end }} + labels: + app: {{ template "mariadb.name" . }} + chart: {{ template "mariadb.chart" . }} + release: {{ .Release.Name }} + component: slave + spec: + {{- if .Values.schedulerName }} + schedulerName: {{ .Values.schedulerName | quote }} + {{- end }} + serviceAccountName: {{ template "mariadb.serviceAccountName" . }} + {{- if .Values.securityContext.enabled }} + securityContext: + fsGroup: {{ .Values.securityContext.fsGroup }} + runAsUser: {{ .Values.securityContext.runAsUser }} + {{- end }} + {{- if eq .Values.slave.antiAffinity "hard" }} + affinity: + {{- with .Values.slave.affinity }} +{{ toYaml . | indent 8 }} + {{- end }} + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: "kubernetes.io/hostname" + labelSelector: + matchLabels: + app: {{ template "mariadb.name" . }} + release: {{ .Release.Name }} + {{- else if eq .Values.slave.antiAffinity "soft" }} + affinity: + {{- with .Values.slave.affinity }} +{{ toYaml . | indent 8 }} + {{- end }} + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + podAffinityTerm: + topologyKey: kubernetes.io/hostname + labelSelector: + matchLabels: + app: {{ template "mariadb.name" . }} + release: {{ .Release.Name }} + {{- else}} + {{- with .Values.slave.affinity }} + affinity: {{ toYaml . | nindent 8 }} + {{- end }} + {{- end }} + {{- if .Values.slave.nodeSelector }} + nodeSelector: {{ toYaml .Values.slave.nodeSelector | nindent 8 }} + {{- end -}} + {{- with .Values.slave.tolerations }} + tolerations: {{ toYaml . | nindent 8 }} + {{- end }} +{{- include "mariadb.imagePullSecrets" . | indent 6 }} + initContainers: + {{- if .Values.master.extraInitContainers }} +{{ tpl .Values.master.extraInitContainers . | indent 6}} + {{- end }} + {{- if and .Values.volumePermissions.enabled .Values.slave.persistence.enabled }} + - name: volume-permissions + image: {{ template "mariadb.volumePermissions.image" . }} + imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} + command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "/bitnami/mariadb"] + securityContext: + runAsUser: 0 + resources: {{ toYaml .Values.volumePermissions.resources | nindent 12 }} + volumeMounts: + - name: data + mountPath: /bitnami/mariadb + {{- end }} + containers: + - name: "mariadb" + image: {{ template "mariadb.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + env: + {{- if .Values.image.debug}} + - name: BITNAMI_DEBUG + value: "true" + {{- end }} + {{- if .Values.slave.extraFlags }} + - name: MARIADB_EXTRA_FLAGS + value: "{{ .Values.slave.extraFlags }}" + {{- end }} + - name: MARIADB_REPLICATION_MODE + value: "slave" + - name: MARIADB_MASTER_HOST + value: {{ template "mariadb.fullname" . }} + - name: MARIADB_MASTER_PORT_NUMBER + value: "{{ .Values.service.port }}" + - name: MARIADB_MASTER_ROOT_USER + value: "root" + {{- if .Values.rootUser.injectSecretsAsVolume }} + - name: MARIADB_MASTER_ROOT_PASSWORD_FILE + value: "/opt/bitnami/mariadb/secrets/mariadb-root-password" + {{- else }} + - name: MARIADB_MASTER_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.secretName" . }} + key: mariadb-root-password + {{- end }} + - name: MARIADB_REPLICATION_USER + value: "{{ .Values.replication.user }}" + {{- if .Values.replication.injectSecretsAsVolume }} + - name: MARIADB_REPLICATION_PASSWORD_FILE + value: "/opt/bitnami/mariadb/secrets/mariadb-replication-password" + {{- else }} + - name: MARIADB_REPLICATION_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.secretName" . }} + key: mariadb-replication-password + {{- end }} + {{- if .Values.slave.extraEnvVars }} + {{- tpl (toYaml .Values.slave.extraEnvVars) $ | nindent 12 }} + {{- end }} + ports: + - name: mysql + containerPort: 3306 + {{- if .Values.slave.livenessProbe.enabled }} + livenessProbe: + exec: + command: + - sh + - -c + - | + password_aux="${MARIADB_MASTER_ROOT_PASSWORD:-}" + if [ -f "${MARIADB_MASTER_ROOT_PASSWORD_FILE:-}" ]; then + password_aux=$(cat $MARIADB_MASTER_ROOT_PASSWORD_FILE) + fi + mysqladmin status -uroot -p$password_aux + initialDelaySeconds: {{ .Values.slave.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.slave.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.slave.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.slave.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.slave.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.slave.readinessProbe.enabled }} + readinessProbe: + exec: + command: + - sh + - -c + - | + password_aux="${MARIADB_MASTER_ROOT_PASSWORD:-}" + if [ -f "${MARIADB_MASTER_ROOT_PASSWORD_FILE:-}" ]; then + password_aux=$(cat $MARIADB_MASTER_ROOT_PASSWORD_FILE) + fi + mysqladmin status -uroot -p$password_aux + initialDelaySeconds: {{ .Values.slave.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.slave.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.slave.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.slave.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.slave.readinessProbe.failureThreshold }} + {{- end }} + {{- if .Values.slave.resources }} + resources: {{ toYaml .Values.slave.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: data + mountPath: /bitnami/mariadb + {{- if .Values.slave.config }} + - name: config + mountPath: /opt/bitnami/mariadb/conf/my.cnf + subPath: my.cnf + {{- end }} + {{- if or .Values.rootUser.injectSecretsAsVolume .Values.replication.injectSecretsAsVolume }} + - name: mariadb-credentials + mountPath: /opt/bitnami/mariadb/secrets/ + {{- end }} + {{- if .Values.metrics.enabled }} + - name: metrics + image: {{ template "mariadb.metrics.image" . }} + imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} + env: + {{- if .Values.rootUser.injectSecretsAsVolume }} + - name: MARIADB_ROOT_PASSWORD_FILE + value: "/opt/bitnami/mysqld-exporter/secrets/mariadb-root-password" + {{- else }} + - name: MARIADB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.secretName" . }} + key: mariadb-root-password + {{- end }} + command: + - sh + - -c + - | + password_aux="${MARIADB_ROOT_PASSWORD:-}" + if [ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]; then + password_aux=$(cat $MARIADB_ROOT_PASSWORD_FILE) + fi + DATA_SOURCE_NAME="root:${password_aux}@(localhost:3306)/" /bin/mysqld_exporter + {{- range .Values.metrics.extraArgs.slave }} + {{ . }} + {{- end }} + ports: + - name: metrics + containerPort: 9104 + {{- if .Values.metrics.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.metrics.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }} + {{- end }} + {{- if .Values.metrics.resources }} + resources: {{ toYaml .Values.metrics.resources | nindent 12 }} + {{- end }} + {{- if .Values.rootUser.injectSecretsAsVolume }} + volumeMounts: + - name: mariadb-credentials + mountPath: /opt/bitnami/mysqld-exporter/secrets/ + {{- end }} + {{- end }} + volumes: + {{- if .Values.slave.config }} + - name: config + configMap: + name: {{ template "slave.fullname" . }} + {{- end }} + {{- if or .Values.rootUser.injectSecretsAsVolume .Values.replication.injectSecretsAsVolume }} + - name: mariadb-credentials + secret: + secretName: {{ template "mariadb.fullname" . }} + items: + {{- if .Values.rootUser.injectSecretsAsVolume }} + - key: mariadb-root-password + path: mariadb-root-password + {{- end }} + {{- if .Values.replication.injectSecretsAsVolume }} + - key: mariadb-replication-password + path: mariadb-replication-password + {{- end }} + {{- end }} +{{- if not .Values.slave.persistence.enabled }} + - name: "data" + emptyDir: {} +{{- else }} + volumeClaimTemplates: + - metadata: + name: data + labels: + app: "{{ template "mariadb.name" . }}" + component: "slave" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} + spec: + accessModes: + {{- range .Values.slave.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.slave.persistence.size | quote }} + {{ include "mariadb.slave.storageClass" . }} +{{- end }} +{{- end }} diff --git a/bookstack/charts/mariadb/templates/slave-svc.yaml b/bookstack/charts/mariadb/templates/slave-svc.yaml new file mode 100644 index 0000000..4292f1b --- /dev/null +++ b/bookstack/charts/mariadb/templates/slave-svc.yaml @@ -0,0 +1,48 @@ +{{- if .Values.replication.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "slave.fullname" . }} + labels: + app: "{{ template "mariadb.name" . }}" + chart: "{{ template "mariadb.chart" . }}" + component: "slave" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +{{- if or .Values.metrics.enabled .Values.slave.service.annotations }} + annotations: +{{- if .Values.metrics.enabled }} +{{ toYaml .Values.metrics.annotations | indent 4 }} +{{- end }} +{{- if .Values.slave.service.annotations }} +{{ toYaml .Values.slave.service.annotations | indent 4 }} +{{- end }} +{{- end }} +spec: + type: {{ .Values.service.type }} + {{- if eq .Values.service.type "ClusterIP" }} + {{- if .Values.service.clusterIp }} + clusterIP: {{ .Values.service.clusterIp.slave }} + {{- end }} + {{- end }} + ports: + - name: mysql + port: {{ .Values.service.port }} + targetPort: mysql +{{- if (eq .Values.service.type "NodePort") }} +{{- if .Values.service.nodePort }} +{{- if .Values.service.nodePort.slave }} + nodePort: {{ .Values.service.nodePort.slave }} +{{- end }} +{{- end }} +{{- end }} +{{- if .Values.metrics.enabled }} + - name: metrics + port: 9104 + targetPort: metrics +{{- end }} + selector: + app: "{{ template "mariadb.name" . }}" + component: "slave" + release: "{{ .Release.Name }}" +{{- end }} diff --git a/bookstack/charts/mariadb/templates/test-runner.yaml b/bookstack/charts/mariadb/templates/test-runner.yaml new file mode 100644 index 0000000..11700ff --- /dev/null +++ b/bookstack/charts/mariadb/templates/test-runner.yaml @@ -0,0 +1,52 @@ +{{- if .Values.tests.enabled }} +apiVersion: v1 +kind: Pod +metadata: + name: "{{ template "mariadb.fullname" . }}-test-{{ randAlphaNum 5 | lower }}" + annotations: + "helm.sh/hook": test-success +spec: + initContainers: + - name: "test-framework" + image: {{ template "mariadb.tests.testFramework.image" . }} + command: + - "bash" + - "-c" + - | + set -ex + # copy bats to tools dir + cp -R /usr/local/libexec/ /tools/bats/ + {{- if .Values.tests.testFramework.resources }} + resources: {{ toYaml .Values.tests.testFramework.resources | nindent 8 }} + {{- end }} + volumeMounts: + - mountPath: /tools + name: tools + containers: + - name: mariadb-test + image: {{ template "mariadb.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + command: ["/tools/bats/bats", "-t", "/tests/run.sh"] + env: + - name: MARIADB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mariadb.secretName" . }} + key: mariadb-root-password + {{- if .Values.tests.resources }} + resources: {{ toYaml .Values.tests.resources | nindent 8 }} + {{- end }} + volumeMounts: + - mountPath: /tests + name: tests + readOnly: true + - mountPath: /tools + name: tools + volumes: + - name: tests + configMap: + name: {{ template "mariadb.fullname" . }}-tests + - name: tools + emptyDir: {} + restartPolicy: Never +{{- end }} diff --git a/bookstack/charts/mariadb/templates/tests.yaml b/bookstack/charts/mariadb/templates/tests.yaml new file mode 100644 index 0000000..924f99c --- /dev/null +++ b/bookstack/charts/mariadb/templates/tests.yaml @@ -0,0 +1,11 @@ +{{- if .Values.tests.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "mariadb.fullname" . }}-tests +data: + run.sh: |- + @test "Testing MariaDB is accessible" { + mysql -h {{ template "mariadb.fullname" . }} -uroot -p$MARIADB_ROOT_PASSWORD -e 'show databases;' + } +{{- end }} diff --git a/bookstack/charts/mariadb/values-production.yaml b/bookstack/charts/mariadb/values-production.yaml new file mode 100644 index 0000000..47293f4 --- /dev/null +++ b/bookstack/charts/mariadb/values-production.yaml @@ -0,0 +1,562 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Use an alternate scheduler, e.g. "stork". +## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ +## +# schedulerName: + +## Bitnami MariaDB image +## ref: https://hub.docker.com/r/bitnami/mariadb/tags/ +## +image: + registry: docker.io + repository: bitnami/mariadb + tag: 10.3.22-debian-10-r27 + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + + ## Set to true if you would like to see extra information on logs + ## It turns BASH and NAMI debugging in minideb + ## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging + debug: false + +## String to partially override mariadb.fullname template (will maintain the release name) +## +# nameOverride: + +## String to fully override mariadb.fullname template +## +# fullnameOverride: + +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/minideb + tag: buster + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + resources: {} + +service: + ## Kubernetes service type, ClusterIP and NodePort are supported at present + type: ClusterIP + # clusterIp: + # master: xx.xx.xx.xx + # slave: xx.xx.xx.xx + port: 3306 + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + # master: 30001 + # slave: 30002 + +## Pods Service Account +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ +serviceAccount: + ## Specifies whether a ServiceAccount should be created + ## + create: false + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the mariadb.fullname template + # name: + +## Role Based Access +## Ref: https://kubernetes.io/docs/admin/authorization/rbac/ +## +rbac: + create: false + +## Pod Security Context +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ +## +securityContext: + enabled: true + fsGroup: 1001 + runAsUser: 1001 + +## Use existing secret (ignores root, db and replication passwords) +## +# existingSecret: + +## MariaDB admin credentials +## +rootUser: + ## MariaDB admin password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#setting-the-root-password-on-first-run + ## + password: "" + ## Option to force users to specify a password. That is required for 'helm upgrade' to work properly. + ## If it is not force, a random password will be generated. + ## + forcePassword: true + ## Mount admin password as a file instead of using an environment variable + ## + injectSecretsAsVolume: true + +## Custom user/db credentials +## +db: + ## MariaDB username and password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#creating-a-database-user-on-first-run + ## + user: "" + password: "" + ## Database to create + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#creating-a-database-on-first-run + ## + name: my_database + ## Option to force users to specify a password. That is required for 'helm upgrade' to work properly. + ## If it is not force, a random password will be generated. + ## + forcePassword: true + ## Mount user password as a file instead of using an environment variable + ## + injectSecretsAsVolume: true + +## Replication configuration +## +replication: + ## Enable replication. This enables the creation of replicas of MariaDB. If false, only a + ## master deployment would be created + ## + enabled: true + ## MariaDB replication user + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#setting-up-a-replication-cluster + ## + user: replicator + ## MariaDB replication user password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#setting-up-a-replication-cluster + ## + password: "" + ## Option to force users to specify a password. That is required for 'helm upgrade' to work properly. + ## If it is not force, a random password will be generated. + ## + forcePassword: true + ## Mount replication user password as a file instead of using an environment variable + ## + injectSecretsAsVolume: true + +## initdb scripts +## Specify dictionary of scripts to be run at first boot +## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory +## +# initdbScripts: +# my_init_script.sh: | +# #!/bin/sh +# echo "Do something." +# +## ConfigMap with scripts to be run at first boot +## Note: This will override initdbScripts +# initdbScriptsConfigMap: + +master: + ## Mariadb Master additional pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + # annotations: + # key: value + # another-key: another-value + + ## MariaDB additional command line flags + ## Can be used to specify command line flags, for example: + ## + ## extraFlags: "--max-connect-errors=1000 --max_connections=155" + + ## Affinity for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + + ## Kept for backwards compatibility. You can now disable it by removing it. + ## if you wish to set it through master.affinity.podAntiAffinity instead. + ## + antiAffinity: soft + + ## Node labels for pod assignment + ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + ## Tolerations for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + ## updateStrategy for MariaDB Master StatefulSet + ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies + updateStrategy: + type: RollingUpdate + + ## Enable persistence using Persistent Volume Claims + ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + persistence: + ## If true, use a Persistent Volume Claim, If false, use emptyDir + ## + enabled: true + # Enable persistence using an existing PVC + # existingClaim: + # Subdirectory of the volume to mount + # subPath: + mountPath: /bitnami/mariadb + ## 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: "-" + ## Persistent Volume Claim annotations + ## + annotations: {} + ## Persistent Volume Access Mode + ## + accessModes: + - ReadWriteOnce + ## Persistent Volume size + ## + size: 8Gi + + extraInitContainers: | + # - name: do-something + # image: busybox + # command: ['do', 'something'] + + ## An array to add extra environment variables + ## For example: + ## extraEnvVars: + ## - name: TZ + ## value: "Europe/Paris" + ## + # extraEnvVars: + + ## Configure MySQL with a custom my.cnf file + ## ref: https://mysql.com/kb/en/mysql/configuring-mysql-with-mycnf/#example-of-configuration-file + ## + config: |- + [mysqld] + skip-name-resolve + explicit_defaults_for_timestamp + basedir=/opt/bitnami/mariadb + plugin_dir=/opt/bitnami/mariadb/plugin + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + tmpdir=/opt/bitnami/mariadb/tmp + max_allowed_packet=16M + bind-address=0.0.0.0 + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + log-error=/opt/bitnami/mariadb/logs/mysqld.log + character-set-server=UTF8 + collation-server=utf8_general_ci + + [client] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + default-character-set=UTF8 + plugin_dir=/opt/bitnami/mariadb/plugin + + [manager] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + + ## Configure master resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: {} + livenessProbe: + enabled: true + ## + ## Initializing the database could take some time + initialDelaySeconds: 120 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + enabled: true + initialDelaySeconds: 30 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 + + ## Allow customization of the service resource + ## + service: + ## Add custom annotations to the service + ## + annotations: {} + +slave: + replicas: 2 + + ## Mariadb Slave additional pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + # annotations: + # key: value + # another-key: another-value + + ## MariaDB additional command line flags + ## Can be used to specify command line flags, for example: + ## + ## extraFlags: --max-connect-errors=1000 --max_connections=155" + + ## Affinity for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + + ## Kept for backwards compatibility. You can now disable it by removing it. + ## if you wish to set it through slave.affinity.podAntiAffinity instead. + ## + antiAffinity: soft + + ## Node labels for pod assignment + ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + ## Tolerations for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + ## updateStrategy for MariaDB Slave StatefulSet + ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies + updateStrategy: + type: RollingUpdate + + persistence: + ## If true, use a Persistent Volume Claim, If false, use emptyDir + ## + enabled: true + # storageClass: "-" + annotations: + accessModes: + - ReadWriteOnce + ## Persistent Volume size + ## + size: 8Gi + + extraInitContainers: | + # - name: do-something + # image: busybox + # command: ['do', 'something'] + + ## An array to add extra environment variables + ## For example: + ## extraEnvVars: + ## - name: TZ + ## value: "Europe/Paris" + ## + # extraEnvVars: + + ## Configure MySQL slave with a custom my.cnf file + ## ref: https://mysql.com/kb/en/mysql/configuring-mysql-with-mycnf/#example-of-configuration-file + ## + config: |- + [mysqld] + skip-name-resolve + explicit_defaults_for_timestamp + basedir=/opt/bitnami/mariadb + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + tmpdir=/opt/bitnami/mariadb/tmp + max_allowed_packet=16M + bind-address=0.0.0.0 + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + log-error=/opt/bitnami/mariadb/logs/mysqld.log + character-set-server=UTF8 + collation-server=utf8_general_ci + + [client] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + default-character-set=UTF8 + + [manager] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + + ## + ## Configure slave resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: {} + livenessProbe: + enabled: true + ## + ## Initializing the database could take some time + initialDelaySeconds: 120 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + enabled: true + initialDelaySeconds: 45 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 + + ## Allow customization of the service resource + ## + service: + ## Add custom annotations to the service + ## + annotations: {} + +metrics: + enabled: true + image: + registry: docker.io + repository: bitnami/mysqld-exporter + tag: 0.12.1-debian-10-r27 + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + resources: {} + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9104" + + ## Extra args to be passed to mysqld_exporter + ## ref: https://github.com/prometheus/mysqld_exporter/ + ## + extraArgs: + master: [] + slave: [] + # - --collect.auto_increment.columns + # - --collect.binlog_size + # - --collect.engine_innodb_status + # - --collect.engine_tokudb_status + # - --collect.global_status + # - --collect.global_variables + # - --collect.info_schema.clientstats + # - --collect.info_schema.innodb_metrics + # - --collect.info_schema.innodb_tablespaces + # - --collect.info_schema.innodb_cmp + # - --collect.info_schema.innodb_cmpmem + # - --collect.info_schema.processlist + # - --collect.info_schema.processlist.min_time + # - --collect.info_schema.query_response_time + # - --collect.info_schema.tables + # - --collect.info_schema.tables.databases + # - --collect.info_schema.tablestats + # - --collect.info_schema.userstats + # - --collect.perf_schema.eventsstatements + # - --collect.perf_schema.eventsstatements.digest_text_limit + # - --collect.perf_schema.eventsstatements.limit + # - --collect.perf_schema.eventsstatements.timelimit + # - --collect.perf_schema.eventswaits + # - --collect.perf_schema.file_events + # - --collect.perf_schema.file_instances + # - --collect.perf_schema.indexiowaits + # - --collect.perf_schema.tableiowaits + # - --collect.perf_schema.tablelocks + # - --collect.perf_schema.replication_group_member_stats + # - --collect.slave_status + # - --collect.slave_hosts + # - --collect.heartbeat + # - --collect.heartbeat.database + # - --collect.heartbeat.table + + livenessProbe: + enabled: true + ## + ## Initializing the database could take some time + initialDelaySeconds: 120 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + enabled: true + initialDelaySeconds: 30 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + + # Enable this if you're using https://github.com/coreos/prometheus-operator + serviceMonitor: + enabled: false + ## Specify a namespace if needed + # namespace: monitoring + # fallback to the prometheus default unless specified + # interval: 10s + # scrapeTimeout: 10s + ## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr) + ## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1) + ## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters) + selector: + prometheus: kube-prometheus + +## Bats Framework (= Bash Automated Testing System) is needed to test if MariaDB is accessible +## See test-runner.yaml and tests.yaml for details. +## To run the tests after the deployment, enter "helm test ". +tests: + enabled: true + # resources: {} + testFramework: + image: + registry: docker.io + repository: dduportal/bats + tag: 0.4.0 + # resources: {} diff --git a/bookstack/charts/mariadb/values.schema.json b/bookstack/charts/mariadb/values.schema.json new file mode 100644 index 0000000..ad28ce8 --- /dev/null +++ b/bookstack/charts/mariadb/values.schema.json @@ -0,0 +1,169 @@ +{ + "$schema": "http://json-schema.org/schema#", + "type": "object", + "properties": { + "rootUser": { + "type": "object", + "properties": { + "password": { + "type": "string", + "title": "MariaDB admin password", + "form": true, + "description": "Defaults to a random 10-character alphanumeric string if not set", + "hidden": { + "condition": false, + "value": "usePassword" + } + } + } + }, + "db": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "MariaDB custom database", + "description": "Name of the custom database to be created during the 1st initialization of MariaDB", + "form": true + }, + "user": { + "type": "string", + "title": "MariaDB custom user", + "description": "Name of the custom user to be created during the 1st initialization of MariaDB. This user only has permissions on the MariaDB custom database", + "form": true + }, + "password": { + "type": "string", + "title": "Password for MariaDB custom user", + "form": true, + "description": "Defaults to a random 10-character alphanumeric string if not set", + "hidden": { + "condition": false, + "value": "usePassword" + } + } + } + }, + "replication": { + "type": "object", + "title": "Replication configuration", + "form": true, + "properties": { + "enabled": { + "type": "boolean", + "form": true, + "title": "Enable replication configuration" + } + } + }, + "master": { + "type": "object", + "title": "Master replicas settings", + "form": true, + "properties": { + "persistence": { + "type": "object", + "title": "Persistence for master replicas", + "form": true, + "properties": { + "enabled": { + "type": "boolean", + "form": true, + "title": "Enable persistence", + "description": "Enable persistence using Persistent Volume Claims" + }, + "size": { + "type": "string", + "title": "Persistent Volume Size", + "form": true, + "render": "slider", + "sliderMin": 1, + "sliderMax": 100, + "sliderUnit": "Gi", + "hidden": { + "condition": false, + "value": "persistence.enabled" + } + } + } + } + } + }, + "slave": { + "type": "object", + "title": "Slave replicas settings", + "form": true, + "hidden": { + "condition": false, + "value": "replication.enabled" + }, + "properties": { + "persistence": { + "type": "object", + "title": "Persistence for slave replicas", + "form": true, + "properties": { + "enabled": { + "type": "boolean", + "form": true, + "title": "Enable persistence", + "description": "Enable persistence using Persistent Volume Claims" + }, + "size": { + "type": "string", + "title": "Persistent Volume Size", + "form": true, + "render": "slider", + "sliderMin": 1, + "sliderMax": 100, + "sliderUnit": "Gi", + "hidden": { + "condition": false, + "value": "persistence.enabled" + } + } + } + } + } + }, + "volumePermissions": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "form": true, + "title": "Enable Init Containers", + "description": "Use an init container to set required folder permissions on the data volume before mounting it in the final destination" + } + } + }, + "metrics": { + "type": "object", + "form": true, + "title": "Prometheus metrics details", + "properties": { + "enabled": { + "type": "boolean", + "title": "Create Prometheus metrics exporter", + "description": "Create a side-car container to expose Prometheus metrics", + "form": true + }, + "serviceMonitor": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "title": "Create Prometheus Operator ServiceMonitor", + "description": "Create a ServiceMonitor to track metrics using Prometheus Operator", + "form": true, + "hidden": { + "condition": false, + "value": "metrics.enabled" + } + } + } + } + } + } + } +} diff --git a/bookstack/charts/mariadb/values.yaml b/bookstack/charts/mariadb/values.yaml new file mode 100644 index 0000000..afacee1 --- /dev/null +++ b/bookstack/charts/mariadb/values.yaml @@ -0,0 +1,564 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Use an alternate scheduler, e.g. "stork". +## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ +## +# schedulerName: + +## Bitnami MariaDB image +## ref: https://hub.docker.com/r/bitnami/mariadb/tags/ +## +image: + registry: docker.io + repository: bitnami/mariadb + tag: 10.3.22-debian-10-r27 + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + + ## Set to true if you would like to see extra information on logs + ## It turns BASH and NAMI debugging in minideb + ## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging + debug: false + +## String to partially override mariadb.fullname template (will maintain the release name) +## +# nameOverride: + +## String to fully override mariadb.fullname template +## +# fullnameOverride: + +## Init containers parameters: +## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section. +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/minideb + tag: buster + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + resources: {} + +service: + ## Kubernetes service type, ClusterIP and NodePort are supported at present + type: ClusterIP + # clusterIp: + # master: xx.xx.xx.xx + # slave: xx.xx.xx.xx + port: 3306 + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + # master: 30001 + # slave: 30002 + +## Pods Service Account +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ +serviceAccount: + ## Specifies whether a ServiceAccount should be created + ## + create: false + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the mariadb.fullname template + # name: + +## Role Based Access +## Ref: https://kubernetes.io/docs/admin/authorization/rbac/ +## +rbac: + create: false + +## Pod Security Context +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ +## +securityContext: + enabled: true + fsGroup: 1001 + runAsUser: 1001 + +## Use existing secret (ignores root, db and replication passwords) +## +# existingSecret: + +## MariaDB admin credentials +## +rootUser: + ## MariaDB admin password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#setting-the-root-password-on-first-run + ## + password: "" + ## Option to force users to specify a password. That is required for 'helm upgrade' to work properly. + ## If it is not force, a random password will be generated. + ## + forcePassword: false + ## Mount admin password as a file instead of using an environment variable + ## + injectSecretsAsVolume: false + +## Custom user/db credentials +## +db: + ## MariaDB username and password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#creating-a-database-user-on-first-run + ## + user: "" + password: "" + ## Database to create + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#creating-a-database-on-first-run + ## + name: my_database + ## Option to force users to specify a password. That is required for 'helm upgrade' to work properly. + ## If it is not force, a random password will be generated. + ## + forcePassword: false + ## Mount user password as a file instead of using an environment variable + ## + injectSecretsAsVolume: false + +## Replication configuration +## +replication: + ## Enable replication. This enables the creation of replicas of MariaDB. If false, only a + ## master deployment would be created + ## + enabled: true + ## MariaDB replication user + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#setting-up-a-replication-cluster + ## + user: replicator + ## MariaDB replication user password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#setting-up-a-replication-cluster + ## + password: "" + ## Option to force users to specify a password. That is required for 'helm upgrade' to work properly. + ## If it is not force, a random password will be generated. + ## + forcePassword: false + ## Mount replication user password as a file instead of using an environment variable + ## + injectSecretsAsVolume: false + +## initdb scripts +## Specify dictionary of scripts to be run at first boot +## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory +## +# initdbScripts: +# my_init_script.sh: | +# #!/bin/sh +# echo "Do something." +# +## ConfigMap with scripts to be run at first boot +## Note: This will override initdbScripts +# initdbScriptsConfigMap: + +master: + ## Mariadb Master additional pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + # annotations: + # key: value + # another-key: another-value + + ## MariaDB additional command line flags + ## Can be used to specify command line flags, for example: + ## + ## extraFlags: "--max-connect-errors=1000 --max_connections=155" + + ## Affinity for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + + ## Kept for backwards compatibility. You can now disable it by removing it. + ## if you wish to set it through master.affinity.podAntiAffinity instead. + ## + antiAffinity: soft + + ## Node labels for pod assignment + ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + ## Tolerations for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + ## updateStrategy for MariaDB Master StatefulSet + ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies + updateStrategy: + type: RollingUpdate + + ## Enable persistence using Persistent Volume Claims + ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + persistence: + ## If true, use a Persistent Volume Claim, If false, use emptyDir + ## + enabled: true + # Enable persistence using an existing PVC + # existingClaim: + # Subdirectory of the volume to mount + # subPath: + mountPath: /bitnami/mariadb + ## 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: "-" + ## Persistent Volume Claim annotations + ## + annotations: {} + ## Persistent Volume Access Mode + ## + accessModes: + - ReadWriteOnce + ## Persistent Volume size + ## + size: 8Gi + + extraInitContainers: | + # - name: do-something + # image: busybox + # command: ['do', 'something'] + + ## An array to add extra environment variables + ## For example: + ## extraEnvVars: + ## - name: TZ + ## value: "Europe/Paris" + ## + # extraEnvVars: + + ## Configure MySQL with a custom my.cnf file + ## ref: https://mysql.com/kb/en/mysql/configuring-mysql-with-mycnf/#example-of-configuration-file + ## + config: |- + [mysqld] + skip-name-resolve + explicit_defaults_for_timestamp + basedir=/opt/bitnami/mariadb + plugin_dir=/opt/bitnami/mariadb/plugin + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + tmpdir=/opt/bitnami/mariadb/tmp + max_allowed_packet=16M + bind-address=0.0.0.0 + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + log-error=/opt/bitnami/mariadb/logs/mysqld.log + character-set-server=UTF8 + collation-server=utf8_general_ci + + [client] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + default-character-set=UTF8 + plugin_dir=/opt/bitnami/mariadb/plugin + + [manager] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + + ## Configure master resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: {} + livenessProbe: + enabled: true + ## + ## Initializing the database could take some time + initialDelaySeconds: 120 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + enabled: true + initialDelaySeconds: 30 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 + + ## Allow customization of the service resource + ## + service: + ## Add custom annotations to the service + ## + annotations: {} + # external-dns.alpha.kubernetes.io/hostname: db.example.com + +slave: + replicas: 1 + + ## Mariadb Slave additional pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + # annotations: + # key: value + # another-key: another-value + + ## MariaDB additional command line flags + ## Can be used to specify command line flags, for example: + ## + ## extraFlags: "--max-connect-errors=1000 --max_connections=155" + + ## Affinity for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + + ## Kept for backwards compatibility. You can now disable it by removing it. + ## if you wish to set it through slave.affinity.podAntiAffinity instead. + ## + antiAffinity: soft + + ## Node labels for pod assignment + ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + ## Tolerations for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + ## updateStrategy for MariaDB Slave StatefulSet + ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies + updateStrategy: + type: RollingUpdate + + persistence: + ## If true, use a Persistent Volume Claim, If false, use emptyDir + ## + enabled: true + # storageClass: "-" + annotations: + accessModes: + - ReadWriteOnce + ## Persistent Volume size + ## + size: 8Gi + + extraInitContainers: | + # - name: do-something + # image: busybox + # command: ['do', 'something'] + + ## An array to add extra environment variables + ## For example: + ## extraEnvVars: + ## - name: TZ + ## value: "Europe/Paris" + ## + # extraEnvVars: + + ## Configure MySQL slave with a custom my.cnf file + ## ref: https://mysql.com/kb/en/mysql/configuring-mysql-with-mycnf/#example-of-configuration-file + ## + config: |- + [mysqld] + skip-name-resolve + explicit_defaults_for_timestamp + basedir=/opt/bitnami/mariadb + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + tmpdir=/opt/bitnami/mariadb/tmp + max_allowed_packet=16M + bind-address=0.0.0.0 + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + log-error=/opt/bitnami/mariadb/logs/mysqld.log + character-set-server=UTF8 + collation-server=utf8_general_ci + + [client] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + default-character-set=UTF8 + + [manager] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + + ## + ## Configure slave resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: {} + livenessProbe: + enabled: true + ## + ## Initializing the database could take some time + initialDelaySeconds: 120 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + enabled: true + initialDelaySeconds: 45 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 + + ## Allow customization of the service resource + ## + service: + ## Add custom annotations to the service + ## + annotations: {} + # external-dns.alpha.kubernetes.io/hostname: rodb.example.com + +metrics: + enabled: false + image: + registry: docker.io + repository: bitnami/mysqld-exporter + tag: 0.12.1-debian-10-r27 + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + resources: {} + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9104" + + ## Extra args to be passed to mysqld_exporter + ## ref: https://github.com/prometheus/mysqld_exporter/ + ## + extraArgs: + master: [] + slave: [] + # - --collect.auto_increment.columns + # - --collect.binlog_size + # - --collect.engine_innodb_status + # - --collect.engine_tokudb_status + # - --collect.global_status + # - --collect.global_variables + # - --collect.info_schema.clientstats + # - --collect.info_schema.innodb_metrics + # - --collect.info_schema.innodb_tablespaces + # - --collect.info_schema.innodb_cmp + # - --collect.info_schema.innodb_cmpmem + # - --collect.info_schema.processlist + # - --collect.info_schema.processlist.min_time + # - --collect.info_schema.query_response_time + # - --collect.info_schema.tables + # - --collect.info_schema.tables.databases + # - --collect.info_schema.tablestats + # - --collect.info_schema.userstats + # - --collect.perf_schema.eventsstatements + # - --collect.perf_schema.eventsstatements.digest_text_limit + # - --collect.perf_schema.eventsstatements.limit + # - --collect.perf_schema.eventsstatements.timelimit + # - --collect.perf_schema.eventswaits + # - --collect.perf_schema.file_events + # - --collect.perf_schema.file_instances + # - --collect.perf_schema.indexiowaits + # - --collect.perf_schema.tableiowaits + # - --collect.perf_schema.tablelocks + # - --collect.perf_schema.replication_group_member_stats + # - --collect.slave_status + # - --collect.slave_hosts + # - --collect.heartbeat + # - --collect.heartbeat.database + # - --collect.heartbeat.table + + livenessProbe: + enabled: true + ## + ## Initializing the database could take some time + initialDelaySeconds: 120 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + enabled: true + initialDelaySeconds: 30 + ## + ## Default Kubernetes values + periodSeconds: 10 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 3 + + # Enable this if you're using https://github.com/coreos/prometheus-operator + serviceMonitor: + enabled: false + ## Specify a namespace if needed + # namespace: monitoring + # fallback to the prometheus default unless specified + # interval: 10s + # scrapeTimeout: 10s + ## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr) + ## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1) + ## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters) + selector: + prometheus: kube-prometheus + +## Bats Framework (= Bash Automated Testing System) is needed to test if MariaDB is accessible +## See test-runner.yaml and tests.yaml for details. +## To run the tests after the deployment, enter "helm test ". +tests: + enabled: true + # resources: {} + testFramework: + image: + registry: docker.io + repository: dduportal/bats + tag: 0.4.0 + # resources: {} diff --git a/bookstack/requirements.lock b/bookstack/requirements.lock new file mode 100644 index 0000000..252149c --- /dev/null +++ b/bookstack/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: mariadb + repository: https://charts.helm.sh/stable + version: 7.3.14 +digest: sha256:23bd9bdd5a8b36e7c0008fd821060cae946da3887a8a29c6fd8974257e17b27e +generated: "2020-11-11T18:49:42.066005386Z" diff --git a/bookstack/requirements.yaml b/bookstack/requirements.yaml new file mode 100644 index 0000000..05483dd --- /dev/null +++ b/bookstack/requirements.yaml @@ -0,0 +1,5 @@ +dependencies: +- name: mariadb + version: 7.3.14 + repository: https://charts.helm.sh/stable + condition: mariadb.enabled diff --git a/bookstack/templates/NOTES.txt b/bookstack/templates/NOTES.txt new file mode 100644 index 0000000..4ea31ae --- /dev/null +++ b/bookstack/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "bookstack.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "bookstack.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "bookstack.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "bookstack.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/bookstack/templates/_helpers.tpl b/bookstack/templates/_helpers.tpl new file mode 100644 index 0000000..4699750 --- /dev/null +++ b/bookstack/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "bookstack.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 "bookstack.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 chart name and version as used by the chart label. +*/}} +{{- define "bookstack.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "bookstack.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "bookstack.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- 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 "bookstack.mariadb.fullname" -}} +{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/bookstack/templates/app-secrets.yaml b/bookstack/templates/app-secrets.yaml new file mode 100644 index 0000000..1eafcc5 --- /dev/null +++ b/bookstack/templates/app-secrets.yaml @@ -0,0 +1,14 @@ +{{- if .Values.app.key }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ printf "%s-%s" .Release.Name "app" }} + labels: + app: {{ printf "%s-%s" .Release.Name "app" }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + app-key: {{ .Values.app.key | b64enc | quote }} +{{- end }} diff --git a/bookstack/templates/deployment.yaml b/bookstack/templates/deployment.yaml new file mode 100644 index 0000000..cd0c5d5 --- /dev/null +++ b/bookstack/templates/deployment.yaml @@ -0,0 +1,127 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "bookstack.fullname" . }} + labels: + app: {{ template "bookstack.name" . }} + chart: {{ template "bookstack.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "bookstack.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "bookstack.name" . }} + release: {{ .Release.Name }} + spec: + serviceAccountName: {{ template "bookstack.serviceAccountName" . }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 8080 + protocol: TCP + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: / + port: http + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: / + port: http + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + {{- end }} + env: + {{- if .Values.ldap.enabled }} + - name: AUTH_METHOD + value: ldap + - name: LDAP_SERVER + value: {{ .Values.ldap.server | quote }} + - name: LDAP_BASE_DN + value: {{ .Values.ldap.base_dn | quote }} + - name: LDAP_DN + value: {{ .Values.ldap.dn | quote }} + - name: LDAP_PASS + value: {{ .Values.ldap.pass | quote }} + - name: LDAP_USER_FILTER + value: {{ .Values.ldap.userFilter | quote }} + - name: LDAP_VERSION + value: {{ .Values.ldap.version | quote }} + {{- end }} + {{- if .Values.mariadb.enabled }} + - name: DB_HOST + value: {{ template "bookstack.mariadb.fullname" . }} + - name: DB_DATABASE + value: {{ .Values.mariadb.db.name | quote }} + - name: DB_USERNAME + value: {{ .Values.mariadb.db.user | quote }} + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "bookstack.mariadb.fullname" . }} + key: mariadb-password + {{- else }} + - name: DB_HOST + value: {{ .Values.externalDatabase.host | quote }} + - name: DB_DATABASE + value: {{ .Values.externalDatabase.database | quote }} + - name: DB_USERNAME + value: {{ .Values.externalDatabase.user | quote }} + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ printf "%s-%s" .Release.Name "externaldb" }} + key: db-password + {{- end }} + {{- if .Values.app.key }} + - name: APP_KEY + valueFrom: + secretKeyRef: + name: {{ printf "%s-%s" .Release.Name "app" }} + key: app-key + {{- end }} + {{- range $key, $value := .Values.env }} + - name: {{ $key | upper | replace "." "_" }} + value: {{ $value | quote }} + {{- end }} + volumeMounts: + - name: uploads + mountPath: /var/www/bookstack/public/uploads + - name: storage + mountPath: /var/www/bookstack/storage/uploads + resources: +{{ toYaml .Values.resources | indent 12 }} + volumes: + - name: uploads + {{- if .Values.persistence.uploads.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.uploads.existingClaim | default (printf "%s-%s" (include "bookstack.fullname" .) "uploads") }} + {{- else }} + emptyDir: {} + {{- end }} + - name: storage + {{- if .Values.persistence.storage.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.storage.existingClaim | default (printf "%s-%s" (include "bookstack.fullname" .) "storage") }} + {{- else }} + emptyDir: {} + {{- end -}} diff --git a/bookstack/templates/externaldb-secrets.yaml b/bookstack/templates/externaldb-secrets.yaml new file mode 100644 index 0000000..4ceb148 --- /dev/null +++ b/bookstack/templates/externaldb-secrets.yaml @@ -0,0 +1,14 @@ +{{- if not .Values.mariadb.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ printf "%s-%s" .Release.Name "externaldb" }} + labels: + app: {{ printf "%s-%s" .Release.Name "externaldb" }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} +{{- end }} \ No newline at end of file diff --git a/bookstack/templates/ingress.yaml b/bookstack/templates/ingress.yaml new file mode 100644 index 0000000..066e450 --- /dev/null +++ b/bookstack/templates/ingress.yaml @@ -0,0 +1,38 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "bookstack.fullname" . -}} +{{- $ingressPath := .Values.ingress.path -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app: {{ template "bookstack.name" . }} + chart: {{ template "bookstack.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/bookstack/templates/podsecuritypolicy.yaml b/bookstack/templates/podsecuritypolicy.yaml new file mode 100644 index 0000000..1d58939 --- /dev/null +++ b/bookstack/templates/podsecuritypolicy.yaml @@ -0,0 +1,33 @@ +{{- if .Values.podSecurityPolicy.enabled }} +apiVersion: extensions/v1beta1 +kind: PodSecurityPolicy +metadata: + name: {{ template "bookstack.fullname" . }} + labels: + app: {{ template "bookstack.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +spec: + privileged: false + allowPrivilegeEscalation: false + volumes: + - 'configMap' + - 'downwardAPI' + - 'emptyDir' + - 'persistentVolumeClaim' + - 'secret' + - 'projected' + hostNetwork: false + hostIPC: false + hostPID: false + runAsUser: + rule: 'RunAsAny' + seLinux: + rule: 'RunAsAny' + supplementalGroups: + rule: 'RunAsAny' + fsGroup: + rule: 'RunAsAny' + readOnlyRootFilesystem: false +{{- end }} diff --git a/bookstack/templates/role.yaml b/bookstack/templates/role.yaml new file mode 100644 index 0000000..1c6b56a --- /dev/null +++ b/bookstack/templates/role.yaml @@ -0,0 +1,21 @@ +{{- if .Values.rbac.create }} +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ template "bookstack.fullname" . }} + labels: + app: {{ template "bookstack.name" . }} + chart: {{ template "bookstack.chart" . }} + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +rules: +- apiGroups: [""] + resources: ["endpoints"] + verbs: ["get"] +{{- if .Values.podSecurityPolicy.enabled }} +- apiGroups: ['extensions'] + resources: ['podsecuritypolicies'] + verbs: ['use'] + resourceNames: [{{ template "bookstack.fullname" . }}] +{{- end }} +{{- end }} diff --git a/bookstack/templates/rolebinding.yaml b/bookstack/templates/rolebinding.yaml new file mode 100644 index 0000000..6daa8ca --- /dev/null +++ b/bookstack/templates/rolebinding.yaml @@ -0,0 +1,18 @@ +{{- if .Values.rbac.create }} +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ template "bookstack.fullname" . }} + labels: + app: {{ template "bookstack.name" . }} + chart: {{ template "bookstack.chart" . }} + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +subjects: +- kind: ServiceAccount + name: {{ template "bookstack.serviceAccountName" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ template "bookstack.fullname" . }} +{{- end }} diff --git a/bookstack/templates/service.yaml b/bookstack/templates/service.yaml new file mode 100644 index 0000000..c7b867e --- /dev/null +++ b/bookstack/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "bookstack.fullname" . }} + labels: + app: {{ template "bookstack.name" . }} + chart: {{ template "bookstack.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app: {{ template "bookstack.name" . }} + release: {{ .Release.Name }} diff --git a/bookstack/templates/serviceaccount.yaml b/bookstack/templates/serviceaccount.yaml new file mode 100644 index 0000000..319195b --- /dev/null +++ b/bookstack/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{ if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: {{ template "bookstack.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "bookstack.serviceAccountName" . }} +{{- end -}} diff --git a/bookstack/templates/storage-pvc.yaml b/bookstack/templates/storage-pvc.yaml new file mode 100644 index 0000000..15df847 --- /dev/null +++ b/bookstack/templates/storage-pvc.yaml @@ -0,0 +1,24 @@ +{{- if and .Values.persistence.storage.enabled (not .Values.persistence.storage.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "bookstack.fullname" . }}-storage + labels: + app: {{ template "bookstack.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + accessModes: + - {{ .Values.persistence.storage.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.storage.size | quote }} +{{- if .Values.persistence.storage.storageClass }} +{{- if (eq "-" .Values.persistence.storage.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storage.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/bookstack/templates/uploads-pvc.yaml b/bookstack/templates/uploads-pvc.yaml new file mode 100644 index 0000000..7ef185d --- /dev/null +++ b/bookstack/templates/uploads-pvc.yaml @@ -0,0 +1,24 @@ +{{- if and .Values.persistence.uploads.enabled (not .Values.persistence.uploads.existingClaim) -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "bookstack.fullname" . }}-uploads + labels: + app: {{ template "bookstack.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + accessModes: + - {{ .Values.persistence.uploads.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.uploads.size | quote }} +{{- if .Values.persistence.uploads.storageClass }} +{{- if (eq "-" .Values.persistence.uploads.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.uploads.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/bookstack/values.yaml b/bookstack/values.yaml new file mode 100644 index 0000000..5178aff --- /dev/null +++ b/bookstack/values.yaml @@ -0,0 +1,191 @@ +# Default values for bookstack. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: solidnerd/bookstack + tag: 0.29.3 + pullPolicy: IfNotPresent + +app: + # Laravel APP_KEY. Generate one with `php artisan key:generate` and put here if you want a static key. + key: + +env: {} + +## +## External database configuration +## +externalDatabase: + ## Database host + host: + + ## Database host + #port: 3306 + + ## Database user + user: bookstack + + ## Database password + password: + + ## Database name + database: bookstack + +## +## 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: true + + ## Disable MariaDB replication + replication: + enabled: false + + ## Create a database and a database user + ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run + ## + db: + name: bookstack + user: bookstack + ## If the password is not specified, mariadb will generates a random password + ## + # password: + + ## MariaDB admin password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#setting-the-root-password-on-first-run + ## + # rootUser: + # password: + + ## Enable persistence using Persistent Volume Claims + ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + master: + persistence: + enabled: false + ## mariadb 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: "-" + accessMode: ReadWriteOnce + size: 8Gi + +service: + type: ClusterIP + port: 80 + +# If true, create & use Pod Security Policy resources +# https://kubernetes.io/docs/concepts/policy/pod-security-policy/ +podSecurityPolicy: + enabled: false + +## For RBAC support: +rbac: + # Specifies whether RBAC resources should be created + create: true + +serviceAccount: + # Specifies whether a ServiceAccount should be created + create: true + + # The name of the ServiceAccount to use. + # If not set and create is true, a name is generated using the fullname template + name: + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + # Persistence for the public/uploads folder + uploads: + enabled: true + ## database 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: "-" + accessMode: ReadWriteOnce + size: 8Gi + + # Persistence for the public/storage folder + storage: + enabled: true + ## database 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: "-" + accessMode: ReadWriteOnce + size: 8Gi + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + - bookstack-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +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 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +## Enable ldap authentication. See https://www.bookstackapp.com/docs/admin/ldap-auth/ for details on how to set it up. +ldap: + enabled: false + server: + base_dn: + dn: + pass: + userFilter: + version: + +## Configure liveness and readiness probe values +## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes +livenessProbe: + enabled: false + failureThreshold: 3 + initialDelaySeconds: 30 # very conservative value, to give enough time for database migrations + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 +readinessProbe: + enabled: false + failureThreshold: 3 + initialDelaySeconds: 30 # very conservative value, to give enough time for database migrations + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 \ No newline at end of file