From e3225f7857de75a2ba7d0db5815fb042898f321d Mon Sep 17 00:00:00 2001 From: Thomas Blarre Date: Mon, 11 Nov 2024 15:43:45 +0000 Subject: [PATCH] Added odoo --- odoo-argocd-apps/.helmignore | 23 +++++++ odoo-argocd-apps/Chart.yaml | 5 ++ odoo-argocd-apps/templates/_helpers.tpl | 62 +++++++++++++++++++ odoo-argocd-apps/templates/odoo-chart.yaml | 41 ++++++++++++ .../templates/odoo-requirements-app.yaml | 36 +++++++++++ odoo-argocd-apps/values.yaml | 22 +++++++ odoo-postinstall/.helmignore | 23 +++++++ odoo-postinstall/Chart.yaml | 5 ++ odoo-postinstall/templates/_helpers.tpl | 62 +++++++++++++++++++ odoo-postinstall/templates/odoo-ingress.yaml | 16 +++++ odoo-postinstall/values.yaml | 2 + odoo-requirements/.helmignore | 23 +++++++ odoo-requirements/Chart.yaml | 5 ++ odoo-requirements/templates/_helpers.tpl | 62 +++++++++++++++++++ odoo-requirements/templates/db-cluster.yaml | 8 +++ odoo-requirements/templates/odoo-data.yaml | 11 ++++ odoo-requirements/values.yaml | 8 +++ 17 files changed, 414 insertions(+) create mode 100644 odoo-argocd-apps/.helmignore create mode 100644 odoo-argocd-apps/Chart.yaml create mode 100644 odoo-argocd-apps/templates/_helpers.tpl create mode 100644 odoo-argocd-apps/templates/odoo-chart.yaml create mode 100644 odoo-argocd-apps/templates/odoo-requirements-app.yaml create mode 100644 odoo-argocd-apps/values.yaml create mode 100644 odoo-postinstall/.helmignore create mode 100644 odoo-postinstall/Chart.yaml create mode 100644 odoo-postinstall/templates/_helpers.tpl create mode 100644 odoo-postinstall/templates/odoo-ingress.yaml create mode 100644 odoo-postinstall/values.yaml create mode 100644 odoo-requirements/.helmignore create mode 100644 odoo-requirements/Chart.yaml create mode 100644 odoo-requirements/templates/_helpers.tpl create mode 100644 odoo-requirements/templates/db-cluster.yaml create mode 100644 odoo-requirements/templates/odoo-data.yaml create mode 100644 odoo-requirements/values.yaml diff --git a/odoo-argocd-apps/.helmignore b/odoo-argocd-apps/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/odoo-argocd-apps/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/odoo-argocd-apps/Chart.yaml b/odoo-argocd-apps/Chart.yaml new file mode 100644 index 0000000..b52861c --- /dev/null +++ b/odoo-argocd-apps/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: odoo-argocd-apps +description: A Helm chart for deploying the requirements, main charts and postinstall as ArgoCD apps for Odoo +type: application +version: 0.1.0 diff --git a/odoo-argocd-apps/templates/_helpers.tpl b/odoo-argocd-apps/templates/_helpers.tpl new file mode 100644 index 0000000..a8f401c --- /dev/null +++ b/odoo-argocd-apps/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "odoo-argocd-apps.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 "odoo-argocd-apps.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 "odoo-argocd-apps.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "odoo-argocd-apps.labels" -}} +helm.sh/chart: {{ include "odoo-argocd-apps.chart" . }} +{{ include "odoo-argocd-apps.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "odoo-argocd-apps.selectorLabels" -}} +app.kubernetes.io/name: {{ include "odoo-argocd-apps.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "odoo-argocd-apps.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "odoo-argocd-apps.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/odoo-argocd-apps/templates/odoo-chart.yaml b/odoo-argocd-apps/templates/odoo-chart.yaml new file mode 100644 index 0000000..cd49eb6 --- /dev/null +++ b/odoo-argocd-apps/templates/odoo-chart.yaml @@ -0,0 +1,41 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: odoo-chart + namespace: {{ .Values.argocd.namespace }} + annotations: + argocd.argoproj.io/sync-wave: "0" + notifications.argoproj.io/subscribe.on-sync-succeeded.telegram: "-1002270587578" +spec: + project: {{ .Values.argocd.project }} + source: + repoURL: registry-1.docker.io/bitnamicharts + chart: odoo + targetRevision: 28.x + helm: + releaseName: odoo + valuesObject: + odooEmail: {{ .Values.odoo.odooEmail }} + replicaCount: {{ .Values.odoo.replicaCount }} + persistence: + existingClaim: {{ .Values.odoo.dataPvc.name }} + postgresql: + enabled: false + externalDatabase: + host: odoo-db-rw + port: 5432 + postgresqlPostgresUser: app + existingSecret: odoo-db-app + existingSecretPostgresPasswordKey: password + + destination: + server: {{ .Values.destination.server }} + namespace: {{ .Values.destination.namespace }} + syncPolicy: + automated: + prune: true # Automatically remove resources no longer in the repo + selfHeal: true # Automatically self-heal when drift is detected + syncOptions: + - ApplyOutOfSyncOnly=true + - ServerSideApply=true + - CreateNamespace=true diff --git a/odoo-argocd-apps/templates/odoo-requirements-app.yaml b/odoo-argocd-apps/templates/odoo-requirements-app.yaml new file mode 100644 index 0000000..6e44230 --- /dev/null +++ b/odoo-argocd-apps/templates/odoo-requirements-app.yaml @@ -0,0 +1,36 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: odoo-requirements + namespace: {{ .Values.argocd.namespace }} + annotations: + argocd.argoproj.io/sync-wave: "-1" + notifications.argoproj.io/subscribe.on-sync-succeeded.telegram: "-1002270587578" +spec: + project: {{ .Values.argocd.project }} + source: + repoURL: {{ .Values.argocd.requirements.repoURL }} + targetRevision: {{ .Values.requirements.targetRevision }} + path: {{ .Values.requirements.path }} + helm: + releaseName: odoo-requirements + valuesObject: + odoo: + dbCluster: + numInstances: {{ .Values.odoo.dbCluster.numInstances }} + size: {{ .Values.odoo.dbCluster.size }} + dataPvc: + name: {{ .Values.odoo.dataPvc.name }} + storageClassName: {{ .Values.odoo.dataPvc.storageClassName }} + size: {{ .Values.odoo.dataPvc.size }} + destination: + server: {{ .Values.destination.server }} + namespace: {{ .Values.destination.namespace }} + syncPolicy: + automated: + prune: true # Automatically remove resources no longer in the repo + selfHeal: true # Automatically self-heal when drift is detected + syncOptions: + - ApplyOutOfSyncOnly=true + - ServerSideApply=true + - CreateNamespace=true diff --git a/odoo-argocd-apps/values.yaml b/odoo-argocd-apps/values.yaml new file mode 100644 index 0000000..1d2bec8 --- /dev/null +++ b/odoo-argocd-apps/values.yaml @@ -0,0 +1,22 @@ +argocd: + namespace: argocd + project: default + requirements: + repoURL: "https://git.blarre.net/thomas/helm-charts.git" + targetRevision: HEAD + path: odoo-requirements + +destination: + server: "https://kubernetes.default.svc" + namespace: odoo + +odoo: + dbCluster: + numInstances: 3 + size: 10Gi + dataPvc: + name: odoo-data + storageClassName: '' + size: 40Gi + odooEmail: "admin@domain.net" + replicaCount: 1 \ No newline at end of file diff --git a/odoo-postinstall/.helmignore b/odoo-postinstall/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/odoo-postinstall/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/odoo-postinstall/Chart.yaml b/odoo-postinstall/Chart.yaml new file mode 100644 index 0000000..7c8f65b --- /dev/null +++ b/odoo-postinstall/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: odoo-postinstall +description: A Helm chart for deploying the postinall stuff for odoo, mainly the ingress +type: application +version: 0.1.0 diff --git a/odoo-postinstall/templates/_helpers.tpl b/odoo-postinstall/templates/_helpers.tpl new file mode 100644 index 0000000..0da507e --- /dev/null +++ b/odoo-postinstall/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "odoo-postinstall.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 "odoo-postinstall.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 "odoo-postinstall.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "odoo-postinstall.labels" -}} +helm.sh/chart: {{ include "odoo-postinstall.chart" . }} +{{ include "odoo-postinstall.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "odoo-postinstall.selectorLabels" -}} +app.kubernetes.io/name: {{ include "odoo-postinstall.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "odoo-postinstall.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "odoo-postinstall.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/odoo-postinstall/templates/odoo-ingress.yaml b/odoo-postinstall/templates/odoo-ingress.yaml new file mode 100644 index 0000000..fe13a21 --- /dev/null +++ b/odoo-postinstall/templates/odoo-ingress.yaml @@ -0,0 +1,16 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ts-odoo + annotations: + tailscale.com/funnel: "true" +spec: + defaultBackend: + service: + name: odoo + port: + name: http + ingressClassName: tailscale + tls: + - hosts: + - {{ .Values.tailscaleIngresses.odooHostname }} diff --git a/odoo-postinstall/values.yaml b/odoo-postinstall/values.yaml new file mode 100644 index 0000000..9f214a8 --- /dev/null +++ b/odoo-postinstall/values.yaml @@ -0,0 +1,2 @@ +tailcaleIngresses: + odooHostname: odoo \ No newline at end of file diff --git a/odoo-requirements/.helmignore b/odoo-requirements/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/odoo-requirements/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/odoo-requirements/Chart.yaml b/odoo-requirements/Chart.yaml new file mode 100644 index 0000000..7f476c0 --- /dev/null +++ b/odoo-requirements/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: odoo-requirements +description: A Helm chart for the requirements for Odoo +type: application +version: 0.1.0 diff --git a/odoo-requirements/templates/_helpers.tpl b/odoo-requirements/templates/_helpers.tpl new file mode 100644 index 0000000..0a981ae --- /dev/null +++ b/odoo-requirements/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "odoo-requirements.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 "odoo-requirements.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 "odoo-requirements.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "odoo-requirements.labels" -}} +helm.sh/chart: {{ include "odoo-requirements.chart" . }} +{{ include "odoo-requirements.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "odoo-requirements.selectorLabels" -}} +app.kubernetes.io/name: {{ include "odoo-requirements.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "odoo-requirements.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "odoo-requirements.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/odoo-requirements/templates/db-cluster.yaml b/odoo-requirements/templates/db-cluster.yaml new file mode 100644 index 0000000..d8753a3 --- /dev/null +++ b/odoo-requirements/templates/db-cluster.yaml @@ -0,0 +1,8 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: odoo-db +spec: + instances: {{ .Values.odoo.dbCluster.numInstances }} + storage: + size: {{ .Values.odoo.dbCluster.size }} \ No newline at end of file diff --git a/odoo-requirements/templates/odoo-data.yaml b/odoo-requirements/templates/odoo-data.yaml new file mode 100644 index 0000000..91d58d7 --- /dev/null +++ b/odoo-requirements/templates/odoo-data.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.odoo.dataPvc.name }} +spec: + storageClassName: {{ .Values.odoo.dataPvc.storageClassName }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.odoo.dataPvc.size }} diff --git a/odoo-requirements/values.yaml b/odoo-requirements/values.yaml new file mode 100644 index 0000000..d09f541 --- /dev/null +++ b/odoo-requirements/values.yaml @@ -0,0 +1,8 @@ +odoo: + dbCluster: + numInstances: 3 + size: 10Gi + dataPvc: + name: odoo-data + storageClassName: '' + size: 40Gi \ No newline at end of file