Skip to content

Commit f95de45

Browse files
authored
[Bugfix] Ensure Single workflow (#1831)
1 parent 1392679 commit f95de45

File tree

8 files changed

+38
-26
lines changed

8 files changed

+38
-26
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,6 @@ sync-charts:
979979
sync: sync-charts
980980

981981
ci-check:
982-
@$(MAKE) tidy vendor patch generate update-generated synchronize-v2alpha1-with-v1 sync fmt yamlfmt license protolint
982+
@$(MAKE) tidy vendor generate update-generated synchronize-v2alpha1-with-v1 sync fmt yamlfmt license protolint
983983
@git checkout -- go.sum # ignore changes in go.sum
984984
@if [ ! -z "$$(git status --porcelain)" ]; then echo "There are uncommited changes!"; git status; exit 1; fi

pkg/deployment/agency/definitions.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const (
3535
CurrentKey = "Current"
3636
TargetKey = "Target"
3737

38-
CurrentMaintenanceServers = "MaintenanceServers"
39-
CurrentServersKnown = "ServersKnown"
38+
CurrentMaintenanceDBServers = "MaintenanceDBServers"
39+
CurrentServersKnown = "ServersKnown"
4040

4141
TargetHotBackupKey = "HotBackup"
4242

@@ -82,7 +82,7 @@ func GetAgencyReadRequestFields() ReadRequest {
8282
GetAgencyKey(ArangoKey, PlanKey, PlanCoordinatorsKey),
8383
GetAgencyKey(ArangoKey, CurrentKey, PlanCollectionsKey),
8484
GetAgencyKey(ArangoKey, CurrentKey, CurrentServersKnown),
85-
GetAgencyKey(ArangoKey, CurrentKey, CurrentMaintenanceServers),
85+
GetAgencyKey(ArangoKey, CurrentKey, CurrentMaintenanceDBServers),
8686
GetAgencyKey(ArangoKey, TargetKey, TargetHotBackupKey),
8787
GetAgencyKey(ArangoKey, TargetKey, TargetJobToDoKey),
8888
GetAgencyKey(ArangoKey, TargetKey, TargetJobPendingKey),

pkg/deployment/agency/state/current_maintenance_servers.go

Lines changed: 3 additions & 3 deletions
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.
@@ -20,9 +20,9 @@
2020

2121
package state
2222

23-
type CurrentMaintenanceServers map[Server]CurrentMaintenanceServer
23+
type CurrentMaintenanceDBServers map[Server]CurrentMaintenanceServer
2424

25-
func (s CurrentMaintenanceServers) InMaintenance(server Server) bool {
25+
func (s CurrentMaintenanceDBServers) InMaintenance(server Server) bool {
2626
if v, ok := s[server]; ok {
2727
return v.InMaintenance()
2828
}

pkg/deployment/agency/state/state.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ type ServerKnown struct {
4747
}
4848

4949
type Current struct {
50-
MaintenanceServers CurrentMaintenanceServers `json:"MaintenanceServers,omitempty"`
51-
Collections CurrentCollections `json:"Collections"`
50+
MaintenanceDBServers CurrentMaintenanceDBServers `json:"MaintenanceDBServers,omitempty"`
51+
Collections CurrentCollections `json:"Collections"`
5252

5353
// ServersKnown stores information about ArangoDB servers.
5454
ServersKnown ServerMap[ServerKnown] `json:"ServersKnown,omitempty"`

pkg/deployment/agency/state/target.go

Lines changed: 1 addition & 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.

pkg/deployment/reconcile/action_wait_for_member_ready.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ func (a *actionWaitForMemberReady) CheckProgress(ctx context.Context) (bool, boo
6868
return true, false, nil
6969
}
7070

71-
cache, ok := a.actionCtx.GetAgencyCache()
72-
if !ok {
73-
a.log.Debug("AgencyCache is not ready")
74-
return false, false, nil
75-
}
76-
7771
switch a.action.Group {
7872
case api.ServerGroupDBServers:
73+
cache, ok := a.actionCtx.GetAgencyCache()
74+
if !ok {
75+
a.log.Debug("AgencyCache is not ready")
76+
return false, false, nil
77+
}
78+
7979
if !cache.Plan.DBServers.Exists(state.Server(member.ID)) {
8080
a.log.Debug("DBServer not yet present")
8181
return false, false, nil
@@ -90,6 +90,12 @@ func (a *actionWaitForMemberReady) CheckProgress(ctx context.Context) (bool, boo
9090
}
9191

9292
case api.ServerGroupCoordinators:
93+
cache, ok := a.actionCtx.GetAgencyCache()
94+
if !ok {
95+
a.log.Debug("AgencyCache is not ready")
96+
return false, false, nil
97+
}
98+
9399
if !cache.Plan.Coordinators.Exists(state.Server(member.ID)) {
94100
a.log.Debug("Coordinator not yet present")
95101
return false, false, nil
@@ -104,5 +110,9 @@ func (a *actionWaitForMemberReady) CheckProgress(ctx context.Context) (bool, boo
104110
}
105111
}
106112

113+
if member.Conditions.IsTrue(api.ConditionTypePendingRestart) || member.Conditions.IsTrue(api.ConditionTypePendingUpdate) {
114+
return true, false, nil
115+
}
116+
107117
return member.Conditions.IsTrue(api.ConditionTypeReady), false, nil
108118
}

pkg/deployment/reconcile/action_wait_for_member_up.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (a *actionWaitForMemberUp) CheckProgress(ctx context.Context) (bool, bool,
7777
case api.ServerGroupTypeArangoD:
7878
switch a.actionCtx.GetMode() {
7979
case api.DeploymentModeSingle:
80-
return a.checkProgressSingle(ctxChild), false, nil
80+
return a.checkProgressSingle(), false, nil
8181
case api.DeploymentModeActiveFailover:
8282
if a.action.Group == api.ServerGroupAgents {
8383
return a.checkProgressAgent(), false, nil
@@ -99,16 +99,18 @@ func (a *actionWaitForMemberUp) CheckProgress(ctx context.Context) (bool, bool,
9999

100100
// checkProgressSingle checks the progress of the action in the case
101101
// of a single server.
102-
func (a *actionWaitForMemberUp) checkProgressSingle(ctx context.Context) bool {
103-
c, err := a.actionCtx.GetMembersState().State().GetDatabaseClient()
104-
if err != nil {
105-
a.log.Err(err).Debug("Failed to create database client")
102+
func (a *actionWaitForMemberUp) checkProgressSingle() bool {
103+
m, found := a.actionCtx.GetMemberStatusByID(a.MemberID())
104+
if !found {
105+
a.log.Error("No such member")
106106
return false
107107
}
108-
if _, err := c.Version(ctx); err != nil {
109-
a.log.Err(err).Debug("Failed to get version")
108+
109+
if !m.Conditions.IsTrue(api.ConditionTypeActive) {
110+
a.log.Debug("Member not yet active")
110111
return false
111112
}
113+
112114
return true
113115
}
114116

@@ -187,8 +189,8 @@ func (a *actionWaitForMemberUp) checkProgressCluster(ctx context.Context) bool {
187189
}
188190
}
189191

190-
if !m.Conditions.IsTrue(api.ConditionTypeReady) {
191-
a.log.Debug("Member not yet ready")
192+
if !m.Conditions.IsTrue(api.ConditionTypeActive) {
193+
a.log.Debug("Member not yet active")
192194
return false
193195
}
194196

pkg/deployment/resources/pod_inspector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
308308

309309
// Member Maintenance
310310
if agencyCachePresent {
311-
if agencyCache.Current.MaintenanceServers.InMaintenance(state.Server(memberStatus.ID)) {
311+
if agencyCache.Current.MaintenanceDBServers.InMaintenance(state.Server(memberStatus.ID)) {
312312
if memberStatus.Conditions.Update(api.ConditionTypeMemberMaintenanceMode, true, "ArangoDB Member maintenance enabled", "") {
313313
updateMemberStatusNeeded = true
314314
nextInterval = nextInterval.ReduceTo(recheckSoonPodInspectorInterval)

0 commit comments

Comments
 (0)