From 5502daadb5a76e0692067939e504f1cf96c3b169 Mon Sep 17 00:00:00 2001 From: "Cel A. Skeggs" Date: Tue, 9 Jan 2018 22:32:17 -0500 Subject: [PATCH] Move etcd metrics service to homeworld-services --- .../homeworld-etcd-metrics-exporter/debian/changelog | 6 ++++++ .../homeworld-etcd-metrics-exporter/debian/install | 1 - .../src/etcd-metrics-exporter.go | 12 +++++++----- .../build-debs/homeworld-services/debian/changelog | 12 ++++++++++++ .../build-debs/homeworld-services/debian/control | 2 +- .../services/etcd-metrics-exporter.service | 2 +- .../wrappers/launch-etcd-metrics-exporter.sh | 9 +++++++++ .../homeworld-services/wrappers/start-master-etcd.sh | 2 ++ .../homeworld-services/wrappers/start-master.sh | 2 -- 9 files changed, 38 insertions(+), 10 deletions(-) rename building/build-debs/{homeworld-etcd-metrics-exporter => homeworld-services}/services/etcd-metrics-exporter.service (54%) create mode 100755 building/build-debs/homeworld-services/wrappers/launch-etcd-metrics-exporter.sh diff --git a/building/build-debs/homeworld-etcd-metrics-exporter/debian/changelog b/building/build-debs/homeworld-etcd-metrics-exporter/debian/changelog index 41d01653e..6929c79d0 100644 --- a/building/build-debs/homeworld-etcd-metrics-exporter/debian/changelog +++ b/building/build-debs/homeworld-etcd-metrics-exporter/debian/changelog @@ -1,3 +1,9 @@ +homeworld-etcd-metrics-exporter (0.1.1) stretch; urgency=medium + + * Updated release + + -- Cel Skeggs Tue, 09 Jan 2018 21:41:17 -0500 + homeworld-etcd-metrics-exporter (0.1.0) stretch; urgency=medium * Initial release diff --git a/building/build-debs/homeworld-etcd-metrics-exporter/debian/install b/building/build-debs/homeworld-etcd-metrics-exporter/debian/install index d1654dcd9..e301a6574 100644 --- a/building/build-debs/homeworld-etcd-metrics-exporter/debian/install +++ b/building/build-debs/homeworld-etcd-metrics-exporter/debian/install @@ -1,2 +1 @@ etcd-metrics-exporter usr/bin -services/etcd-metrics-exporter.service usr/lib/systemd/system diff --git a/building/build-debs/homeworld-etcd-metrics-exporter/src/etcd-metrics-exporter.go b/building/build-debs/homeworld-etcd-metrics-exporter/src/etcd-metrics-exporter.go index 36a56eb13..bc02059c3 100644 --- a/building/build-debs/homeworld-etcd-metrics-exporter/src/etcd-metrics-exporter.go +++ b/building/build-debs/homeworld-etcd-metrics-exporter/src/etcd-metrics-exporter.go @@ -38,7 +38,7 @@ import ( // Initialize the prometheus instrumentation and client related flags. var ( - etcdScrapeBase = "https://localhost:2379" + etcdScrapeBase string httpClient *http.Client ) @@ -164,13 +164,15 @@ func scrapeMetrics() (map[string]*dto.MetricFamily, error) { } func main() { - if len(os.Args) != 4 { - log.Fatal("expected three arguments: authority, keyfile, certfile") + if len(os.Args) != 5 { + log.Fatal("expected four arguments: baseurl, authority, keyfile, certfile") } + etcdScrapeBase = os.Args[1] + certPool := x509.NewCertPool() - authorities, err := ioutil.ReadFile(os.Args[1]) + authorities, err := ioutil.ReadFile(os.Args[2]) if err != nil { log.Fatal(err) } @@ -178,7 +180,7 @@ func main() { log.Fatal("could not parse PEM cert for CA") } - certCli, err := tls.LoadX509KeyPair(os.Args[3], os.Args[2]) + certCli, err := tls.LoadX509KeyPair(os.Args[4], os.Args[3]) if err != nil { log.Fatal(err) } diff --git a/building/build-debs/homeworld-services/debian/changelog b/building/build-debs/homeworld-services/debian/changelog index 902f14721..8f08a121c 100644 --- a/building/build-debs/homeworld-services/debian/changelog +++ b/building/build-debs/homeworld-services/debian/changelog @@ -1,3 +1,15 @@ +homeworld-services (0.1.25) stretch; urgency=medium + + * Updated debian version + + -- Cel Skeggs Tue, 09 Jan 2018 21:52:56 -0500 + +homeworld-services (0.1.24) stretch; urgency=medium + + * Updated debian version + + -- Cel Skeggs Tue, 09 Jan 2018 21:40:55 -0500 + homeworld-services (0.1.23) stretch; urgency=medium * Updated debian version diff --git a/building/build-debs/homeworld-services/debian/control b/building/build-debs/homeworld-services/debian/control index fdb474c8d..c686905f0 100644 --- a/building/build-debs/homeworld-services/debian/control +++ b/building/build-debs/homeworld-services/debian/control @@ -9,7 +9,7 @@ Vcs-Browser: https://github.com/sipb/homeworld/ Package: homeworld-services Architecture: any -Depends: ${misc:Depends}, homeworld-rkt, homeworld-etcd, homeworld-hyperkube (>= 1.8.0), openssl, curl, ca-certificates +Depends: ${misc:Depends}, homeworld-rkt, homeworld-etcd, homeworld-hyperkube (>= 1.8.0), openssl, curl, ca-certificates, homeworld-etcd-metrics-exporter Conflicts: homeworld-flannel Description: Homeworld services package. This package is used for code deployment to Homeworld clusters. diff --git a/building/build-debs/homeworld-etcd-metrics-exporter/services/etcd-metrics-exporter.service b/building/build-debs/homeworld-services/services/etcd-metrics-exporter.service similarity index 54% rename from building/build-debs/homeworld-etcd-metrics-exporter/services/etcd-metrics-exporter.service rename to building/build-debs/homeworld-services/services/etcd-metrics-exporter.service index 8d46ecdd0..f29d3f7ab 100644 --- a/building/build-debs/homeworld-etcd-metrics-exporter/services/etcd-metrics-exporter.service +++ b/building/build-debs/homeworld-services/services/etcd-metrics-exporter.service @@ -5,7 +5,7 @@ After=network-online.target [Service] Slice=machine.slice -ExecStart=/usr/bin/etcd-metrics-exporter /etc/homeworld/authorities/etcd-server.pem /etc/homeworld/keys/etcd-client.pem /etc/homeworld/keys/etcd-client.key +ExecStart=/usr/lib/hyades/launch-etcd-metrics-exporter.sh Restart=always [Install] diff --git a/building/build-debs/homeworld-services/wrappers/launch-etcd-metrics-exporter.sh b/building/build-debs/homeworld-services/wrappers/launch-etcd-metrics-exporter.sh new file mode 100755 index 000000000..76d6f0684 --- /dev/null +++ b/building/build-debs/homeworld-services/wrappers/launch-etcd-metrics-exporter.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e -u + +source /etc/homeworld/config/cluster.conf +source /etc/homeworld/config/local.conf + +TLS_STORAGE=/etc/homeworld/ + +exec /usr/bin/etcd-metrics-exporter "https://${HOST_IP}:2379" "${TLS_STORAGE}/authorities/etcd-server.pem" "${TLS_STORAGE}/keys/etcd-client.key" "${TLS_STORAGE}/keys/etcd-client.pem" diff --git a/building/build-debs/homeworld-services/wrappers/start-master-etcd.sh b/building/build-debs/homeworld-services/wrappers/start-master-etcd.sh index c37566117..8abcb21f0 100755 --- a/building/build-debs/homeworld-services/wrappers/start-master-etcd.sh +++ b/building/build-debs/homeworld-services/wrappers/start-master-etcd.sh @@ -7,5 +7,7 @@ systemctl daemon-reload systemctl start etcd systemctl enable etcd +systemctl start etcd-metrics-exporter +systemctl enable etcd-metrics-exporter echo "services started and enabled!" diff --git a/building/build-debs/homeworld-services/wrappers/start-master.sh b/building/build-debs/homeworld-services/wrappers/start-master.sh index ab33fd08c..e7a1934c7 100755 --- a/building/build-debs/homeworld-services/wrappers/start-master.sh +++ b/building/build-debs/homeworld-services/wrappers/start-master.sh @@ -6,8 +6,6 @@ echo "starting master services..." systemctl daemon-reload # etcd should already be started by start-master-etcd.sh -# systemctl start etcd -# systemctl enable etcd systemctl start rkt-api systemctl enable rkt-api systemctl start kubelet