Skip to content

Conversation

@ajanikow
Copy link
Collaborator

@ajanikow ajanikow commented Nov 5, 2025

No description provided.

@cla-bot cla-bot bot added the cla-signed label Nov 5, 2025
@ajanikow ajanikow requested a review from Copilot November 5, 2025 17:11
Copy link

Copilot AI left a 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 updateClusterLicenseMember function
  • Added Active Failover mode detection to filter members by leader label
  • Applied the refactored function to both updateClusterLicenseKey and updateClusterLicenseAPI

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
Copy link

Copilot AI Nov 5, 2025

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'.

Suggested change
// For AF is different
// For AF, it is different

Copilot uses AI. Check for mistakes.
Comment on lines 120 to 146
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
})
}
Copy link

Copilot AI Nov 5, 2025

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.

Copilot uses AI. Check for mistakes.
@ajanikow ajanikow merged commit abcbab4 into master Nov 6, 2025
3 checks passed
@ajanikow ajanikow deleted the bugfix/platform/ensure_inventory_picks_active_leader branch November 6, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants