diff --git a/internal/registry/ip/storage.go b/internal/registry/ip/storage.go index de591b6a..64e6da91 100644 --- a/internal/registry/ip/storage.go +++ b/internal/registry/ip/storage.go @@ -6,6 +6,7 @@ package ip import ( "context" "fmt" + "strings" "github.com/ironcore-dev/ironcore-net/api/core/v1alpha1" "github.com/ironcore-dev/ironcore-net/apimachinery/api/net" @@ -64,7 +65,7 @@ func (r *REST) beginCreate(ctx context.Context, obj runtime.Object, opts *metav1 ip.Spec.IP = addr } metav1.SetMetaDataLabel(&ip.ObjectMeta, v1alpha1.IPFamilyLabel, string(alloc.IPFamily())) - metav1.SetMetaDataLabel(&ip.ObjectMeta, v1alpha1.IPIPLabel, addr.String()) + metav1.SetMetaDataLabel(&ip.ObjectMeta, v1alpha1.IPIPLabel, strings.ReplaceAll(addr.String(), ":", "-")) return func(ctx context.Context, success bool) { if success { diff --git a/internal/registry/ipallocator/ipallocator.go b/internal/registry/ipallocator/ipallocator.go index 508badc5..0e976f65 100644 --- a/internal/registry/ipallocator/ipallocator.go +++ b/internal/registry/ipallocator/ipallocator.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "net/netip" + "strings" "time" "github.com/ironcore-dev/ironcore-net/api/core/v1alpha1" @@ -89,7 +90,7 @@ func (a *Allocator) allocate(namespace string, claimRef v1alpha1.IPClaimRef, ip func (a *Allocator) getIPFromLister(namespace string, addr netip.Addr) (*v1alpha1.IP, error) { ips, err := a.ipLister.IPs(namespace).List(labels.SelectorFromSet(labels.Set{ v1alpha1.IPFamilyLabel: string(a.ipFamily), - v1alpha1.IPIPLabel: addr.String(), + v1alpha1.IPIPLabel: strings.ReplaceAll(addr.String(), ":", "-"), })) if err != nil { return nil, err