Skip to content

Commit ca90b9b

Browse files
authored
Make default_app_lifecycle configurable (#541)
1 parent a635825 commit ca90b9b

File tree

5 files changed

+48
-4
lines changed

5 files changed

+48
-4
lines changed

jobs/cloud_controller_ng/spec

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ provides:
144144
- cc.default_app_ssh_access
145145
- cc.default_health_check_timeout
146146
- cc.default_stack
147+
- cc.default_app_lifecycle
147148
- cc.disable_private_domain_cross_space_context_path_route_sharing
148149
- cc.droplets.blobstore_type
149150
- cc.droplets.cdn.key_pair_id
@@ -851,6 +852,10 @@ properties:
851852
default: false
852853
description: "Disable external (i.e. git) buildpacks? (Admin buildpacks and system buildpacks only.)"
853854

855+
cc.default_app_lifecycle:
856+
default: buildpack
857+
decription: "The default buildpack lifecycle for apps. Valid values are 'buildpack' (Classic Buildpacks) and 'cnb' (Cloud Native Buildpacks)"
858+
854859
cc.broker_client_timeout_seconds:
855860
default: 60
856861
description: "For requests to service brokers, this is the HTTP (open and read) timeout setting."

jobs/cloud_controller_ng/templates/cloud_controller_ng.yml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ internal_route_vip_range: <%= internal_vip_range %>
578578

579579
threadpool_size: <%= p("cc.experimental.thin_server.thread_pool_size") %>
580580

581-
default_app_lifecycle: buildpack
581+
default_app_lifecycle: <%= p("cc.default_app_lifecycle") %>
582582
custom_metric_tag_prefix_list: <%= p("cc.custom_metric_tag_prefix_list") %>
583583
update_metric_tags_on_rename: <%= p("cc.update_metric_tags_on_rename") %>
584584

jobs/cloud_controller_worker/templates/cloud_controller_ng.yml.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,6 @@ app_log_revision: <%= link("cloud_controller_internal").p("cc.app_log_revision")
363363

364364
publish_metrics: <%= p("cc.publish_metrics") %>
365365
prometheus_port: <%= p("cc.prometheus_port") %>
366-
366+
default_app_lifecycle: <%= link("cloud_controller_internal").p("cc.default_app_lifecycle") %>
367367
directories:
368-
tmpdir: <%= p("cc.directories.tmpdir") %>
368+
tmpdir: <%= p("cc.directories.tmpdir") %>

spec/cloud_controller_ng/cloud_controller_ng_spec.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,37 @@ module Test
962962
end
963963
end
964964
end
965+
966+
describe 'default_app_lifecycle' do
967+
context 'when it is not set' do
968+
it 'defaults to buildpack' do
969+
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
970+
expect(template_hash['default_app_lifecycle']).to eq('buildpack')
971+
end
972+
end
973+
974+
context 'when it is set to buidpack' do
975+
before do
976+
merged_manifest_properties['cc']['default_app_lifecycle'] = 'buidpack'
977+
end
978+
979+
it 'renders it as buidpack' do
980+
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
981+
expect(template_hash['default_app_lifecycle']).to eq('buidpack')
982+
end
983+
end
984+
985+
context 'when it is set to cnb' do
986+
before do
987+
merged_manifest_properties['cc']['default_app_lifecycle'] = 'cnb'
988+
end
989+
990+
it 'renders it as cnb' do
991+
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
992+
expect(template_hash['default_app_lifecycle']).to eq('cnb')
993+
end
994+
end
995+
end
965996
end
966997
end
967998
end

spec/cloud_controller_worker/cloud_controller_worker_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ module Test
8585
'temporary_enable_v2' => false,
8686
'packages' => {
8787
'max_valid_packages_stored' => 5
88-
}
88+
},
89+
'default_app_lifecycle' => 'cnb'
8990
}
9091
}
9192
end
@@ -362,6 +363,13 @@ module Test
362363
end
363364
end
364365
end
366+
367+
describe 'default_app_lifecycle' do
368+
it 'is set from cloud_controller_internal_link' do
369+
template_hash = YAML.safe_load(template.render(manifest_properties, consumes: links))
370+
expect(template_hash['default_app_lifecycle']).to eq('cnb')
371+
end
372+
end
365373
end
366374
end
367375
end

0 commit comments

Comments
 (0)