Skip to content

Commit 9b97c86

Browse files
authored
[Bugfix] Clean Phase change properly during upgrade (#1832)
1 parent 601b275 commit 9b97c86

File tree

5 files changed

+40
-6
lines changed

5 files changed

+40
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Change Log
22

33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
4+
- (Bugfix) Clean Phase change properly during upgrade
45

56
## [1.2.45](https://github.com/arangodb/kube-arangodb/tree/1.2.45) (2025-02-21)
67
- (Feature) (Platform) Inventory as Proto

pkg/deployment/member/phase_updates.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -66,6 +66,8 @@ var phase = phaseMap{
6666
d := spec.Architecture.GetDefault()
6767
m.Architecture = &d
6868
}
69+
70+
removeBaseMemberConditionsMapFunc(m)
6971
},
7072
},
7173
api.MemberPhasePending: {
@@ -79,6 +81,17 @@ var phase = phaseMap{
7981
},
8082
}
8183

84+
func removeBaseMemberConditionsMapFunc(m *api.MemberStatus) {
85+
// Clean conditions
86+
m.Conditions.Remove(api.ConditionTypeReady)
87+
m.Conditions.Remove(api.ConditionTypeActive)
88+
m.Conditions.Remove(api.ConditionTypeStarted)
89+
m.Conditions.Remove(api.ConditionTypeScheduled)
90+
m.Conditions.Remove(api.ConditionTypeReachable)
91+
m.Conditions.Remove(api.ConditionTypeServing)
92+
m.Conditions.Remove(api.ConditionTypeTerminating)
93+
}
94+
8295
func removeMemberConditionsMapFunc(m *api.MemberStatus) {
8396
// Clean conditions
8497
m.Conditions.Remove(api.ConditionTypeReady)

pkg/deployment/reconcile/action_wait_for_member_in_sync.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -61,6 +61,10 @@ func (a *actionWaitForMemberInSync) CheckProgress(_ context.Context) (bool, bool
6161
return true, false, nil
6262
}
6363

64+
if member.Phase.IsPending() {
65+
return false, false, nil
66+
}
67+
6468
ready, err := a.check()
6569
if err != nil {
6670
return false, false, err

pkg/deployment/reconcile/action_wait_for_member_ready.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ func (a *actionWaitForMemberReady) CheckProgress(ctx context.Context) (bool, boo
6464
return true, false, nil
6565
}
6666

67+
if member.Phase.IsPending() {
68+
return false, false, nil
69+
}
70+
6771
if a.actionCtx.GetMode() == api.DeploymentModeActiveFailover {
6872
return true, false, nil
6973
}

pkg/deployment/reconcile/action_wait_for_member_up.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ func (a *actionWaitForMemberUp) CheckProgress(ctx context.Context) (bool, bool,
7070
return true, false, nil
7171
}
7272

73+
if member.Phase.IsPending() {
74+
return false, false, nil
75+
}
76+
7377
ctxChild, cancel := globals.GetGlobalTimeouts().ArangoD().WithTimeout(ctx)
7478
defer cancel()
7579

@@ -106,8 +110,12 @@ func (a *actionWaitForMemberUp) checkProgressSingle() bool {
106110
return false
107111
}
108112

109-
if !m.Conditions.IsTrue(api.ConditionTypeActive) {
110-
a.log.Debug("Member not yet active")
113+
if m.Phase.IsPending() {
114+
return false
115+
}
116+
117+
if !m.Conditions.IsTrue(api.ConditionTypeServing) {
118+
a.log.Debug("Member not yet serving")
111119
return false
112120
}
113121

@@ -189,8 +197,12 @@ func (a *actionWaitForMemberUp) checkProgressCluster(ctx context.Context) bool {
189197
}
190198
}
191199

192-
if !m.Conditions.IsTrue(api.ConditionTypeActive) {
193-
a.log.Debug("Member not yet active")
200+
if m.Phase.IsPending() {
201+
return false
202+
}
203+
204+
if !m.Conditions.IsTrue(api.ConditionTypeServing) {
205+
a.log.Debug("Member not yet serving")
194206
return false
195207
}
196208

0 commit comments

Comments
 (0)