Skip to content

Commit

Permalink
report event when ip alloc failed
Browse files Browse the repository at this point in the history
Signed-off-by: l1b0k <[email protected]>
  • Loading branch information
l1b0k committed Sep 18, 2024
1 parent 7ae80f3 commit 025fc2d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/controller/multi-ip/node/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,20 @@ func (n *ReconcileNode) addIP(ctx context.Context, unSucceedPods map[string]*Pod

updateCrCondition(options)

n.recordEvents(err, node)

Check warning on line 635 in pkg/controller/multi-ip/node/pool.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/multi-ip/node/pool.go#L635

Added line #L635 was not covered by tests

// the err is kept
return err
}

func (n *ReconcileNode) recordEvents(err error, node *networkv1beta1.Node) {
if err == nil {
return

Check warning on line 643 in pkg/controller/multi-ip/node/pool.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/multi-ip/node/pool.go#L641-L643

Added lines #L641 - L643 were not covered by tests
}

n.record.Event(node, corev1.EventTypeWarning, "AllocIPFailed", err.Error())

Check warning on line 646 in pkg/controller/multi-ip/node/pool.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/multi-ip/node/pool.go#L646

Added line #L646 was not covered by tests
}

// updateCrCondition record openAPI error to cr
func updateCrCondition(options []*eniOptions) {
lo.ForEach(options, func(item *eniOptions, index int) {
Expand Down

0 comments on commit 025fc2d

Please sign in to comment.