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

🐛 Remove the conditional on ipv6 #2397

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/services/govmomi/ipam/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func parseAddressWithPrefix(ipamAddress *ipamv1.IPAddress) (netip.Prefix, error)
// does not conflict with the gateway addresses parsed from other
// ipamv1.IPAddresses on the current device. Gateway addresses must be the same
// family as the address on the ipamv1.IPAddress. Gateway addresses of one
// family must match the other addresses of the same family. IPv4 Gateways are
// required, but IPv6 gateways are not.
// family must match the other addresses of the same family. A gateway address
// is optional. If it is not set this function returns `nil, nil`.
func parseGateway(ipamAddress *ipamv1.IPAddress, addressWithPrefix netip.Prefix, ipamDeviceConfig ipamDeviceConfig) (*netip.Addr, error) {
if ipamAddress.Spec.Gateway == "" && addressWithPrefix.Addr().Is6() {
if ipamAddress.Spec.Gateway == "" {
return nil, nil
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/services/govmomi/ipam/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,7 @@ func Test_BuildState(t *testing.T) {
g.Expect(ctx.Client.Update(ctx, address1)).NotTo(gomega.HaveOccurred())

_, err := BuildState(ctx, networkStatus)
g.Expect(err).To(gomega.HaveOccurred())
g.Expect(err).To(gomega.MatchError("IPAddress my-namespace/vsphereVM1-0-0 has invalid gateway: \"\""))
g.Expect(err).NotTo(gomega.HaveOccurred())
})

t.Run("when a provider assigns an IPv6 IPAddress without a Gateway field", func(_ *testing.T) {
Expand Down
Loading