Skip to content

Commit

Permalink
Bugfix: migrate vmi eip not exist in dst hyper ipset
Browse files Browse the repository at this point in the history
Vmi migrate, if vmi hyper change, vmi ip must change,
check it if hyper change vmi ip not change, it means
vmi info not sync finished.

ISSUE: #7
  • Loading branch information
lucheng0127 committed Nov 30, 2023
1 parent f2bf3d7 commit 02e888a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions buildfile/operator/Dockerfile_operator
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY cmd/operator/main.go cmd/main.go
COPY api/ api/
COPY internal/controller/ internal/controller/
COPY pkg/ pkg/
COPY buildfile/operator/arp.go pkg/manager/arp.go

# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
Expand Down
13 changes: 13 additions & 0 deletions buildfile/operator/arp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package manager

type ArpManager interface {
AddTarget(string)
DeleteTarget(string)
Poisoning()
}

var ArpMgr ArpManager

func RegisterAndRunArpManager(dev string) error {
return nil
}
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kind: Kustomization
images:
- name: controller
newName: quay.io/shawnlu0127/eipbinding_operator
newTag: "20231128"
newTag: "20231130"
7 changes: 7 additions & 0 deletions internal/controller/eipbinding_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ func (r *EipBindingReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return ctrl.Result{}, nil
}

// For vmi, if hyper change, vmi ip must change, so if vmi ip not change
// it means vmi is migrate and the vmi info not sync finished
if eb.Spec.CurrentHyper != newHyper && eb.Spec.CurrentIPAddr == newIPAddr {
log.Info("VMI info not update finished, skip")
return ctrl.Result{}, nil
}

// Handle vmi info change
staleHyper := eb.Spec.CurrentHyper
staleIPAddr := eb.Spec.CurrentIPAddr
Expand Down

0 comments on commit 02e888a

Please sign in to comment.