LB Healthcheck was not using the right private ipv4. now it supports VMs with bigger subnet than /32. Also nic serializer had the same issue. now based on the provided netmask, it returns the right address.
14 lines
393 B
Ruby
14 lines
393 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Serializers::Nic < Serializers::Base
|
|
def self.serialize_internal(nic, options = {})
|
|
{
|
|
id: nic.ubid,
|
|
name: nic.name,
|
|
private_ipv4: (nic.private_ipv4.netmask.prefix_len == 32) ? nic.private_ipv4.network.to_s : nic.private_ipv4.nth(1).to_s,
|
|
private_ipv6: nic.private_ipv6.nth(2).to_s,
|
|
vm_name: nic.vm&.name
|
|
}
|
|
end
|
|
end
|