Skip to content

Commit e551f2b

Browse files
committed
address feedback
1 parent f75b01c commit e551f2b

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

changelog/20250808_fix_fixing_auth_transition_edge_cases.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ kind: fix
44
date: 2025-08-08
55
---
66

7-
* The agent returns ready if the cluster is ready to accept requests. The operator uses this information to continue operational actions like restarts.
8-
* This can be problematic during auth transitions. We can have a period where we invalidate one auth while the other is not activated yet and we try to use the not supported one
7+
* The readinessProbe always returns ready if the agent is in a wait step. This can be problematic during auth transitions as we can have a period where we invalidate one auth while the other is not activated yet and we try to use the not supported one.

controllers/om/automation_status.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/mongodb/mongodb-kubernetes/pkg/util/stringutil"
1616
)
1717

18-
const automationAgentKubeUpgradePlan = "ChangeVersionKube"
18+
const automationAgentKubeUpgradeMove = "ChangeVersionKube"
1919

2020
// AutomationStatus represents the status of automation agents registered with Ops Manager
2121
type AutomationStatus struct {
@@ -85,7 +85,7 @@ func checkAutomationStatusIsGoal(as *AutomationStatus, relevantProcesses []strin
8585

8686
goalsNotAchievedMap := map[string]int{}
8787
goalsAchievedMap := map[string]int{}
88-
authTransitionInProgress := map[string]string{}
88+
authTransitionsInProgress := map[string]string{}
8989

9090
for _, p := range as.Processes {
9191
if !stringutil.Contains(relevantProcesses, p.Name) {
@@ -94,13 +94,13 @@ func checkAutomationStatusIsGoal(as *AutomationStatus, relevantProcesses []strin
9494
if p.LastGoalVersionAchieved == as.GoalVersion {
9595
goalsAchievedMap[p.Name] = p.LastGoalVersionAchieved
9696

97-
// Check if authentication transitions are in the current plan
97+
// Check if authentication transitions are in the current plan.
9898
// If a process has reached goal version but still has auth-related moves in plan,
99-
// it means authentication transition is likely in progress
100-
// The plan contains non-completed move names from the API
99+
// it means authentication transition is likely in progress.
100+
// The plan contains non-completed move names from the API.
101101
for _, move := range p.Plan {
102102
if isAuthenticationTransitionMove(move) {
103-
authTransitionInProgress[p.Name] = move
103+
authTransitionsInProgress[p.Name] = move
104104
break
105105
}
106106
}
@@ -117,15 +117,15 @@ func checkAutomationStatusIsGoal(as *AutomationStatus, relevantProcesses []strin
117117
sort.Strings(goalsAchievedMsgList)
118118

119119
// Check if any authentication transitions are in progress
120-
if len(authTransitionInProgress) > 0 {
120+
if len(authTransitionsInProgress) > 0 {
121121
var authTransitionMsgList []string
122-
for processName, step := range authTransitionInProgress {
122+
for processName, step := range authTransitionsInProgress {
123123
authTransitionMsgList = append(authTransitionMsgList, fmt.Sprintf("%s:%s", processName, step))
124124
}
125125
log.Infow("Authentication transitions still in progress, waiting for completion",
126126
"processes", authTransitionMsgList)
127127
return false, fmt.Sprintf("authentication transitions in progress for %d processes: %s",
128-
len(authTransitionInProgress), authTransitionMsgList)
128+
len(authTransitionsInProgress), authTransitionMsgList)
129129
}
130130

131131
if len(goalsNotAchievedMap) > 0 {
@@ -155,12 +155,12 @@ func areAnyAgentsInKubeUpgradeMode(as *AutomationStatus, relevantProcesses []str
155155
if !stringutil.Contains(relevantProcesses, p.Name) {
156156
continue
157157
}
158-
for _, planStep := range p.Plan {
158+
for _, move := range p.Plan {
159159
// This means the following:
160160
// - the cluster is in static architecture
161161
// - the agents are in a dedicated upgrade process, waiting for their binaries to be replaced by kubernetes
162162
// - this can only happen if the statefulset is ready, therefore we are returning ready here
163-
if planStep == automationAgentKubeUpgradePlan {
163+
if move == automationAgentKubeUpgradeMove {
164164
log.Debug("cluster is in changeVersionKube mode, returning the agent is ready.")
165165
return true
166166
}

controllers/om/automation_status_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestCheckAutomationStatusIsGoal(t *testing.T) {
7575
},
7676
{
7777
Name: "b",
78-
Plan: []string{"FCV", automationAgentKubeUpgradePlan},
78+
Plan: []string{"FCV", automationAgentKubeUpgradeMove},
7979
LastGoalVersionAchieved: 1,
8080
},
8181
},

0 commit comments

Comments
 (0)