mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] Respect ToBeCleanedServers in Agency (#1146)
This commit is contained in:
parent
95112f0b9d
commit
2ce6245e95
3 changed files with 17 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
|||
- (Feature) ID ServerGroup
|
||||
- (Bugfix) Propagate Lifecycle Mount
|
||||
- (Feature) PVC Member Status info
|
||||
- (Feature) Respect ToBeCleanedServers in Agency
|
||||
|
||||
## [1.2.19](https://github.com/arangodb/kube-arangodb/tree/1.2.19) (2022-10-05)
|
||||
- (Bugfix) Prevent changes when UID is wrong
|
||||
|
|
|
@ -31,6 +31,7 @@ type StateTarget struct {
|
|||
// Servers Section
|
||||
|
||||
CleanedServers Servers `json:"CleanedServers,omitempty"`
|
||||
ToBeCleanedServers Servers `json:"ToBeCleanedServers,omitempty"`
|
||||
|
||||
// HotBackup section
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ func (r *Reconciler) createScalePlan(status api.DeploymentStatus, members api.Me
|
|||
Debug("Creating scale-up plan")
|
||||
} else if len(members) > count {
|
||||
// Note, we scale down 1 member at a time
|
||||
if m, err := members.SelectMemberToRemove(getCleanedServer(context), topologyMissingMemberToRemoveSelector(status.Topology), topologyAwarenessMemberToRemoveSelector(group, status.Topology)); err != nil {
|
||||
if m, err := members.SelectMemberToRemove(getCleanedServer(context), getToBeCleanedServer(context), topologyMissingMemberToRemoveSelector(status.Topology), topologyAwarenessMemberToRemoveSelector(group, status.Topology)); err != nil {
|
||||
r.planLogger.Err(err).Str("role", group.AsRole()).Warn("Failed to select member to remove")
|
||||
} else {
|
||||
ready, message := groupReadyForRestart(context, status, m, group)
|
||||
|
@ -180,6 +180,19 @@ func getCleanedServer(ctx reconciler.ArangoAgencyGet) api.MemberToRemoveSelector
|
|||
}
|
||||
}
|
||||
|
||||
func getToBeCleanedServer(ctx reconciler.ArangoAgencyGet) api.MemberToRemoveSelector {
|
||||
return func(m api.MemberStatusList) (string, error) {
|
||||
if a, ok := ctx.GetAgencyCache(); ok {
|
||||
for _, member := range m {
|
||||
if a.Target.ToBeCleanedServers.Contains(agency.Server(member.ID)) {
|
||||
return member.ID, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Reconciler) scaleDownCandidate(ctx context.Context, apiObject k8sutil.APIObject,
|
||||
spec api.DeploymentSpec, status api.DeploymentStatus,
|
||||
context PlanBuilderContext) api.Plan {
|
||||
|
|
Loading…
Reference in a new issue