From 0501b7cca9e9a055ef533f0c7077509c5f3e295c Mon Sep 17 00:00:00 2001 From: Srishti Thakkar Date: Wed, 11 Nov 2020 14:55:04 +0530 Subject: [PATCH] Issue 82: Handling Bookkeeper Upgrade (#85) * Issue 82: Handling Bookkeeper Upgrade Signed-off-by: SrishT * Issue 82: Handling Bookkeeper Upgrade Signed-off-by: SrishT * Issue 82: Updating documentation Signed-off-by: SrishT Co-authored-by: SrishT --- charts/bookkeeper/templates/bookkeeper.yaml | 5 +++-- deploy/crds/cr.yaml | 5 +++-- doc/manual-installation.md | 5 +++-- example/cr-detailed.yaml | 4 +++- pkg/controller/bookkeepercluster/upgrade.go | 5 +++++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/charts/bookkeeper/templates/bookkeeper.yaml b/charts/bookkeeper/templates/bookkeeper.yaml index 42539853..60d039c6 100644 --- a/charts/bookkeeper/templates/bookkeeper.yaml +++ b/charts/bookkeeper/templates/bookkeeper.yaml @@ -8,8 +8,9 @@ metadata: spec: replicas: {{ .Values.replicas }} image: - repository: {{ .Values.image.repository }} - pullPolicy: {{ .Values.image.pullPolicy }} + imageSpec: + repository: {{ .Values.image.repository }} + pullPolicy: {{ .Values.image.pullPolicy }} version: {{ .Values.version }} zookeeperUri: {{ .Values.zookeeperUri }} envVars: {{ template "bookkeeper.fullname" . }}-configmap diff --git a/deploy/crds/cr.yaml b/deploy/crds/cr.yaml index 5101c236..c783bcee 100644 --- a/deploy/crds/cr.yaml +++ b/deploy/crds/cr.yaml @@ -6,8 +6,9 @@ spec: version: 0.7.0 zookeeperUri: zookeeper-client:2181 image: - repository: pravega/bookkeeper - pullPolicy: IfNotPresent + imageSpec: + repository: pravega/bookkeeper + pullPolicy: IfNotPresent replicas: 3 envVars: bookkeeper-configmap autoRecovery: true diff --git a/doc/manual-installation.md b/doc/manual-installation.md index b54d1033..0f5de511 100644 --- a/doc/manual-installation.md +++ b/doc/manual-installation.md @@ -97,8 +97,9 @@ spec: envVars: bookkeeper-configmap replicas: 3 image: - repository: pravega/bookkeeper - pullPolicy: IfNotPresent + imageSpec: + repository: pravega/bookkeeper + pullPolicy: IfNotPresent ``` where: diff --git a/example/cr-detailed.yaml b/example/cr-detailed.yaml index 53c72b38..12b451b6 100644 --- a/example/cr-detailed.yaml +++ b/example/cr-detailed.yaml @@ -7,7 +7,9 @@ spec: zookeeperUri: zookeeper-client:2181 image: - repository: pravega/bookkeeper + imageSpec: + repository: pravega/bookkeeper + pullPolicy: IfNotPresent replicas: 3 diff --git a/pkg/controller/bookkeepercluster/upgrade.go b/pkg/controller/bookkeepercluster/upgrade.go index 81debd0e..77157954 100644 --- a/pkg/controller/bookkeepercluster/upgrade.go +++ b/pkg/controller/bookkeepercluster/upgrade.go @@ -13,6 +13,7 @@ package bookkeepercluster import ( "context" "fmt" + "sort" "time" bookkeeperv1alpha1 "github.com/pravega/bookkeeper-operator/pkg/apis/bookkeeper/v1alpha1" @@ -316,6 +317,10 @@ func (r *ReconcileBookkeeperCluster) getOneOutdatedPod(sts *appsv1.StatefulSet, return nil, err } + sort.SliceStable(podList.Items, func(i int, j int) bool { + return podList.Items[i].Name < podList.Items[j].Name + }) + for _, podItem := range podList.Items { if util.GetPodVersion(&podItem) == version { continue