[stable/odoo] Allow external PostgreSQL database (#14336)

* [stable/odoo] Allow external postgresql database

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Update README

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Apply requested changes

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>

* Fix typo

Signed-off-by: Javier Salmeron Garcia <jsalmeron@vmware.com>
This commit is contained in:
Javier J. Salmerón-García
2019-05-31 02:52:27 -07:00
committed by Kubernetes Prow Robot
parent 31e8276d26
commit 5c470f5736
7 changed files with 112 additions and 63 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: odoo
version: 8.0.3
version: 8.1.0
appVersion: 12.0.20190515
description: A suite of web based open source business apps.
home: https://www.odoo.com/
+72 -55
View File
@@ -47,61 +47,67 @@ The command removes all the Kubernetes components associated with the chart and
The following table lists the configurable parameters of the Odoo 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) |
| `image.registry` | Odoo image registry | `docker.io` |
| `image.repository` | Odoo Image name | `bitnami/odoo` |
| `image.tag` | Odoo Image tag | `{TAG_NAME}` |
| `image.pullPolicy` | Image pull policy | `Always` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `odooUsername` | User of the application | `user@example.com` |
| `odooPassword` | Admin account password | _random 10 character long alphanumeric string_ |
| `odooEmail` | Admin account email | `user@example.com` |
| `smtpHost` | SMTP host | `nil` |
| `smtpPort` | SMTP port | `nil` |
| `smtpUser` | SMTP user | `nil` |
| `smtpPassword` | SMTP password | `nil` |
| `smtpProtocol` | SMTP protocol [`ssl`, `tls`] | `nil` |
| `service.type` | Kubernetes Service type | `LoadBalancer` |
| `service.port` | Service HTTP port | `80` |
| `service.loadBalancer` | Kubernetes LoadBalancerIP to request | `nil` |
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
| `service.nodePort` | Kubernetes http node port | `""` |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.hosts[0].name` | Hostname to your Odoo installation | `odoo.local` |
| `ingress.hosts[0].path` | Path within the url structure | `/` |
| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` |
| `ingress.hosts[0].certManager` | Add annotations for cert-manager | `false` |
| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `odoo.local-tls-secret` |
| `ingress.hosts[0].annotations` | Annotations for this host's ingress record | `[]` |
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.existingClaim` | Enable persistence using an existing PVC | `nil` |
| `persistence.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | PVC Access Mode | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request | `8Gi` |
| `postgresql.postgresqlPassword` | PostgreSQL password | `nil` |
| `postgresql.persistence.enabled` | Enable PostgreSQL persistence using PVC | `true` |
| `postgresql.persistence.storageClass` | PVC Storage Class for PostgreSQL volume | `nil` (uses alpha storage class annotation) |
| `postgresql.persistence.accessMode` | PVC Access Mode for PostgreSQL volume | `ReadWriteOnce` |
| `postgresql.persistence.size` | PVC Storage Request for PostgreSQL volume | `8Gi` |
| `livenessProbe.enabled` | Enable/disable the liveness probe | `true` |
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 300 |
| `livenessProbe.periodSeconds` | How often to perform the probe | 30 |
| `livenessProbe.timeoutSeconds` | When the probe times out | 5 |
| `livenessProbe.failureThreshold` | Minimum consecutive failures to be considered failed | 6 |
| `livenessProbe.successThreshold` | Minimum consecutive successes to be considered successful | 1 |
| `readinessProbe.enabled` | Enable/disable the readiness probe | `true` |
| `readinessProbe.initialDelaySeconds` | Delay before readinessProbe is initiated | 30 |
| `readinessProbe.periodSeconds ` | How often to perform the probe | 10 |
| `readinessProbe.timeoutSeconds` | When the probe times out | 5 |
| `readinessProbe.failureThreshold` | Minimum consecutive failures to be considered failed | 6 |
| `readinessProbe.successThreshold` | Minimum consecutive successes to be considered successful | 1 |
| 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) |
| `image.registry` | Odoo image registry | `docker.io` |
| `image.repository` | Odoo Image name | `bitnami/odoo` |
| `image.tag` | Odoo Image tag | `{TAG_NAME}` |
| `image.pullPolicy` | Image pull policy | `Always` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `odooUsername` | User of the application | `user@example.com` |
| `odooPassword` | Admin account password | _random 10 character long alphanumeric string_ |
| `odooEmail` | Admin account email | `user@example.com` |
| `smtpHost` | SMTP host | `nil` |
| `smtpPort` | SMTP port | `nil` |
| `smtpUser` | SMTP user | `nil` |
| `smtpPassword` | SMTP password | `nil` |
| `smtpProtocol` | SMTP protocol [`ssl`, `tls`] | `nil` |
| `service.type` | Kubernetes Service type | `LoadBalancer` |
| `service.port` | Service HTTP port | `80` |
| `service.loadBalancer` | Kubernetes LoadBalancerIP to request | `nil` |
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
| `service.nodePort` | Kubernetes http node port | `""` |
| `externalDatabase.host` | Host of the external database | `localhost` |
| `externalDatabase.user` | Existing username in the external db | `postgres` |
| `externalDatabase.password` | Password for the above username | `nil` |
| `externalDatabase.database` | Name of the existing database | `bitnami_odoo` |
| `externalDatabase.port` | Database port number | `5432` |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.hosts[0].name` | Hostname to your Odoo installation | `odoo.local` |
| `ingress.hosts[0].path` | Path within the url structure | `/` |
| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` |
| `ingress.hosts[0].certManager` | Add annotations for cert-manager | `false` |
| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `odoo.local-tls-secret` |
| `ingress.hosts[0].annotations` | Annotations for this host's ingress record | `[]` |
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.existingClaim` | Enable persistence using an existing PVC | `nil` |
| `persistence.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | PVC Access Mode | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request | `8Gi` |
| `postgresql.enabled` | Deploy PostgreSQL container(s) | `true` |
| `postgresql.postgresqlPassword` | PostgreSQL password | `nil` |
| `postgresql.persistence.enabled` | Enable PostgreSQL persistence using PVC | `true` |
| `postgresql.persistence.storageClass` | PVC Storage Class for PostgreSQL volume | `nil` (uses alpha storage class annotation) |
| `postgresql.persistence.accessMode` | PVC Access Mode for PostgreSQL volume | `ReadWriteOnce` |
| `postgresql.persistence.size` | PVC Storage Request for PostgreSQL volume | `8Gi` |
| `livenessProbe.enabled` | Enable/disable the liveness probe | `true` |
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 300 |
| `livenessProbe.periodSeconds` | How often to perform the probe | 30 |
| `livenessProbe.timeoutSeconds` | When the probe times out | 5 |
| `livenessProbe.failureThreshold` | Minimum consecutive failures to be considered failed | 6 |
| `livenessProbe.successThreshold` | Minimum consecutive successes to be considered successful | 1 |
| `readinessProbe.enabled` | Enable/disable the readiness probe | `true` |
| `readinessProbe.initialDelaySeconds` | Delay before readinessProbe is initiated | 30 |
| `readinessProbe.periodSeconds ` | How often to perform the probe | 10 |
| `readinessProbe.timeoutSeconds` | When the probe times out | 5 |
| `readinessProbe.failureThreshold` | Minimum consecutive failures to be considered failed | 6 |
| `readinessProbe.successThreshold` | Minimum consecutive successes to be considered successful | 1 |
The above parameters map to the env variables defined in [bitnami/odoo](http://github.com/bitnami/bitnami-docker-odoo). For more information please refer to the [bitnami/odoo](http://github.com/bitnami/bitnami-docker-odoo) image documentation.
@@ -136,6 +142,17 @@ The [Bitnami Odoo](https://github.com/bitnami/bitnami-docker-odoo) image stores
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
See the [Configuration](#configuration) section to configure the PVC or to disable persistence.
## Using an external database
Sometimes you may want to have Odoo connect to an external database rather than installing one inside your cluster, e.g. to use a managed database service, or use a single database server for all your applications. To do this, the chart allows you to specify credentials for an external database under the [`externalDatabase` parameter](#configuration). You should also disable the PostgreSQL installation with the `postgresql.enabled` option. For example:
```console
$ helm install stable/odoo \
--set postgresql.enabled=false,externalDatabase.host=myexternalhost,externalDatabase.user=myuser,externalDatabase.password=mypassword,externalDatabase.port=3306
```
Note also if you disable PostgreSQL per above you MUST supply values for the `externalDatabase` connection.
## Upgrading
### To 3.0.0
+3 -3
View File
@@ -1,6 +1,6 @@
dependencies:
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com/
version: 4.0.1
digest: sha256:5fb584d119966f79129f7e6f010654540fe747203b91cb4e3ea548f90332c9db
generated: 2019-05-09T20:07:01.558447453+02:00
version: 4.2.2
digest: sha256:477f1a3eee8875f68a4a7d22735d5dddd539149f52ec214b6314af9804d171e9
generated: 2019-05-31T09:48:42.793153+02:00
+1
View File
@@ -1,4 +1,5 @@
dependencies:
- name: postgresql
condition: postgresql.enabled
version: 4.x.x
repository: https://kubernetes-charts.storage.googleapis.com/
+6 -4
View File
@@ -26,14 +26,16 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
env:
- name: POSTGRESQL_HOST
value: {{ template "odoo.postgresql.fullname" . }}
value: {{ ternary (include "odoo.postgresql.fullname" .) .Values.externalDatabase.host .Values.postgresql.enabled | quote }}
- name: POSTGRESQL_USER
value: {{ ternary "postgres" .Values.externalDatabase.user .Values.postgresql.enabled | quote }}
- name: POSTGRESQL_PORT_NUMBER
value: "5432"
value: {{ ternary "5432" .Values.externalDatabase.port .Values.postgresql.enabled | quote }}
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "odoo.postgresql.fullname" . }}
key: postgresql-password
name: {{ ternary (include "odoo.postgresql.fullname" .) (printf "%s-%s" .Release.Name "externaldb") .Values.postgresql.enabled | quote }}
key: {{ ternary "postgresql-password" "db-password" .Values.postgresql.enabled | quote }}
- name: ODOO_EMAIL
value: {{ .Values.odooEmail | quote }}
- name: ODOO_PASSWORD
@@ -0,0 +1,14 @@
{{- if not .Values.postgresql.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
labels:
app: {{ printf "%s-%s" .Release.Name "externaldb" }}
chart: {{ template "odoo.chart" . }}
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
type: Opaque
data:
db-password: {{ .Values.externalDatabase.password | b64enc | quote }}
{{- end }}
+15
View File
@@ -50,12 +50,27 @@ odooEmail: user@example.com
# smtpPassword:
# smtpProtocol:
externalDatabase:
## All of these values are only used when mariadb.enabled is set to false
## Database host
host: localhost
## non-root Username for Wordpress Database
user: postgres
## Database password
password: ""
## Database port number
port: 5432
##
## PostgreSQL chart configuration
##
## https://github.com/helm/charts/blob/master/stable/postgresql/values.yaml
##
postgresql:
enabled: true
## PostgreSQL password
## ref: https://hub.docker.com/_/postgres/
##