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 <tsch@microsoft.com>
  • Loading branch information
jaer-tsun and Jaeryn committed Jul 17, 2023
1 parent a1b90ca commit 243863d
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 @@ -1008,9 +1008,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 243863d

Please sign in to comment.