Skip to content

Commit

Permalink
fix: return new error when no ncs found in nnc crd (#2061)
Browse files Browse the repository at this point in the history
Co-authored-by: Jaeryn <[email protected]>
  • Loading branch information
jaer-tsun and Jaeryn authored Jul 17, 2023
1 parent 8f5a2b2 commit dc37cef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cns/service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,11 @@ func reconcileInitialCNSState(ctx context.Context, cli nodeNetworkConfigGetter,
return errors.Wrap(err, "failed to init CNS state: failed to get NNC CRD")
}

logger.Printf("Retrieved NNC: %+v", nnc)

// If there are no NCs, we can't initialize our state and we should fail out.
if len(nnc.Status.NetworkContainers) == 0 {
return errors.Wrap(err, "failed to init CNS state: no NCs found in NNC CRD")
return errors.New("failed to init CNS state: no NCs found in NNC CRD")
}

// For each NC, we need to create a CreateNetworkContainerRequest and use it to rebuild our state.
Expand Down

0 comments on commit dc37cef

Please sign in to comment.