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

webhook: fix ip validation when pod is annotated with an ippool name #3284

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

zhangzujian
Copy link
Member

@zhangzujian zhangzujian commented Oct 8, 2023

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes
  • Docs
  • Tests

Which issue(s) this PR fixes:

Fixes #(issue-number)

WHAT

🤖 Generated by Copilot at 3c6f76c

Add IPPool support and improve error handling in static_ip.go webhook. This allows users to assign static IPs to pods from predefined IP ranges and enhances the validation of IP conflicts.

🤖 Generated by Copilot at 3c6f76c

In the web of hooks, we claim our domain
With IPPool resources, we forge our chains
No conflict shall escape our validateIPConflict
We pass the context and handle the error with respect

HOW

🤖 Generated by Copilot at 3c6f76c

  • Add ctx parameter to validateIPConflict function to pass context from webhook request (link, link)
  • Import k8s.io/apimachinery/pkg/types package to use NamespacedName type for identifying IPPool resources (link)
  • Extend IPPool annotation logic to support both IP addresses and IPPool names, and validate IPPool subnet if present (link)
  • Improve error handling for net.ParseIP function to return informative message if annotation value is invalid (link)

@zhangzujian zhangzujian added bug Something isn't working need backport webhook labels Oct 8, 2023
@zhangzujian zhangzujian marked this pull request as ready for review October 8, 2023 06:06
@zhangzujian zhangzujian requested a review from oilbeater October 8, 2023 06:06
@zhangzujian zhangzujian merged commit f9edd66 into kubeovn:master Oct 9, 2023
58 checks passed
@zhangzujian zhangzujian deleted the fix-webhook branch October 9, 2023 01:31
zhangzujian added a commit to zhangzujian/kube-ovn that referenced this pull request Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need backport webhook
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants