Skip to content

Commit cc6ac8a

Browse files
committed
Iter
1 parent cef160d commit cc6ac8a

File tree

5 files changed

+80
-5
lines changed

5 files changed

+80
-5
lines changed

pkg/apis/deployment/v2alpha1/actions.generated.go

+13-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/deployment/agency/definitions.go

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const (
4747

4848
SupervisionKey = "Supervision"
4949
SupervisionMaintenanceKey = "Maintenance"
50+
SupervisionHealthKey = "Health"
5051

5152
TargetJobToDoKey = "ToDo"
5253
TargetJobPendingKey = "Pending"
@@ -74,6 +75,7 @@ func GetAgencyReadRequest(elements ...[]string) ReadRequest {
7475
func GetAgencyReadRequestFields() ReadRequest {
7576
return GetAgencyReadRequest([]string{
7677
GetAgencyKey(ArangoKey, SupervisionKey, SupervisionMaintenanceKey),
78+
GetAgencyKey(ArangoKey, SupervisionKey, SupervisionHealthKey),
7779
GetAgencyKey(ArangoKey, PlanKey, PlanCollectionsKey),
7880
GetAgencyKey(ArangoKey, PlanKey, PlanDatabasesKey),
7981
GetAgencyKey(ArangoKey, PlanKey, PlanDBServersKey),

pkg/deployment/agency/state/state.go

-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ type Plan struct {
6161
Coordinators ServerMap[string] `json:"Coordinators,omitempty"`
6262
}
6363

64-
type Supervision struct {
65-
Maintenance Timestamp `json:"Maintenance,omitempty"`
66-
}
67-
6864
type ShardCountDetails struct {
6965
Leader, Follower int
7066
}
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package state
22+
23+
type Supervision struct {
24+
Maintenance Timestamp `json:"Maintenance,omitempty"`
25+
26+
Health ServerMap[SupervisionHealthServer] `json:"Health,omitempty"`
27+
}
28+
29+
type SupervisionHealthServerStatus string
30+
31+
const (
32+
SupervisionHealthServerStatusGood SupervisionHealthServerStatus = "GOOD"
33+
)
34+
35+
type SupervisionHealthServerSyncStatus string
36+
37+
const (
38+
SupervisionHealthServerSyncStatusServing SupervisionHealthServerSyncStatus = "SERVING"
39+
)
40+
41+
type SupervisionHealthServer struct {
42+
Status SupervisionHealthServerStatus `json:"Status,omitempty"`
43+
SyncStatus SupervisionHealthServerSyncStatus `json:"SyncStatus,omitempty"`
44+
}
45+
46+
func (s SupervisionHealthServer) IsHealthy() bool {
47+
return s.Status == SupervisionHealthServerStatusGood && s.SyncStatus == SupervisionHealthServerSyncStatusServing
48+
}

pkg/deployment/reconcile/action_wait_for_member_ready.go

+17
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,28 @@ func (a *actionWaitForMemberReady) CheckProgress(ctx context.Context) (bool, boo
8080
a.log.Debug("DBServer not yet present")
8181
return false, false, nil
8282
}
83+
84+
if s, ok := cache.Supervision.Health[state.Server(member.ID)]; !ok {
85+
a.log.Debug("DBServer not yet present on the health")
86+
return false, false, nil
87+
} else if !s.IsHealthy() {
88+
a.log.Str("Status", string(s.Status)).Str("SyncStatus", string(s.SyncStatus)).Debug("DBServer not yet healthy")
89+
return false, false, nil
90+
}
91+
8392
case api.ServerGroupCoordinators:
8493
if !cache.Plan.Coordinators.Exists(state.Server(member.ID)) {
8594
a.log.Debug("Coordinator not yet present")
8695
return false, false, nil
8796
}
97+
98+
if s, ok := cache.Supervision.Health[state.Server(member.ID)]; !ok {
99+
a.log.Debug("Coordinator not yet present on the health")
100+
return false, false, nil
101+
} else if !s.IsHealthy() {
102+
a.log.Str("Status", string(s.Status)).Str("SyncStatus", string(s.SyncStatus)).Debug("DBServer not yet healthy")
103+
return false, false, nil
104+
}
88105
}
89106

90107
return member.Conditions.IsTrue(api.ConditionTypeReady), false, nil

0 commit comments

Comments
 (0)