Skip to content

Commit

Permalink
enable dual stack support
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoehler committed Nov 26, 2024
1 parent db919e5 commit 84bbf1c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/bosh_aws_cpi/lib/cloud/aws/instance_param_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,8 @@ def instance_params
nic[:subnet_id] = subnet_id if subnet_id

# only supporting one ip address for now (either ipv4 or ipv6)
if private_ip_address
if ipv6_address?(private_ip_address)
nic[:ipv_6_addresses] = [{ipv_6_address: private_ip_address}]
else
nic[:private_ip_address] = private_ip_address
end
end
nic[:ipv_6_addresses] = [{ipv_6_address: private_ipv6_address}] if !private_ipv6_address.nil?
nic[:private_ip_address] = private_ip_address if !private_ip_address.nil?

nic[:associate_public_ip_address] = vm_type.auto_assign_public_ip unless vm_type.auto_assign_public_ip.nil?

Expand Down Expand Up @@ -149,7 +144,16 @@ def ipv6_address?(addr)

def private_ip_address
first_manual_network = networks_cloud_props.filter('manual').first
first_manual_network.ip unless first_manual_network.nil?
return first_manual_network.ip if !first_manual_network.nil? && !ipv6_address?(first_manual_network.ip)
second_manual_network = networks_cloud_props.filter('manual')[1]
second_manual_network.ip if !second_manual_network.nil? && !ipv6_address?(second_manual_network.ip)
end

def private_ipv6_address
first_manual_network = networks_cloud_props.filter('manual').first
return first_manual_network.ip if !first_manual_network.nil? && ipv6_address?(first_manual_network.ip)
second_manual_network = networks_cloud_props.filter('manual')[1]
second_manual_network.ip if !second_manual_network.nil? && ipv6_address?(second_manual_network.ip)
end

# NOTE: do NOT lookup the subnet (from EC2 client) anymore. We just need to
Expand Down

0 comments on commit 84bbf1c

Please sign in to comment.