Skip to content
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

SKS-2393: Check if the IP from IPPool is already in use #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

haijianyang
Copy link
Contributor

@haijianyang haijianyang commented Mar 28, 2024

Issue

如果 IPPool 中有些 IP 已经被非 ElfMachine 使用了,IP 分配到 ElfMachine 后,创建虚拟机会导致 IP 冲突,且需要花一定的时间排查。

Change

目前从 IPPool 过滤被非 ElfMachine 使用的 IP 实现难道较大。
简单起见,从 IPPool 获取到 IP 后,先 ping 一下 IP 是否已经被使用,如果还没有被使用继续正常的创建流程。如果 IP 已经被使用,给 ElfMachine 设置 WaitingForStaticIPAllocationReason 和相关的错误信息。用户发现该错误后,可以处理已经被使用的 IP,之后 ElfMachine 的创建流程会继续正常进行。

workflow 运行 make test 报错 listen ip4:icmp : socket: operation not permitted,因此改成 sudo -E sh -c 'make test',

Test

  1. 在 IPPool 中配置已经被使用的 IP
  2. 使用该 IPPool 创建集群,观察到 elfMachine 会被设置 WaitingForStaticIPAllocationReason
  3. 释放 IPPool 中已经被使用的 IP,观察到 elfMachine 的创建流程会继续正常进行

Copy link

codecov bot commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 68.96552% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 68.45%. Comparing base (d5d7b1d) to head (4b1a0fb).

Files Patch % Lines
pkg/util/network.go 66.66% 4 Missing and 2 partials ⚠️
controllers/elfmachine_controller.go 72.72% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #38      +/-   ##
==========================================
+ Coverage   68.40%   68.45%   +0.04%     
==========================================
  Files           2        3       +1     
  Lines         307      336      +29     
==========================================
+ Hits          210      230      +20     
- Misses         81       86       +5     
- Partials       16       20       +4     

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

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.

1 participant