From b7a2c0a83d16ab4885a720faaaf96f7046637d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Wed, 3 Apr 2024 13:32:03 +0800 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 fce1b22070a..2a54ce7ddad 100644 --- a/charts/kube-ovn/Chart.yaml +++ b/charts/kube-ovn/Chart.yaml @@ -22,3 +22,5 @@ version: 1.13.0 # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. appVersion: "1.13.0" + +kubeVersion: ">= 1.23.0" diff --git a/charts/kube-ovn/templates/_helpers.tpl b/charts/kube-ovn/templates/_helpers.tpl index 7b473941e5c..9a216a38b24 100644 --- a/charts/kube-ovn/templates/_helpers.tpl +++ b/charts/kube-ovn/templates/_helpers.tpl @@ -36,9 +36,11 @@ Number of master nodes {{- 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 -}}