Skip to content

Commit

Permalink
Merge pull request #2397 from ekarlso/fix-2396
Browse files Browse the repository at this point in the history
🐛 Remove the conditional on ipv6
  • Loading branch information
k8s-ci-robot authored Oct 4, 2023
2 parents 631d738 + 43bf20b commit f386f78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
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

0 comments on commit f386f78

Please sign in to comment.