Skip to content

Conversation

@ikaven1024
Copy link

What type of PR is this?

Bug fixes

What this PR does / why we need it:

func (t *Tide) Reconcile(ctx context.Context, tideNodePool *apis.TideNodePool) error {
logger := klog.FromContext(ctx).WithValues("tideNodePool", tideNodePool.GetName())
logger.V(2).Info("start Reconcile")
defer logger.V(2).Info("end Reconcile")
// Add finalizer first
if !controllerutil.ContainsFinalizer(tideNodePool, NodePoolFinalizer) && tideNodePool.DeletionTimestamp.IsZero() {
controllerutil.AddFinalizer(tideNodePool, NodePoolFinalizer)
tideNodePool, err := t.client.InternalClient.TideV1alpha1().TideNodePools().Update(ctx, tideNodePool, metav1.UpdateOptions{})
if err != nil {
klog.ErrorS(err, "fail to add finalizer", "rule", tideNodePool.Name)
return err
}
}

When TideNodePool update failed, tideNodePool is set to be nil, and logging tideNodePool.Name will panic.

Which issue(s) this PR fixes:

Special notes for your reviewer:

@CLAassistant
Copy link

CLAassistant commented Sep 6, 2024

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Sep 6, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.23%. Comparing base (cf87c77) to head (d5f3da7).
⚠️ Report is 782 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #695      +/-   ##
==========================================
+ Coverage   57.04%   57.23%   +0.19%     
==========================================
  Files         556      568      +12     
  Lines       53320    54665    +1345     
==========================================
+ Hits        30417    31289     +872     
- Misses      19080    19453     +373     
- Partials     3823     3923     +100     
Flag Coverage Δ
unittest 57.23% <100.00%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants