Skip to content

Commit

Permalink
controlplane: fix unable to re-use eni if parse config failed
Browse files Browse the repository at this point in the history
  • Loading branch information
l1b0k committed Nov 21, 2023
1 parent 5f0a1ce commit a4bbd50
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/controller/pod/pod_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ func (m *ReconcilePod) podCreate(ctx context.Context, pod *corev1.Pod) (reconcil
if utils.ISVKNode(node) {
return reconcile.Result{}, nil
}
nodeInfo, allocType, allocs, err := m.parse(ctx, pod, node)
if err != nil {
return reconcile.Result{}, fmt.Errorf("error parse config, %w", err)
}

// 1. check podENI is existed
prePodENI := &v1beta1.PodENI{}
Expand Down Expand Up @@ -234,8 +230,13 @@ func (m *ReconcilePod) podCreate(ctx context.Context, pod *corev1.Pod) (reconcil
}

// 2. cr is not found , so we will create new
nodeInfo, allocType, allocs, err := m.parse(ctx, pod, node)
if err != nil {
return reconcile.Result{}, fmt.Errorf("error parse config, %w", err)
}

l.Info("creating eni")

podENI := &v1beta1.PodENI{
ObjectMeta: metav1.ObjectMeta{
Name: pod.Name,
Expand Down

0 comments on commit a4bbd50

Please sign in to comment.