Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions jobs/cc_deployment_updater/spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ templates:
resource_pool_ca_cert.pem.erb: config/certs/resource_pool_ca_cert.pem
droplets_ca_cert.pem.erb: config/certs/droplets_ca_cert.pem
buildpacks_ca_cert.pem.erb: config/certs/buildpacks_ca_cert.pem
storage_cli_config_droplets.json.erb: config/storage_cli_config_droplets.json
storage_cli_config_packages.json.erb: config/storage_cli_config_packages.json
storage_cli_config_buildpacks.json.erb: config/storage_cli_config_buildpacks.json
storage_cli_config_resource_pool.json.erb: config/storage_cli_config_resource_pool.json

packages:
- capi_utils
Expand Down Expand Up @@ -222,3 +226,24 @@ properties:
cc.locket.port:
default: 8891
description: "Port of the Locket server"

cc.resource_pool.blobstore_provider:
description: "The provider of blobstore storage cli to use. Valid values: ['AzureRM']"
default: ~
cc.resource_pool.connection_config:
description: "Azure Storage Cli connection hash"
cc.packages.blobstore_provider:
description: "The provider of blobstore storage cli to use. Valid values: ['AzureRM']"
default: ~
cc.packages.connection_config:
description: "Azure Storage Cli connection hash"
cc.droplets.blobstore_provider:
description: "The provider of blobstore storage cli to use. Valid values: ['AzureRM']"
default: ~
cc.droplets.connection_config:
description: "Azure Storage Cli connection hash"
cc.buildpacks.blobstore_provider:
description: "The provider of blobstore storage cli to use. Valid values: ['AzureRM']"
default: ~
cc.buildpacks.connection_config:
description: "Azure Storage Cli connection hash"
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ maximum_health_check_timeout: <%= link("cloud_controller_internal").p("cc.maximu

stacks_file: /var/vcap/jobs/cloud_controller_ng/config/stacks.yml

storage_cli_config_file_droplets: /var/vcap/jobs/cc_deployment_updater/config/storage_cli_config_droplets.json
storage_cli_config_file_buildpacks: /var/vcap/jobs/cc_deployment_updater/config/storage_cli_config_buildpacks.json
storage_cli_config_file_packages: /var/vcap/jobs/cc_deployment_updater/config/storage_cli_config_packages.json
storage_cli_config_file_resource_pool: /var/vcap/jobs/cc_deployment_updater/config/storage_cli_config_resource_pool.json

resource_pool:
blobstore_type: <%= link("cloud_controller_internal").p("cc.resource_pool.blobstore_type") %>
webdav_config:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<%
require "json"

# Ensure Azure CLI connection_config has a default timeout if none is set
def cli_cfg_with_default_timeout(connection_cfg, blobstore_type, default_seconds: 41)
cfg = (connection_cfg || {}).dup
if blobstore_type == 'storage_cli'
if !cfg.key?('put_timeout_in_seconds') || cfg['put_timeout_in_seconds'].to_s.empty?
cfg['put_timeout_in_seconds'] = default_seconds.to_s
end
end
cfg
end

# helper: add key only when value is present
def add(h, key, val)
return if val.nil?
return if val.respond_to?(:empty?) && val.empty?
h[key] = val
end

scope = "cc.buildpacks.connection_config"
provider = p("cc.buildpacks.blobstore_provider", nil)

if provider != "AzureRM"
options = {} # for now: all non-azure providers output an empty JSON object
else
options = {}
options["provider"] = provider
options["account_name"] = p("#{scope}.azure_storage_account_name")
options["container_name"] = p("#{scope}.container_name")
add(options, "account_key", p("#{scope}.azure_storage_access_key"))
add(options, "environment", p("#{scope}.environment", "AzureCloud"))
add(options, "put_timeout_in_seconds", p("#{scope}.put_timeout_in_seconds", nil))

# optional passthrough for extra storage-cli flags
begin
custom = p("#{scope}.custom", {})
if custom.respond_to?(:each)
custom.each { |k, v| add(options, k.to_s, v) }
end
rescue
# ignore if property not defined
end
options = cli_cfg_with_default_timeout(options, 'storage_cli')
end
-%>
<%= JSON.pretty_generate(options) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<%
require "json"

# Ensure Azure CLI connection_config has a default timeout if none is set
def cli_cfg_with_default_timeout(connection_cfg, blobstore_type, default_seconds: 41)
cfg = (connection_cfg || {}).dup
if blobstore_type == 'storage_cli'
if !cfg.key?('put_timeout_in_seconds') || cfg['put_timeout_in_seconds'].to_s.empty?
cfg['put_timeout_in_seconds'] = default_seconds.to_s
end
end
cfg
end

# helper: add key only when value is present
def add(h, key, val)
return if val.nil?
return if val.respond_to?(:empty?) && val.empty?
h[key] = val
end

scope = "cc.droplets.connection_config"
provider = p("cc.droplets.blobstore_provider", nil)

if provider != "AzureRM"
options = {} # for now: all non-azure providers output an empty JSON object
else
options = {}
options["provider"] = provider
options["account_name"] = p("#{scope}.azure_storage_account_name")
options["container_name"] = p("#{scope}.container_name")
add(options, "account_key", p("#{scope}.azure_storage_access_key"))
add(options, "environment", p("#{scope}.environment", "AzureCloud"))
add(options, "put_timeout_in_seconds", p("#{scope}.put_timeout_in_seconds", nil))

# optional passthrough for extra storage-cli flags
begin
custom = p("cc.droplets.connection_config.custom", {})
if custom.respond_to?(:each)
custom.each { |k, v| add(options, k.to_s, v) }
end
rescue
# ignore if property not defined
end
options = cli_cfg_with_default_timeout(options, 'storage_cli')
end
-%>
<%= JSON.pretty_generate(options) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<%
require "json"

# Ensure Azure CLI connection_config has a default timeout if none is set
def cli_cfg_with_default_timeout(connection_cfg, blobstore_type, default_seconds: 41)
cfg = (connection_cfg || {}).dup
if blobstore_type == 'storage_cli'
if !cfg.key?('put_timeout_in_seconds') || cfg['put_timeout_in_seconds'].to_s.empty?
cfg['put_timeout_in_seconds'] = default_seconds.to_s
end
end
cfg
end

# helper: add key only when value is present
def add(h, key, val)
return if val.nil?
return if val.respond_to?(:empty?) && val.empty?
h[key] = val
end

scope = "cc.packages.connection_config"
provider = p("cc.packages.blobstore_provider", nil)

if provider != "AzureRM"
options = {} # for now: all non-azure providers output an empty JSON object
else
options = {}
options["provider"] = provider
options["account_name"] = p("#{scope}.azure_storage_account_name")
options["container_name"] = p("#{scope}.container_name")
add(options, "account_key", p("#{scope}.azure_storage_access_key"))
add(options, "environment", p("#{scope}.environment", "AzureCloud"))
add(options, "put_timeout_in_seconds", p("#{scope}.put_timeout_in_seconds", nil))

# optional passthrough for extra storage-cli flags
begin
custom = p("#{scope}.custom", {})
if custom.respond_to?(:each)
custom.each { |k, v| add(options, k.to_s, v) }
end
rescue
# ignore if property not defined
end
options = cli_cfg_with_default_timeout(options, 'storage_cli')
end
-%>
<%= JSON.pretty_generate(options) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<%
require "json"

# Ensure Azure CLI connection_config has a default timeout if none is set
def cli_cfg_with_default_timeout(connection_cfg, blobstore_type, default_seconds: 41)
cfg = (connection_cfg || {}).dup
if blobstore_type == 'storage_cli'
if !cfg.key?('put_timeout_in_seconds') || cfg['put_timeout_in_seconds'].to_s.empty?
cfg['put_timeout_in_seconds'] = default_seconds.to_s
end
end
cfg
end

# helper: add key only when value is present
def add(h, key, val)
return if val.nil?
return if val.respond_to?(:empty?) && val.empty?
h[key] = val
end

scope = "cc.resource_pool.connection_config"
provider = p("cc.resource_pool.blobstore_provider", nil)

if provider != "AzureRM"
options = {} # for now: all non-azure providers output an empty JSON object
else
options = {}
options["provider"] = provider
options["account_name"] = p("#{scope}.azure_storage_account_name")
options["container_name"] = p("#{scope}.container_name")
add(options, "account_key", p("#{scope}.azure_storage_access_key"))
add(options, "environment", p("#{scope}.environment", "AzureCloud"))
add(options, "put_timeout_in_seconds", p("#{scope}.put_timeout_in_seconds", nil))

# optional passthrough for extra storage-cli flags
begin
custom = p("#{scope}.custom", {})
if custom.respond_to?(:each)
custom.each { |k, v| add(options, k.to_s, v) }
end
rescue
# ignore if property not defined
end
options = cli_cfg_with_default_timeout(options, 'storage_cli')
end
-%>
<%= JSON.pretty_generate(options) %>