Skip to content

Commit 9629d50

Browse files
authored
refactor: merge status and gpu controllers into one
1 parent 3ddcf92 commit 9629d50

8 files changed

Lines changed: 621 additions & 1294 deletions

File tree

cmd/main.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@ func main() {
187187
os.Exit(1)
188188
}
189189

190-
if err := (&controller.GpuStatusReconciler{
191-
Client: mgr.GetClient(),
192-
}).SetupWithManager(mgr); err != nil {
193-
setupLog.Error(err, "Failed to set up GPU status reconciler")
194-
os.Exit(1)
195-
}
196-
197190
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
198191
setupLog.Error(err, "Failed to set up health check")
199192
os.Exit(1)

internal/controller/conditions.go

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const (
3838
reasonReadError = "ReadError" // Kubernetes API read failed
3939
)
4040

41-
// computeReadySummary derives the Ready summary condition from the four managed conditions.
41+
// computeReadySummary derives the Ready summary condition from the four managed inputs.
4242
// Priority: any False beats any Unknown beats all True.
4343
// The reason and message are taken from the first condition that determines the outcome,
4444
// in dependency order (Preflight -> HelmInstalled -> DriverReady -> ValidatorPassed).
@@ -88,25 +88,3 @@ func computeReadySummary(conditions []metav1.Condition, generation int64) metav1
8888
ObservedGeneration: generation,
8989
}
9090
}
91-
92-
// setCondition writes a condition entry, passing status, reason, and message directly so
93-
// callers retain full control over the tri-state (True / False / Unknown).
94-
func setCondition(conditions *[]metav1.Condition, condType string, status metav1.ConditionStatus, reason, message string, generation int64) {
95-
apimeta.SetStatusCondition(conditions, metav1.Condition{
96-
Type: condType,
97-
Status: status,
98-
Reason: reason,
99-
Message: message,
100-
ObservedGeneration: generation,
101-
})
102-
}
103-
104-
// conditionMatches returns true when the named condition already carries the given status, reason, and message.
105-
// Used to skip a no-op status patch when nothing changed.
106-
func conditionMatches(conditions []metav1.Condition, condType string, status metav1.ConditionStatus, reason, message string) bool {
107-
c := apimeta.FindStatusCondition(conditions, condType)
108-
if c == nil {
109-
return false
110-
}
111-
return c.Status == status && c.Reason == reason && c.Message == message
112-
}

0 commit comments

Comments
 (0)