From 6c1d7887799c1267b2a50bfdaaa9acc77c7b9cc3 Mon Sep 17 00:00:00 2001 From: Toshiaki Maki Date: Thu, 13 Sep 2018 03:28:59 +0900 Subject: [PATCH] Expose listen-metrics-urls property fixes #8 --- jobs/etcd/spec | 6 +++++- jobs/etcd/templates/bin/etcd.erb | 3 ++- manifests/ops-files/change-metrics-url.yml | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 manifests/ops-files/change-metrics-url.yml diff --git a/jobs/etcd/spec b/jobs/etcd/spec index ec7fc09..b4a57b0 100644 --- a/jobs/etcd/spec +++ b/jobs/etcd/spec @@ -40,7 +40,11 @@ consumes: properties: etcd.dns_suffix: description: If provided, used as a DNS suffix for all nodes in the etcd cluster - tls.etcd.ca: + etcd.metrics_protocol: + description: IF provided with etcd.metrics_port, metrics endpoints listen with the protocol. http or https. + etcd.metrics_port: + description: IF provided with etcd.metrics_protocol, metrics endpoints listen on the port. 2379 and 2380 can not be used. + tls.etcd.ca: description: CA for etcd client and server authentication tls.etcd.certificate: description: Certificate for etcd client and server authentication diff --git a/jobs/etcd/templates/bin/etcd.erb b/jobs/etcd/templates/bin/etcd.erb index 62b8cde..4792e47 100644 --- a/jobs/etcd/templates/bin/etcd.erb +++ b/jobs/etcd/templates/bin/etcd.erb @@ -50,4 +50,5 @@ fi --peer-client-cert-auth \ --peer-trusted-ca-file="/var/vcap/jobs/etcd/config/peer-ca.crt" \ --peer-cert-file="/var/vcap/jobs/etcd/config/peer.crt" \ - --peer-key-file="/var/vcap/jobs/etcd/config/peer.key" + --peer-key-file="/var/vcap/jobs/etcd/config/peer.key" \ +<% if_p("etcd.metrics_protocol", "etcd.metrics_port") do |protocol, port| %> --listen-metrics-urls=<%= protocol %>://0.0.0.0:<%= port %> \<% end %> diff --git a/manifests/ops-files/change-metrics-url.yml b/manifests/ops-files/change-metrics-url.yml new file mode 100644 index 0000000..3d1ad53 --- /dev/null +++ b/manifests/ops-files/change-metrics-url.yml @@ -0,0 +1,6 @@ +- type: replace + path: /instance_groups/name=etcd/jobs/name=etcd/properties/etcd?/metrics_protocol? + value: ((metrics_protocol)) +- type: replace + path: /instance_groups/name=etcd/jobs/name=etcd/properties/etcd?/metrics_port? + value: ((metrics_port)) \ No newline at end of file