From 4627e71b2b296213af61be8c035c7544095a94de Mon Sep 17 00:00:00 2001 From: Philipp Thun Date: Mon, 27 Nov 2023 16:11:11 +0100 Subject: [PATCH] Add statsd_host + statsd_port to cloud_controller_clock job Don't rely on default values, but use the configured statsd host + port as done by the cc_deployment_updater job. --- .../templates/cloud_controller_ng.yml.erb | 3 +++ spec/.rubocop.yml | 2 +- .../cloud_controller_clock_spec.rb | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/jobs/cloud_controller_clock/templates/cloud_controller_ng.yml.erb b/jobs/cloud_controller_clock/templates/cloud_controller_ng.yml.erb index b61d5c7077..de212cd730 100644 --- a/jobs/cloud_controller_clock/templates/cloud_controller_ng.yml.erb +++ b/jobs/cloud_controller_clock/templates/cloud_controller_ng.yml.erb @@ -347,6 +347,9 @@ credhub_api: credential_references: interpolate_service_bindings: <%= p("cc.credential_references.interpolate_service_bindings") %> +statsd_host: <%= link("cloud_controller_internal").p("cc.statsd_host") %> +statsd_port: <%= link("cloud_controller_internal").p("cc.statsd_port") %> + max_labels_per_resource: <%= link("cloud_controller_internal").p("cc.max_labels_per_resource") %> max_annotations_per_resource: <%= link("cloud_controller_internal").p("cc.max_annotations_per_resource") %> custom_metric_tag_prefix_list: <%= link("cloud_controller_internal").p("cc.custom_metric_tag_prefix_list") %> diff --git a/spec/.rubocop.yml b/spec/.rubocop.yml index a0ae7e569d..ca9b0429f9 100644 --- a/spec/.rubocop.yml +++ b/spec/.rubocop.yml @@ -2,7 +2,7 @@ require: - rubocop-rspec AllCops: - TargetRubyVersion: 3.1 + TargetRubyVersion: 3.2 Bundler/DuplicatedGem: Enabled: true diff --git a/spec/cloud_controller_clock/cloud_controller_clock_spec.rb b/spec/cloud_controller_clock/cloud_controller_clock_spec.rb index 7b79c41941..110e65a7f1 100644 --- a/spec/cloud_controller_clock/cloud_controller_clock_spec.rb +++ b/spec/cloud_controller_clock/cloud_controller_clock_spec.rb @@ -71,6 +71,8 @@ module Test 'current_key_label' => 'encryption_key_0', :keys => { 'encryption_key_0' => '((cc_db_encryption_key))' } }, + 'statsd_host' => '127.0.0.1', + 'statsd_port' => 8125, 'max_labels_per_resource' => true, 'max_annotations_per_resource' => 'yus', 'disable_private_domain_cross_space_context_path_route_sharing' => false, @@ -131,6 +133,14 @@ module Test end end end + + describe 'statsd' do + it 'renders statsd_host and statsd_port from cloud_controller_internal link' do + template_hash = YAML.safe_load(template.render(manifest_properties, consumes: links)) + expect(template_hash['statsd_host']).to eq(properties['cc']['statsd_host']) + expect(template_hash['statsd_port']).to eq(properties['cc']['statsd_port']) + end + end end end end