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

Add a config parameter to enable dualstack if needed #166

Merged
merged 1 commit into from
Aug 7, 2024
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
2 changes: 1 addition & 1 deletion src/bosh_aws_cpi/lib/cloud/aws/aws_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def initialize_params(endpoint)
retry_limit: @aws_config.max_retries,
logger: @logger,
log_level: :debug,
use_dualstack_endpoint: true,
use_dualstack_endpoint: @aws_config.dualstack,
}
if @aws_config.region
params[:region] = @aws_config.region
Expand Down
2 changes: 2 additions & 0 deletions src/bosh_aws_cpi/lib/cloud/aws/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class AwsConfig
attr_reader :region, :ec2_endpoint, :elb_endpoint, :stemcell
attr_reader :access_key_id, :secret_access_key, :default_key_name, :encrypted, :kms_key_arn
attr_reader :default_iam_instance_profile, :default_security_groups, :metadata_options
attr_reader :dualstack

CREDENTIALS_SOURCE_STATIC = 'static'.freeze
CREDENTIALS_SOURCE_ENV_OR_PROFILE = 'env_or_profile'.freeze
Expand All @@ -13,6 +14,7 @@ def initialize(aws_config_hash)
@config = aws_config_hash

@max_retries = @config['max_retries']
@dualstack = @config['dualstack']

@region = @config['region']
@ec2_endpoint = @config['ec2_endpoint']
Expand Down
3 changes: 2 additions & 1 deletion src/bosh_aws_cpi/spec/integration/aws_cpi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
'region' => @region,
'default_key_name' => 'default_key_name',
'fast_path_delete' => 'yes',
'max_retries' => 0
'max_retries' => 0,
'dualstack' => false
},
'registry' => {
'endpoint' => 'fake',
Expand Down
3 changes: 2 additions & 1 deletion src/bosh_aws_cpi/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def mock_cloud_options
'default_key_name' => 'sesame',
'default_security_groups' => [],
'max_retries' => 8,
'source_dest_check' => false
'source_dest_check' => false,
'dualstack' => false
},
'registry' => {
'endpoint' => 'localhost:42288',
Expand Down
2 changes: 1 addition & 1 deletion src/bosh_aws_cpi/spec/unit/aws_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
logger: logger,
log_level: :debug,
region: 'us-east-1',
use_dualstack_endpoint: true
use_dualstack_endpoint: false
}
end
let(:ec2_client) { instance_double(Aws::EC2::Client) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
'max_retries' => 8,
'encrypted' => false,
'kms_key_arn' => nil,
'metadata_options' => nil
'metadata_options' => nil,
'dualstack' => false
},
'registry' => {
'endpoint' => 'http://admin:[email protected]:25777',
Expand Down Expand Up @@ -170,6 +171,16 @@
end
end

context 'enable dualstack to use different api endpoints' do
before do
manifest['properties']['aws']['dualstack'] = true
end

it 'overrides the default value' do
expect(subject['cloud']['properties']['aws']['dualstack']).to eq(true)
end
end

context 'given a default_iam_instance_profile' do
it 'uses the value set' do
manifest['properties']['aws']['default_iam_instance_profile'] = 'some_default_instance_profile'
Expand Down