-
Notifications
You must be signed in to change notification settings - Fork 274
Description
Description
Description
The graph builder uses panic() instead of proper error handling when encountering unexpected CRD configurations, which can crash the entire kro controller process in production.
Problem
panic() halts the entire controller, causing service downtime, poor UX, and loss of all active reconciliations.
Current Code
if len(crdCopy.Spec.Versions) != 1 || crdCopy.Spec.Versions[0].Schema == nil {
panic("Expected CRD to have exactly one version with schema defined")
}
Proposed Fix
Replace panic() with proper error handling:
if len(crdCopy.Spec.Versions) != 1 {
return nil, fmt.Errorf("expected one version, got %d", len(crdCopy.Spec.Versions))
}
if crdCopy.Spec.Versions[0].Schema == nil {
return nil, fmt.Errorf("schema is nil in version 0")
}
Benefits
Prevents full controller crash
Provides clear error messages
Which option describes the most your issue?
No response