-
Notifications
You must be signed in to change notification settings - Fork 9
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
Do not error out if no ip is available in a prefix #551
Conversation
cb63feb
to
7603269
Compare
@@ -560,6 +561,12 @@ func (r *networkResource) freeNetwork(request *restful.Request, response *restfu | |||
for _, prefix := range nw.Prefixes { | |||
err = r.ipamer.ReleaseChildPrefix(ctx, prefix) | |||
if err != nil { | |||
var connectErr *connect.Error | |||
if errors.As(err, &connectErr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we cannot skip here as then we have orphaned prefixes after freeing the network.
@@ -439,8 +437,11 @@ func allocateSpecificIP(ctx context.Context, parent *metal.Network, specificIP s | |||
func allocateRandomIP(ctx context.Context, parent *metal.Network, ipamer ipam.IPAMer) (ipAddress, parentPrefixCidr string, err error) { | |||
for _, prefix := range parent.Prefixes { | |||
ipAddress, err = ipamer.AllocateIP(ctx, prefix) | |||
if err != nil && errors.Is(err, goipam.ErrNoIPAvailable) { | |||
continue | |||
var connectErr *connect.Error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check for err != nil is missing here
@@ -730,6 +743,12 @@ func (r *networkResource) deleteNetwork(request *restful.Request, response *rest | |||
for _, p := range nw.Prefixes { | |||
err := r.ipamer.DeletePrefix(ctx, p) | |||
if err != nil { | |||
var connectErr *connect.Error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
ee1c960
to
c8ca47a
Compare
…o do-not-error-if-no-ip-available-in-prefix
c8ca47a
to
6889816
Compare
closes: #550
Depends on: metal-stack/go-ipam#157