Skip to content

Commit

Permalink
[stable/odoo] fix upgrading existing deployments
Browse files Browse the repository at this point in the history
In helm#17352 the `apiVersion` of the deployment resource was
updated to `apps/v1` in tune with the api's deprecated in k8s 1.16. This change however breaks
upgradability of existing odoo deployments with helm v3 (rc) as described in
helm/helm#6646.

To fix this, we have defined a `odoo.deployment.apiVersion` helper that returns the new
`apiVersion` only when k8s 1.16 or higher is in use.

Signed-off-by: Sameer Naik <sameersbn@vmware.com>
  • Loading branch information
Sameer Naik committed Nov 8, 2019
1 parent 122647b commit 1fa6a9b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stable/odoo/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: odoo
version: 11.1.11
version: 11.1.12
appVersion: 12.0.20191015
description: A suite of web based open source business apps.
home: https://www.odoo.com/
Expand Down
11 changes: 11 additions & 0 deletions stable/odoo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,14 @@ but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for deployment.
*/}}
{{- define "odoo.deployment.apiVersion" -}}
{{- if semverCompare "<1.16-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion stable/odoo/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apps/v1
apiVersion: {{ template "odoo.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "odoo.fullname" . }}
Expand Down

0 comments on commit 1fa6a9b

Please sign in to comment.