From f8655fb655ebdad0beacb831d171a264656c44bd Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Wed, 3 Apr 2024 05:33:54 +0000 Subject: [PATCH] chart: fix ovs-ovn update strategy (#3887) Signed-off-by: zhangzujian --- charts/kube-ovn/Chart.yaml | 2 ++ charts/kube-ovn/templates/_helpers.tpl | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/charts/kube-ovn/Chart.yaml b/charts/kube-ovn/Chart.yaml index da3b237855c..04de8eaceaa 100644 --- a/charts/kube-ovn/Chart.yaml +++ b/charts/kube-ovn/Chart.yaml @@ -22,3 +22,5 @@ version: v1.12.11 # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. appVersion: "1.12.11" + +kubeVersion: ">= 1.23.0" diff --git a/charts/kube-ovn/templates/_helpers.tpl b/charts/kube-ovn/templates/_helpers.tpl index f1751ad5d97..58f06f59cca 100644 --- a/charts/kube-ovn/templates/_helpers.tpl +++ b/charts/kube-ovn/templates/_helpers.tpl @@ -4,9 +4,11 @@ {{- if eq $ds.spec.updateStrategy.type "RollingUpdate" -}} RollingUpdate {{- else -}} + {{- $chartVersion := index $ds.metadata.annotations "chart-version" }} + {{- $newChartVersion := printf "%s-%s" .Chart.Name .Chart.Version }} {{- $imageVersion := (index $ds.spec.template.spec.containers 0).image | splitList ":" | last | trimPrefix "v" -}} {{- $versionRegex := `^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)` -}} - {{- if regexMatch $versionRegex $imageVersion -}} + {{- if and (ne $newChartVersion $chartVersion) (regexMatch $versionRegex $imageVersion) -}} {{- if regexFind $versionRegex $imageVersion | semverCompare ">= 1.12.0" -}} RollingUpdate {{- else -}}