Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return new error when no ncs found in nnc crd #2061

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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