Skip to content

Commit

Permalink
Move etcd metrics service to homeworld-services
Browse files Browse the repository at this point in the history
  • Loading branch information
celskeggs committed Jan 10, 2018
1 parent c279da3 commit 46b5e96
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
homeworld-etcd-metrics-exporter (0.1.1) stretch; urgency=medium

* Updated release

-- Cel Skeggs <[email protected]> Tue, 09 Jan 2018 21:41:17 -0500

homeworld-etcd-metrics-exporter (0.1.0) stretch; urgency=medium

* Initial release
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
etcd-metrics-exporter usr/bin
services/etcd-metrics-exporter.service usr/lib/systemd/system
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (

// Initialize the prometheus instrumentation and client related flags.
var (
etcdScrapeBase = "https://localhost:2379"
etcdScrapeBase string

httpClient *http.Client
)
Expand Down Expand Up @@ -164,21 +164,23 @@ 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)
}
if !certPool.AppendCertsFromPEM(authorities) {
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)
}
Expand Down
12 changes: 12 additions & 0 deletions building/build-debs/homeworld-services/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
homeworld-services (0.1.25) stretch; urgency=medium

* Updated debian version

-- Cel Skeggs <[email protected]> Tue, 09 Jan 2018 21:52:56 -0500

homeworld-services (0.1.24) stretch; urgency=medium

* Updated debian version

-- Cel Skeggs <[email protected]> Tue, 09 Jan 2018 21:40:55 -0500

homeworld-services (0.1.23) stretch; urgency=medium

* Updated debian version
Expand Down
2 changes: 1 addition & 1 deletion building/build-debs/homeworld-services/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 46b5e96

Please sign in to comment.