Skip to content

Commit 83d860e

Browse files
committed
Remove cc_internal_api_user and cc_internal_api_password
mTLS is required to communicate with the internal api. Therefore internal user and password can be removed.
1 parent 2b22b64 commit 83d860e

16 files changed

+7
-75
lines changed

app/controllers/internal/app_crashed_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'sinatra'
22
require 'controllers/base/base_controller'
3-
require 'cloud_controller/internal_api'
43

54
module VCAP::CloudController
65
class AppCrashedController < RestController::BaseController

app/controllers/internal/app_rescheduling_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'sinatra'
22
require 'controllers/base/base_controller'
3-
require 'cloud_controller/internal_api'
43

54
module VCAP::CloudController
65
class AppReschedulingController < RestController::BaseController

app/controllers/internal/staging_completion_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'sinatra'
22
require 'controllers/base/base_controller'
3-
require 'cloud_controller/internal_api'
43
require 'cloud_controller/diego/failure_reason_sanitizer'
54
require 'cloud_controller/telemetry_logger'
65

app/controllers/internal/task_completion_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'sinatra'
22
require 'controllers/base/base_controller'
3-
require 'cloud_controller/internal_api'
43
require 'cloud_controller/diego/task_completion_handler'
54

65
module VCAP::CloudController

config/bosh-lite.yml

-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ instance_file_descriptor_limit: 16384
4343

4444
request_timeout_in_seconds: 900
4545

46-
internal_api:
47-
auth_user: internal_user
48-
auth_password: "internal-password"
49-
5046
nginx:
5147
use_nginx: false
5248
instance_socket: "/var/vcap/sys/run/cloud_controller_ng/cloud_controller.sock"

config/cloud_controller.yml

-4
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ route_services_enabled: true
138138
volume_services_enabled: true
139139
disable_private_domain_cross_space_context_path_route_sharing: false
140140

141-
internal_api:
142-
auth_user: internal_user
143-
auth_password: internal_password
144-
145141
# App staging parameters
146142
staging:
147143
# Max duration for staging process

lib/cloud_controller/config.rb

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
require 'cloud_controller/config_schemas/vms/deployment_updater_schema'
1919
require 'cloud_controller/config_schemas/vms/rotate_database_key_schema'
2020
require 'utils/hash_utils'
21-
require 'cloud_controller/internal_api'
2221

2322
module VCAP::CloudController
2423
class Config
@@ -124,7 +123,6 @@ def configure_components
124123
run_initializers
125124

126125
ProcessObserver.configure(dependency_locator.stagers, dependency_locator.runners)
127-
InternalApi.configure(self)
128126
@schema_class.configure_components(self)
129127
end
130128

lib/cloud_controller/config_schemas/vms/api_schema.rb

-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ class ApiSchema < VCAP::Config
3939
optional(:temporary_oci_buildpack_mode) => enum('oci-phase-1', NilClass),
4040
enable_declarative_asset_downloads: bool,
4141
},
42-
43-
internal_api: {
44-
auth_user: String,
45-
auth_password: String,
46-
},
4742
}
4843
end
4944

lib/cloud_controller/config_schemas/vms/clock_schema.rb

-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ class ClockSchema < VCAP::Config
3636
optional(:temporary_oci_buildpack_mode) => enum('oci-phase-1', NilClass),
3737
enable_declarative_asset_downloads: bool,
3838
},
39-
40-
internal_api: {
41-
auth_user: String,
42-
auth_password: String,
43-
},
4439
}
4540
end
4641

lib/cloud_controller/config_schemas/vms/worker_schema.rb

-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ class WorkerSchema < VCAP::Config
3636
optional(:temporary_oci_buildpack_mode) => enum('oci-phase-1', NilClass),
3737
enable_declarative_asset_downloads: bool,
3838
},
39-
40-
internal_api: {
41-
auth_user: String,
42-
auth_password: String,
43-
},
4439
}
4540
end
4641

lib/cloud_controller/diego/task_recipe_builder.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ def staging_completion_callback(config, staging_details)
9696
port = config.get(:tls_port)
9797
scheme = 'https'
9898

99-
auth = "#{config.get(:internal_api, :auth_user)}:#{CGI.escape(config.get(:internal_api, :auth_password))}"
10099
host_port = "#{config.get(:internal_service_hostname)}:#{port}"
101100
path = "/internal/v3/staging/#{staging_details.staging_guid}/build_completed?start=#{staging_details.start_after_staging}"
102-
"#{scheme}://#{auth}@#{host_port}#{path}"
101+
"#{scheme}://#{host_port}#{path}"
103102
end
104103

105104
def cpu_weight(task)

lib/cloud_controller/internal_api.rb

-16
This file was deleted.

lib/cloud_controller/opi/stager_client.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,15 @@ def get_lifecycle(staging_details, staging_guid, action_builder)
119119
def staging_completion_callback(staging_details)
120120
if config.kubernetes_api_configured?
121121
port = config.get(:internal_service_port)
122-
auth = '' # on Kubernetes we are relying on NetworkPolicy and Istio AuthorizationPolicy for authz
123122
scheme = 'http'
124123
else
125124
port = config.get(:tls_port)
126-
auth = "#{config.get(:internal_api, :auth_user)}:#{CGI.escape(config.get(:internal_api, :auth_password))}@"
127125
scheme = 'https'
128126
end
129127

130128
host_port = "#{config.get(:internal_service_hostname)}:#{port}"
131129
path = "/internal/v3/staging/#{staging_details.staging_guid}/build_completed?start=#{staging_details.start_after_staging}"
132-
"#{scheme}://#{auth}#{host_port}#{path}"
130+
"#{scheme}://#{host_port}#{path}"
133131
end
134132

135133
def build_env(environment)

spec/fixtures/config/port_8181_config.yml

-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ loggregator:
6464
doppler:
6565
url: 'wss://doppler.the-system-domain.com:443'
6666

67-
internal_api:
68-
auth_user: internal_user
69-
auth_password: internal_password
70-
7167
nginx:
7268
use_nginx: false
7369
instance_socket: "/var/vcap/sys/run/cloud_controller_ng/cloud_controller.sock"

spec/unit/lib/cloud_controller/diego/task_recipe_builder_spec.rb

+2-14
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ module Diego
4646
Config.new({
4747
tls_port: tls_port,
4848
internal_service_hostname: internal_service_hostname,
49-
internal_api: {
50-
auth_user: user,
51-
auth_password: password
52-
},
5349
staging: {
5450
timeout_in_seconds: 90,
5551
},
@@ -63,8 +59,6 @@ module Diego
6359
let(:isolation_segment) { 'potato-segment' }
6460
let(:internal_service_hostname) { 'internal.awesome.sauce' }
6561
let(:tls_port) { '7773' }
66-
let(:user) { 'user' }
67-
let(:password) { 'pass[%3a]word' }
6862
let(:rule_dns_everywhere) do
6963
::Diego::Bbs::Models::SecurityGroupRule.new(
7064
protocol: 'udp',
@@ -157,7 +151,7 @@ module Diego
157151
expect(result.image_layers).to eq(lifecycle_image_layers)
158152
expect(result.cpu_weight).to eq(50)
159153

160-
expect(result.completion_callback_url).to eq("https://#{user}:#{CGI.escape(password)}@#{internal_service_hostname}:#{tls_port}" \
154+
expect(result.completion_callback_url).to eq("https://#{internal_service_hostname}:#{tls_port}" \
161155
"/internal/v3/staging/#{droplet.guid}/build_completed?start=#{staging_details.start_after_staging}")
162156

163157
timeout_action = result.action.timeout_action
@@ -291,7 +285,7 @@ module Diego
291285

292286
it 'sets the completion callback' do
293287
result = task_recipe_builder.build_staging_task(config, staging_details)
294-
expect(result.completion_callback_url).to eq("https://#{user}:#{CGI.escape(password)}@#{internal_service_hostname}:#{tls_port}" \
288+
expect(result.completion_callback_url).to eq("https://#{internal_service_hostname}:#{tls_port}" \
295289
"/internal/v3/staging/#{droplet.guid}/build_completed?start=#{staging_details.start_after_staging}")
296290
end
297291

@@ -368,10 +362,6 @@ module Diego
368362
Config.new({
369363
tls_port: tls_port,
370364
internal_service_hostname: internal_service_hostname,
371-
internal_api: {
372-
auth_user: user,
373-
auth_password: password
374-
},
375365
diego: {
376366
lifecycle_bundles: { 'buildpack/potato-stack': 'potato_lifecycle_bundle_url' },
377367
pid_limit: 100,
@@ -382,8 +372,6 @@ module Diego
382372
let(:isolation_segment) { 'potato-segment' }
383373
let(:internal_service_hostname) { 'internal.awesome.sauce' }
384374
let(:tls_port) { '7777' }
385-
let(:user) { 'user' }
386-
let(:password) { 'password' }
387375
let(:rule_dns_everywhere) do
388376
::Diego::Bbs::Models::SecurityGroupRule.new(
389377
protocol: 'udp',

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

+3-7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
cc_uploader_url: 'http://cc-uploader.service.cf.internal:9091'
1010
},
1111
tls_port: 8182,
12-
internal_api: {
13-
auth_user: 'internal_user',
14-
auth_password: 'internal_password'
15-
},
1612
internal_service_hostname: 'api.internal.cf',
1713
internal_service_port: '9090',
1814
kubernetes: kubernetes_config,
@@ -73,7 +69,7 @@
7369
environment: [{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
7470
{ name: 'MEMORY_LIMIT', value: '256m' },
7571
{ name: 'VCAP_SERVICES', value: '{}' }],
76-
completion_callback: 'https://internal_user:internal_password@api.internal.cf:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
72+
completion_callback: 'https://api.internal.cf:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
7773
lifecycle: {
7874
buildpack_lifecycle: {
7975
droplet_upload_uri: "http://cc-uploader.service.cf.internal:9091/v1/droplet/#{staging_guid}?cc-droplet-upload-uri=http://upload.me",
@@ -111,7 +107,7 @@
111107
{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
112108
{ name: 'MEMORY_LIMIT', value: '256m' },
113109
{ name: 'VCAP_SERVICES', value: '{}' }],
114-
completion_callback: 'https://internal_user:internal_password@api.internal.cf:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
110+
completion_callback: 'https://api.internal.cf:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
115111
lifecycle: {
116112
buildpack_lifecycle: {
117113
droplet_upload_uri: "http://cc-uploader.service.cf.internal:9091/v1/droplet/#{staging_guid}?cc-droplet-upload-uri=http://upload.me",
@@ -175,7 +171,7 @@
175171
environment: [{ name: 'VCAP_APPLICATION', value: '{"wow":"pants"}' },
176172
{ name: 'MEMORY_LIMIT', value: '256m' },
177173
{ name: 'VCAP_SERVICES', value: '{}' }],
178-
completion_callback: 'https://internal_user:internal_password@api.internal.cf:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
174+
completion_callback: 'https://api.internal.cf:8182/internal/v3/staging/some_staging_guid/build_completed?start=',
179175
lifecycle: {
180176
docker_lifecycle: {
181177
image: 'docker.io/some/image',

0 commit comments

Comments
 (0)