From 3e83da22ed7657a920eb7985354b8121a3ec507d Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Fri, 20 Jan 2017 03:06:33 +0530 Subject: [PATCH] odoo chart (#313) * odoo chart * upgrade to postgresql 0.3.0 chart * explicitly set default `imagePullPolicy` to `IfNotPresent` * odoo: add alpha and beta storageclass annotation support * odoo: increase resource name truncation and trim - suffix * document `serviceType` param * bump image to `bitnami/odoo:9.0.20160620-r7` --- stable/odoo/.helmignore | 1 + stable/odoo/Chart.yaml | 17 +++++ stable/odoo/README.md | 95 +++++++++++++++++++++++++++ stable/odoo/requirements.lock | 6 ++ stable/odoo/requirements.yaml | 4 ++ stable/odoo/templates/NOTES.txt | 29 ++++++++ stable/odoo/templates/_helpers.tpl | 24 +++++++ stable/odoo/templates/deployment.yaml | 77 ++++++++++++++++++++++ stable/odoo/templates/pvc.yaml | 23 +++++++ stable/odoo/templates/secrets.yaml | 17 +++++ stable/odoo/templates/svc.yaml | 17 +++++ stable/odoo/values.yaml | 71 ++++++++++++++++++++ 12 files changed, 381 insertions(+) create mode 100644 stable/odoo/.helmignore create mode 100644 stable/odoo/Chart.yaml create mode 100644 stable/odoo/README.md create mode 100644 stable/odoo/requirements.lock create mode 100644 stable/odoo/requirements.yaml create mode 100644 stable/odoo/templates/NOTES.txt create mode 100644 stable/odoo/templates/_helpers.tpl create mode 100644 stable/odoo/templates/deployment.yaml create mode 100644 stable/odoo/templates/pvc.yaml create mode 100644 stable/odoo/templates/secrets.yaml create mode 100644 stable/odoo/templates/svc.yaml create mode 100644 stable/odoo/values.yaml diff --git a/stable/odoo/.helmignore b/stable/odoo/.helmignore new file mode 100644 index 0000000000..6b8710a711 --- /dev/null +++ b/stable/odoo/.helmignore @@ -0,0 +1 @@ +.git diff --git a/stable/odoo/Chart.yaml b/stable/odoo/Chart.yaml new file mode 100644 index 0000000000..0dcb5e6e6f --- /dev/null +++ b/stable/odoo/Chart.yaml @@ -0,0 +1,17 @@ +name: odoo +version: 0.4.0 +description: A suite of web based open source business apps. +keywords: +- odoo +- crm +- www +- http +- web +home: https://www.odoo.com/ +sources: +- https://github.com/bitnami/bitnami-docker-odoo +maintainers: +- name: Bitnami + email: containers@bitnami.com +engine: gotpl +icon: https://bitnami.com/assets/stacks/odoo/img/odoo-stack-110x117.png diff --git a/stable/odoo/README.md b/stable/odoo/README.md new file mode 100644 index 0000000000..7893740f4c --- /dev/null +++ b/stable/odoo/README.md @@ -0,0 +1,95 @@ +# Odoo + +[Odoo](https://www.odoo.com/) is a suite of web based open source business apps. The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ... + +Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps. + +## TL;DR; + +```console +$ helm install stable/odoo +``` + +## Introduction + +This chart bootstraps a [Odoo](https://github.com/bitnami/bitnami-docker-odoo) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.4+ with Beta APIs enabled +- PV provisioner support in the underlying infrastructure + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install --name my-release stable/odoo +``` + +The command deploys Odoo on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following tables lists the configurable parameters of the Odoo chart and their default values. + +| Parameter | Description | Default | +|---------------------------------------|-------------------------------------------|---------------------------------------------| +| `imageTag` | `bitnami/odoo` image tag | Odoo image version | +| `imagePullPolicy` | Image pull policy | `IfNotPresent` | +| `odooPassword` | Admin account password | `bitnami` | +| `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` | +| `serviceType` | Kubernetes Service type | `LoadBalancer` | +| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` | +| `persistence.storageClass` | PVC Storage Class | `generic` | +| `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` | + +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. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install --name my-release \ + --set odooPassword=password,postgresql.postgresPassword=secretpassword \ + stable/odoo +``` + +The above command sets the Odoo administrator account password to `password` and the PostgreSQL `postgres` user password to `secretpassword`. + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml stable/odoo +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +The [Bitnami Odoo](https://github.com/bitnami/bitnami-docker-odoo) image stores the Odoo data and configurations at the `/bitnami/odoo` path of the container. + +Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube. +See the [Configuration](#configuration) section to configure the PVC or to disable persistence. diff --git a/stable/odoo/requirements.lock b/stable/odoo/requirements.lock new file mode 100644 index 0000000000..bf19d4a2da --- /dev/null +++ b/stable/odoo/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: https://kubernetes-charts.storage.googleapis.com/ + version: 0.3.0 +digest: sha256:95328f41c781dc0569f19681ca90a23af054d1ac1cd7b5b8a316a14b3c271478 +generated: 2017-01-05T12:28:32.384161044+05:30 diff --git a/stable/odoo/requirements.yaml b/stable/odoo/requirements.yaml new file mode 100644 index 0000000000..8e2aa4661d --- /dev/null +++ b/stable/odoo/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: +- name: postgresql + version: 0.3.0 + repository: https://kubernetes-charts.storage.googleapis.com/ diff --git a/stable/odoo/templates/NOTES.txt b/stable/odoo/templates/NOTES.txt new file mode 100644 index 0000000000..fa840a5f53 --- /dev/null +++ b/stable/odoo/templates/NOTES.txt @@ -0,0 +1,29 @@ + +** Please be patient while the chart is being deployed ** + +1. Get the Odoo URL by running: + +{{- if contains "NodePort" .Values.serviceType }} + + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "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.serviceType }} + +** Please ensure an external IP is associated to the {{ template "fullname" . }} service before proceeding ** +** Watch the status using: kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }} ** + + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP/ +{{- else if contains "ClusterIP" .Values.serviceType }} + + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + echo http://127.0.0.1:8080/ + kubectl port-forward $POD_NAME 8080:80 +{{- end }} + +2. Login with the following credentials + + echo Email : {{ .Values.odooEmail }} + echo Password: $(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.odoo-password[*]}"`)) diff --git a/stable/odoo/templates/_helpers.tpl b/stable/odoo/templates/_helpers.tpl new file mode 100644 index 0000000000..1844ccfdf0 --- /dev/null +++ b/stable/odoo/templates/_helpers.tpl @@ -0,0 +1,24 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "postgresql.fullname" -}} +{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/stable/odoo/templates/deployment.yaml b/stable/odoo/templates/deployment.yaml new file mode 100644 index 0000000000..89e0fa4b8a --- /dev/null +++ b/stable/odoo/templates/deployment.yaml @@ -0,0 +1,77 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + template: + metadata: + labels: + app: {{ template "fullname" . }} + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.image }}" + imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} + env: + - name: POSTGRESQL_HOST + value: {{ template "postgresql.fullname" . }} + - name: POSTGRESQL_PORT + value: "5432" + - name: POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "postgresql.fullname" . }} + key: postgres-password + - name: ODOO_EMAIL + value: {{ default "" .Values.odooEmail | quote }} + - name: ODOO_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: odoo-password + - name: SMTP_HOST + value: {{ default "" .Values.smtpHost | quote }} + - name: SMTP_PORT + value: {{ default "" .Values.smtpPort | quote }} + - name: SMTP_USER + value: {{ default "" .Values.smtpUser | quote }} + - name: SMTP_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: smtp-password + - name: SMTP_PROTOCOL + value: {{ default "" .Values.smtpProtocol | quote }} + ports: + - name: http + containerPort: 8069 + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 180 + timeoutSeconds: 30 + readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 5 + timeoutSeconds: 1 + resources: +{{ toYaml .Values.resources | indent 10 }} + volumeMounts: + - name: odoo-data + mountPath: /bitnami/odoo + volumes: + - name: odoo-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} diff --git a/stable/odoo/templates/pvc.yaml b/stable/odoo/templates/pvc.yaml new file mode 100644 index 0000000000..14c4e2fc02 --- /dev/null +++ b/stable/odoo/templates/pvc.yaml @@ -0,0 +1,23 @@ +{{- if .Values.persistence.enabled -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: + {{- if .Values.persistence.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end -}} diff --git a/stable/odoo/templates/secrets.yaml b/stable/odoo/templates/secrets.yaml new file mode 100644 index 0000000000..7e3f88a75c --- /dev/null +++ b/stable/odoo/templates/secrets.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + {{ if .Values.odooPassword }} + odoo-password: {{ default "" .Values.odooPassword | b64enc | quote }} + {{ else }} + odoo-password: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} + smtp-password: {{ default "" .Values.smtpPassword | b64enc | quote }} diff --git a/stable/odoo/templates/svc.yaml b/stable/odoo/templates/svc.yaml new file mode 100644 index 0000000000..cf77abe82e --- /dev/null +++ b/stable/odoo/templates/svc.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + type: {{ .Values.serviceType }} + ports: + - name: http + port: 80 + targetPort: http + selector: + app: {{ template "fullname" . }} diff --git a/stable/odoo/values.yaml b/stable/odoo/values.yaml new file mode 100644 index 0000000000..7831a2299d --- /dev/null +++ b/stable/odoo/values.yaml @@ -0,0 +1,71 @@ +## Bitnami Odoo image version +## ref: https://hub.docker.com/r/bitnami/odoo/tags/ +## +image: bitnami/odoo:9.0.20160620-r7 + +## Specify a imagePullPolicy +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +imagePullPolicy: IfNotPresent + +## Admin email +## ref: https://github.com/bitnami/bitnami-docker-odoo#configuration +## +odooEmail: user@example.com + +## Application password +## Defaults to a random 10-character alphanumeric string if not set +## ref: https://github.com/bitnami/bitnami-docker-odoo#configuration +## +# odooPassword: + +## SMTP mail delivery configuration +## ref: https://github.com/bitnami/bitnami-docker-odoo/#smtp-configuration +# smtpHost: +# smtpPort: +# smtpUser: +# smtpPassword: +# smtpProtocol: + +## +## PostgreSQL chart configuration +## +postgresql: + ## PostgreSQL password + ## ref: https://hub.docker.com/_/postgres/ + ## + # postgresPassword: + + ## Enable persistence using Persistent Volume Claims + ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + persistence: + enabled: true + storageClass: generic + accessMode: ReadWriteOnce + size: 8Gi + +## Kubernetes configuration +## For minikube, set this to NodePort, elsewhere use LoadBalancer +## +serviceType: LoadBalancer + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + ## If defined, volume.beta.kubernetes.io/storage-class: + ## Default: volume.alpha.kubernetes.io/storage-class: default + ## + # storageClass: generic + accessMode: ReadWriteOnce + size: 8Gi + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + requests: + memory: 512Mi + cpu: 300m