Skip to content

Commit

Permalink
use internal_service_port for eirini staging completion callback
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tcdowney and Jaskanwal Pawar committed Sep 22, 2020
1 parent aa19fd5 commit 1ea8e8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/cloud_controller/opi/stager_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_lifecycle(staging_details, staging_guid, action_builder)

def staging_completion_callback(staging_details)
if config.kubernetes_api_configured?
port = 80
port = config.get(:internal_service_port)
scheme = 'http'
else
port = config.get(:tls_port)
Expand Down
14 changes: 8 additions & 6 deletions spec/unit/lib/cloud_controller/opi/stager_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
auth_password: 'internal_password'
},
internal_service_hostname: 'api.internal.cf',
internal_service_port: '9090',
kubernetes: kubernetes_config,
)
end
let(:eirini_url) { 'http://eirini.loves.heimdall:777' }
let(:staging_guid) { 'some_staging_guid' }
let(:kubernetes_config) { {} }

let(:staging_details) { stub_staging_details(lifecycle_type) }
let(:staging_details) { stub_staging_details(lifecycle_type, staging_guid) }
let(:lifecycle_data) { stub_lifecycle_data }

let(:lifecycle_environment_variables) { [
Expand Down Expand Up @@ -72,7 +73,7 @@
environment: [{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
{ name: 'MEMORY_LIMIT', value: '256m' },
{ name: 'VCAP_SERVICES', value: '{}' }],
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging//build_completed?start=',
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
lifecycle: {
buildpack_lifecycle: {
droplet_upload_uri: "http://cc-uploader.service.cf.internal:9091/v1/droplet/#{staging_guid}?cc-droplet-upload-uri=http://upload.me",
Expand Down Expand Up @@ -110,7 +111,7 @@
{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
{ name: 'MEMORY_LIMIT', value: '256m' },
{ name: 'VCAP_SERVICES', value: '{}' }],
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging//build_completed?start=',
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
lifecycle: {
buildpack_lifecycle: {
droplet_upload_uri: "http://cc-uploader.service.cf.internal:9091/v1/droplet/#{staging_guid}?cc-droplet-upload-uri=http://upload.me",
Expand Down Expand Up @@ -174,7 +175,7 @@
environment: [{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
{ name: 'MEMORY_LIMIT', value: '256m' },
{ name: 'VCAP_SERVICES', value: '{}' }],
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging//build_completed?start=',
completion_callback: 'https://internal_user:[email protected]:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
lifecycle: {
docker_lifecycle: {
image: 'docker.io/some/image',
Expand All @@ -200,7 +201,7 @@
stager_client.stage(staging_guid, staging_details)
expect(WebMock).to have_requested(:post, "#{eirini_url}/stage/#{staging_guid}").with { |req|
parsed_json = JSON.parse(req.body)
parsed_json['completion_callback'] == 'http://internal_user:[email protected]:80/internal/v3/staging//build_completed?start='
parsed_json['completion_callback'] == 'http://internal_user:[email protected]:9090/internal/v3/staging/some_staging_guid/build_completed?start='
}
end
end
Expand All @@ -217,7 +218,7 @@
end
end

def stub_staging_details(lifecycle_type)
def stub_staging_details(lifecycle_type, staging_guid)
space = VCAP::CloudController::Space.make(
name: 'outer',
guid: 'outer-guid',
Expand All @@ -240,6 +241,7 @@ def stub_staging_details(lifecycle_type)
staging_details.lifecycle = double(type: lifecycle_type)
staging_details.staging_disk_in_mb = 100
staging_details.staging_memory_in_mb = 200
staging_details.staging_guid = staging_guid
staging_details
end

Expand Down

0 comments on commit 1ea8e8b

Please sign in to comment.