Skip to content

Commit 62bd468

Browse files
committed
fix: prefer EMQX 6.x to load DS cluster view
This commit ensures that DS reconcilers prefer to work with the same cluster view, preferably sourced from 6.x, primarily because EMQX clusters running 6.1.0 and newer can have separate cluster views different from 6.0.x and earlier.
1 parent 9778939 commit 62bd468

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

internal/controller/ds_load_cluster_state.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ type dsLoadClusterState struct {
1414

1515
func (c *dsLoadClusterState) reconcile(r *reconcileRound, instance *crd.EMQX) subResult {
1616
// Instantiate API requester for a node that is part of the core StatefulSet.
17-
req := r.oldestCoreRequester()
17+
// Prefer EMQX 6.x requester first: EMQX starting from 6.1.0 has separate cluster view.
18+
req := r.requester.forOldestCore(r.state, &emqxVersionFilter{instance: instance, prefix: "6."})
19+
if req == nil {
20+
req = r.oldestCoreRequester()
21+
}
22+
1823
// If there's no suitable EMQX API to query, skip the reconciliation.
1924
if req == nil {
2025
return reconcilePostpone()

internal/controller/ds_update_replica_sets.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ func (u *dsUpdateReplicaSets) reconcile(r *reconcileRound, instance *crd.EMQX) s
2828
}
2929

3030
// Instantiate API requester for a node that is part of the core StatefulSet.
31-
req := r.requester.forOldestCore(r.state)
31+
// Prefer EMQX 6.x requester first: EMQX starting from 6.1.0 has separate cluster view.
32+
req := r.requester.forOldestCore(r.state, &emqxVersionFilter{instance: instance, prefix: "6."})
33+
if req == nil {
34+
req = r.oldestCoreRequester()
35+
}
3236

3337
// If there's no EMQX API to query, skip the reconciliation.
3438
if req == nil {

0 commit comments

Comments
 (0)