Skip to content

Commit 4383b83

Browse files
committed
fix: change scale down strategy when blue green update
Signed-off-by: Rory Z <16801068+Rory-Z@users.noreply.github.com>
1 parent 9571594 commit 4383b83

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

RELEASE.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release Note 🍻
22

3-
EMQX Operator 2.2.28 has been released.
3+
EMQX Operator 2.2.29-beta.1 has been released.
44

55
## Supported version
66
+ apps.emqx.io/v2beta1
@@ -13,13 +13,9 @@ EMQX Operator 2.2.28 has been released.
1313
+ EMQX at 4.4.14 and later
1414
+ EMQX Enterprise at 4.4.14 and later
1515

16-
## Fixes 🛠
16+
## Fix 🐞
1717

18-
+ Fix the Helm template formatting issue, thanks to [Rouke Broersma](https://github.com/rouke-broersma) for their contribution in [PR#1102](https://github.com/emqx/emqx-operator/pull/1102)
19-
20-
## Enhancements 🚀
21-
22-
+ Better documents
18+
+ Fix the issue that the replicas of the statefulSet is not current when the `emqx` CR is updated
2319

2420
## How to install/upgrade EMQX Operator 💡
2521

@@ -31,7 +27,7 @@ helm repo update
3127
helm upgrade --install emqx-operator emqx/emqx-operator \
3228
--namespace emqx-operator-system \
3329
--create-namespace \
34-
--version 2.2.28
30+
--version 2.2.29-beta.1
3531
kubectl wait --for=condition=Ready pods -l "control-plane=controller-manager" -n emqx-operator-system
3632
```
3733

controllers/apps/v2beta1/sync_pods.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ func (s *syncPods) reconcile(ctx context.Context, logger logr.Logger, instance *
7676
}
7777
}
7878
if _, ok := pod.Annotations["controller.kubernetes.io/pod-deletion-cost"]; ok {
79-
currentRs.Spec.Replicas = ptr.To(int32(instance.Status.ReplicantNodesStatus.CurrentReplicas - 1))
79+
// https://github.com/emqx/emqx-operator/issues/1105
80+
currentRs.Spec.Replicas = ptr.To(int32(*currentRs.Spec.Replicas - 1))
8081
if err := s.Client.Update(ctx, currentRs); err != nil {
8182
return subResult{err: emperror.Wrap(err, "failed to scale down old replicaSet")}
8283
}
@@ -92,7 +93,8 @@ func (s *syncPods) reconcile(ctx context.Context, logger logr.Logger, instance *
9293
return subResult{err: emperror.Wrap(err, "failed to check if sts can be scale down")}
9394
}
9495
if canBeScaledDown {
95-
currentSts.Spec.Replicas = ptr.To(int32(instance.Status.CoreNodesStatus.CurrentReplicas - 1))
96+
// https://github.com/emqx/emqx-operator/issues/1105
97+
currentSts.Spec.Replicas = ptr.To(int32(*currentSts.Spec.Replicas - 1))
9698
if err := s.Client.Update(ctx, currentSts); err != nil {
9799
return subResult{err: emperror.Wrap(err, "failed to scale down old statefulSet")}
98100
}

deploy/charts/emqx-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 2.2.28
18+
version: 2.2.29-beta.1
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
23-
appVersion: 2.2.28
23+
appVersion: 2.2.29-beta.1
2424

2525
sources:
2626
- https://github.com/emqx/emqx-operator/tree/main/deploy/charts/emqx-operator

0 commit comments

Comments
 (0)