-
Notifications
You must be signed in to change notification settings - Fork 109
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(controller): fix bug if cnr or cnc is not found in lister #168
fix(controller): fix bug if cnr or cnc is not found in lister #168
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
==========================================
- Coverage 50.94% 50.87% -0.08%
==========================================
Files 409 409
Lines 38930 38946 +16
==========================================
- Hits 19834 19814 -20
- Misses 16877 16926 +49
+ Partials 2219 2206 -13
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
09e55d5
to
4aadc46
Compare
4aadc46
to
1253f13
Compare
Signed-off-by: caohe <caohe9603@gmail.com>
@@ -308,6 +311,12 @@ func (cl *CNRLifecycle) updateOrCreateCNR(node *corev1.Node) error { | |||
if err != nil && !errors.IsAlreadyExists(err) { | |||
return fmt.Errorf("failed to create cnr %s: %v", cnr.Name, err) | |||
} | |||
if errors.IsAlreadyExists(err) { | |||
cnr, err = cl.client.InternalClient.NodeV1alpha1().CustomNodeResources().Get(cl.ctx, node.Name, metav1.GetOptions{ResourceVersion: "0"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it also fix updateOrCreateCNC
of cnc lifecycle like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, cnc will be fixed in a later pr.
Signed-off-by: caohe <caohe9603@gmail.com>
What type of PR is this?
Bug fixes
What this PR does / why we need it:
Fix bug if cnr or cnc is not found in lister.
Which issue(s) this PR fixes:
Special notes for your reviewer: