-
Notifications
You must be signed in to change notification settings - Fork 72
[Bugfix] [Platform] Ensure Inventory picks active leader #1986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bugfix] [Platform] Ensure Inventory picks active leader #1986
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors license member selection logic to ensure Active Failover deployments correctly select the active leader when managing licenses. The key change extracts duplicate member filtering code into a reusable function and adds special handling for Active Failover mode to only select members with the leader label.
- Extracted duplicate member filtering logic into
updateClusterLicenseMemberfunction - Added Active Failover mode detection to filter members by leader label
- Applied the refactored function to both
updateClusterLicenseKeyandupdateClusterLicenseAPI
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/deployment/reconcile/plan_builder_license.go | Extracts member selection logic into new function with Active Failover leader filtering; refactors duplicate code in license key and API methods |
| CHANGELOG.md | Documents the bugfix for Active Failover leader selection in inventory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if spec.Mode.Get() == api.DeploymentModeActiveFailover { | ||
| cache := context.ACS().CurrentClusterCache() | ||
|
|
||
| // For AF is different |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment 'For AF is different' is grammatically incorrect. It should be 'AF is different' or 'For AF it is different'.
| // For AF is different | |
| // For AF, it is different |
| func (r *Reconciler) updateClusterLicenseMember(spec api.DeploymentSpec, status api.DeploymentStatus, context PlanBuilderContext) (api.DeploymentStatusMemberElement, bool) { | ||
| members := status.Members.AsListInGroups(arangod.GroupsWithLicenseV2()...).Filter(func(a api.DeploymentStatusMemberElement) bool { | ||
| i := a.Member.Image | ||
| if i == nil { | ||
| return false | ||
| } | ||
|
|
||
| return i.ArangoDBVersion.CompareTo("3.9.0") >= 0 && i.Enterprise | ||
| }) | ||
|
|
||
| if spec.Mode.Get() == api.DeploymentModeActiveFailover { | ||
| cache := context.ACS().CurrentClusterCache() | ||
|
|
||
| // For AF is different | ||
| members = members.Filter(func(a api.DeploymentStatusMemberElement) bool { | ||
| pod, ok := cache.Pod().V1().GetSimple(a.Member.Pod.GetName()) | ||
| if !ok { | ||
| return false | ||
| } | ||
|
|
||
| if _, ok := pod.Labels[k8sutil.LabelKeyArangoLeader]; ok { | ||
| return true | ||
| } | ||
|
|
||
| return false | ||
| }) | ||
| } |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function lacks documentation explaining its purpose, parameters, and return values. Consider adding a comment that explains this function selects an appropriate member for license operations, with special handling for Active Failover mode to ensure the leader is selected.
No description provided.