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

metallb addon fails to deploy when already existing IPAddressPool conflicts with the one to be deployed #832

Open
pmalek opened this issue Oct 10, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@pmalek
Copy link
Member

pmalek commented Oct 10, 2023

Problem statement

When trying to deploy the metallb addon (or another addon that depend on it) and there already exists an IPAddressPool which conflicts with the one to be deployed then the following error is blocking the deployment:

Message: "admission webhook \"ipaddresspoolvalidationwebhook.metallb.io\" denied the request: CIDR \"172.18.0.100/30\" in pool \"ktf-pool\" overlaps with already defined CIDR \"172.18.0.100/30\"",
Reason: "CIDR \"172.18.0.100/30\" in pool \"ktf-pool\" overlaps with already defined CIDR \"172.18.0.100/30\"",
Details: *k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails nil,
Code: 403

type of the error: https://pkg.go.dev/k8s.io/apimachinery/pkg/api/errors#StatusError

relevant piece of code:

_, err = res.Create(ctx, &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": "metallb.io/v1beta1",
"kind": "IPAddressPool",
"metadata": map[string]string{
"name": addressPoolName,
},
"spec": map[string]interface{}{
"addresses": []string{
fmt.Sprintf("%s-%s", ipStart, ipEnd),
fmt.Sprintf("%s-%s", ip6Start, ip6End),
},
},
},
}, metav1.CreateOptions{})
if err != nil {
if errors.IsAlreadyExists(err) {
// delete the existing resource and recreate it in another round of loop.
err = res.Delete(ctx, addressPoolName, metav1.DeleteOptions{})
}
select {
case <-time.After(time.Second):
lastErr = err
continue
case <-ctx.Done():
return fmt.Errorf("failed to create metallb.io/v1beta1 IPAddressPool: %w, last error on create: %v", ctx.Err(), lastErr)
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant