Skip to content

Commit 2f39533

Browse files
author
shashidharatd
committed
Configurable file_descriptors limit for warden container
file_descriptors for a warden container is made configurable through deployment manifest. Currently the default is 16384 which is read from the database table and is not configurable. To configure, cf operator needs to add the following config variable under cc cc: container_file_descriptor_limit: 4096 [#82011156]
1 parent b0e4288 commit 2f39533

File tree

6 files changed

+23
-0
lines changed

6 files changed

+23
-0
lines changed

app/models/runtime/app.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ def before_save
138138
self.memory ||= Config.config[:default_app_memory]
139139
self.disk_quota ||= Config.config[:default_app_disk_in_mb]
140140

141+
if Config.config[:container_file_descriptor_limit]
142+
self.file_descriptors ||= Config.config[:container_file_descriptor_limit]
143+
end
144+
141145
set_new_version if version_needs_to_be_updated?
142146

143147
AppStopEvent.create_from_app(self) if generate_stop_event?

bosh-templates/cloud_controller_api.yml.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ default_app_memory: <%= p("cc.default_app_memory") %>
7474
default_app_disk_in_mb: <%= p("cc.default_app_disk_in_mb") %>
7575
maximum_app_disk_in_mb: <%= p("cc.maximum_app_disk_in_mb") %>
7676

77+
container_file_descriptor_limit: <%= p("cc.container_file_descriptor_limit") %>
78+
7779
request_timeout_in_seconds: <%= p("request_timeout_in_seconds") %>
7880

7981
cc_partition: <%= p("cc.cc_partition") %>

bosh-templates/cloud_controller_clock.yml.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ default_app_memory: <%= p("cc.default_app_memory") %>
7878
default_app_disk_in_mb: <%= p("cc.default_app_disk_in_mb") %>
7979
maximum_app_disk_in_mb: <%= p("cc.maximum_app_disk_in_mb") %>
8080

81+
container_file_descriptor_limit: <%= p("cc.container_file_descriptor_limit") %>
82+
8183
request_timeout_in_seconds: <%= p("request_timeout_in_seconds") %>
8284

8385
cc_partition: <%= p("cc.cc_partition") %>

bosh-templates/cloud_controller_worker.yml.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ default_app_memory: <%= p("cc.default_app_memory") %>
7474
default_app_disk_in_mb: <%= p("cc.default_app_disk_in_mb") %>
7575
maximum_app_disk_in_mb: <%= p("cc.maximum_app_disk_in_mb") %>
7676

77+
container_file_descriptor_limit: <%= p("cc.container_file_descriptor_limit") %>
78+
7779
request_timeout_in_seconds: <%= p("request_timeout_in_seconds") %>
7880

7981
cc_partition: <%= p("cc.cc_partition") %>

lib/cloud_controller/config.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class Config < VCAP::Config
4444
optional(:maximum_app_disk_in_mb) => Fixnum,
4545
:maximum_health_check_timeout => Fixnum,
4646

47+
optional(:container_file_descriptor_limit) => Fixnum,
48+
4749
optional(:allow_debug) => bool,
4850

4951
optional(:login) => {

spec/unit/models/runtime/app_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,17 @@ def self.it_does_not_mark_for_re_staging
16431643
expect(app.disk_quota).to eq(512)
16441644
end
16451645
end
1646+
1647+
describe 'container_file_descriptor_limit' do
1648+
before do
1649+
TestConfig.override({ container_file_descriptor_limit: 200 })
1650+
end
1651+
1652+
it 'uses the container_file_descriptor_limit config variable' do
1653+
app = App.create_from_hash(name: 'awesome app', space_guid: space.guid)
1654+
expect(app.file_descriptors).to eq(200)
1655+
end
1656+
end
16461657
end
16471658

16481659
describe 'saving' do

0 commit comments

Comments
 (0)