Skip to content

Commit

Permalink
detect missing podSetInfo and raise fatal error (#98)
Browse files Browse the repository at this point in the history
Avoid crashing the operator with an index-out-of-bounds panic
when a misconfiguration results in a workload being in the Resuming
phase without the expected assignment of PodSetInfos by Kueue.
This can happen when running in dev mode (no webhooks) and the
input appwrapper yaml didn't explicitly set suspend to True.
  • Loading branch information
dgrove-oss authored Apr 16, 2024
1 parent 57b6c82 commit bd2235b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/controller/appwrapper/resource_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ func (r *AppWrapperReconciler) createComponent(ctx context.Context, aw *workload
for podSetsIdx, podSet := range component.PodSets {
toInject := &workloadv1beta2.AppWrapperPodSetInfo{}
if !r.Config.StandaloneMode {
toInject = &component.PodSetInfos[podSetsIdx]
if podSetsIdx < len(component.PodSetInfos) {
toInject = &component.PodSetInfos[podSetsIdx]
} else {
return nil, fmt.Errorf("missing podSetInfo %v for component %v", podSetsIdx, componentIdx), true
}
}

p, err := utils.GetRawTemplate(obj.UnstructuredContent(), podSet.Path)
Expand Down

0 comments on commit bd2235b

Please sign in to comment.