Skip to content

Commit 1ea8e8b

Browse files
tcdowneyJaskanwal Pawar
andcommitted
use internal_service_port for eirini staging completion callback
Related: cloudfoundry/cf-for-k8s#465 [#174455375](https://www.pivotaltracker.com/story/show/174455375) Co-authored-by: Tim Downey <[email protected]> Co-authored-by: Jaskanwal Pawar <[email protected]>
1 parent aa19fd5 commit 1ea8e8b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/cloud_controller/opi/stager_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def get_lifecycle(staging_details, staging_guid, action_builder)
118118

119119
def staging_completion_callback(staging_details)
120120
if config.kubernetes_api_configured?
121-
port = 80
121+
port = config.get(:internal_service_port)
122122
scheme = 'http'
123123
else
124124
port = config.get(:tls_port)

spec/unit/lib/cloud_controller/opi/stager_client_spec.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
auth_password: 'internal_password'
1515
},
1616
internal_service_hostname: 'api.internal.cf',
17+
internal_service_port: '9090',
1718
kubernetes: kubernetes_config,
1819
)
1920
end
2021
let(:eirini_url) { 'http://eirini.loves.heimdall:777' }
2122
let(:staging_guid) { 'some_staging_guid' }
2223
let(:kubernetes_config) { {} }
2324

24-
let(:staging_details) { stub_staging_details(lifecycle_type) }
25+
let(:staging_details) { stub_staging_details(lifecycle_type, staging_guid) }
2526
let(:lifecycle_data) { stub_lifecycle_data }
2627

2728
let(:lifecycle_environment_variables) { [
@@ -72,7 +73,7 @@
7273
environment: [{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
7374
{ name: 'MEMORY_LIMIT', value: '256m' },
7475
{ name: 'VCAP_SERVICES', value: '{}' }],
75-
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging//build_completed?start=',
76+
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
7677
lifecycle: {
7778
buildpack_lifecycle: {
7879
droplet_upload_uri: "http://cc-uploader.service.cf.internal:9091/v1/droplet/#{staging_guid}?cc-droplet-upload-uri=http://upload.me",
@@ -110,7 +111,7 @@
110111
{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
111112
{ name: 'MEMORY_LIMIT', value: '256m' },
112113
{ name: 'VCAP_SERVICES', value: '{}' }],
113-
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging//build_completed?start=',
114+
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
114115
lifecycle: {
115116
buildpack_lifecycle: {
116117
droplet_upload_uri: "http://cc-uploader.service.cf.internal:9091/v1/droplet/#{staging_guid}?cc-droplet-upload-uri=http://upload.me",
@@ -174,7 +175,7 @@
174175
environment: [{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
175176
{ name: 'MEMORY_LIMIT', value: '256m' },
176177
{ name: 'VCAP_SERVICES', value: '{}' }],
177-
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging//build_completed?start=',
178+
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
178179
lifecycle: {
179180
docker_lifecycle: {
180181
image: 'docker.io/some/image',
@@ -200,7 +201,7 @@
200201
stager_client.stage(staging_guid, staging_details)
201202
expect(WebMock).to have_requested(:post, "#{eirini_url}/stage/#{staging_guid}").with { |req|
202203
parsed_json = JSON.parse(req.body)
203-
parsed_json['completion_callback'] == 'http://internal_user:[email protected]:80/internal/v3/staging//build_completed?start='
204+
parsed_json['completion_callback'] == 'http://internal_user:[email protected]:9090/internal/v3/staging/some_staging_guid/build_completed?start='
204205
}
205206
end
206207
end
@@ -217,7 +218,7 @@
217218
end
218219
end
219220

220-
def stub_staging_details(lifecycle_type)
221+
def stub_staging_details(lifecycle_type, staging_guid)
221222
space = VCAP::CloudController::Space.make(
222223
name: 'outer',
223224
guid: 'outer-guid',
@@ -240,6 +241,7 @@ def stub_staging_details(lifecycle_type)
240241
staging_details.lifecycle = double(type: lifecycle_type)
241242
staging_details.staging_disk_in_mb = 100
242243
staging_details.staging_memory_in_mb = 200
244+
staging_details.staging_guid = staging_guid
243245
staging_details
244246
end
245247

0 commit comments

Comments
 (0)