Skip to content

Commit

Permalink
Announce under the same keys as previously
Browse files Browse the repository at this point in the history
Revert the changelog as there is no delta now.
  • Loading branch information
mhutchinson committed Mar 3, 2021
1 parent 8e37269 commit f8c02bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

### CTFE

* Removed the `-by_range` flag.
* Services will now be announced on etcd with a slash appended to the service names provided by `-etcd_http_service` and `-etcd_metrics_service`.
Removed the `-by_range` flag.

## v1.1.1
[Published 2020-10-06](https://github.com/google/certificate-transparency-go/releases/tag/v1.1.1)
Expand Down
19 changes: 11 additions & 8 deletions trillian/ctfe/ct_server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main
import (
"context"
"flag"
"fmt"
"net/http"
"os"
"os/signal"
Expand Down Expand Up @@ -130,17 +131,19 @@ func main() {
glog.Exitf("Failed to create etcd metrics manager: %v", err)
}

// Another option would be to have a single service and two endpoints "http" and "metrics".
glog.Infof("Announcing our presence in %v with %+v", *etcdHTTPService, *httpEndpoint)
httpManager.AddEndpoint(ctx, *etcdHTTPService+"/", endpoints.Endpoint{Addr: *httpEndpoint})
etcdHTTPKey := fmt.Sprintf("%s/%s", *etcdHTTPService, *httpEndpoint)
glog.Infof("Announcing our presence at %v with %+v", etcdHTTPKey, *httpEndpoint)
httpManager.AddEndpoint(ctx, etcdHTTPKey, endpoints.Endpoint{Addr: *httpEndpoint})

etcdMetricsKey := fmt.Sprintf("%s/%s", *etcdMetricsService, metricsAt)
glog.Infof("Announcing our presence in %v with %+v", *etcdMetricsService, metricsAt)
metricsManager.AddEndpoint(ctx, *etcdMetricsService+"/", endpoints.Endpoint{Addr: metricsAt})
metricsManager.AddEndpoint(ctx, etcdMetricsKey, endpoints.Endpoint{Addr: metricsAt})

defer func() {
glog.Infof("Removing our presence in %v", *etcdHTTPService)
httpManager.DeleteEndpoint(ctx, *etcdHTTPService+"/")
glog.Infof("Removing our presence in %v", *etcdMetricsService)
metricsManager.DeleteEndpoint(ctx, *etcdMetricsService+"/")
glog.Infof("Removing our presence in %v", etcdHTTPKey)
httpManager.DeleteEndpoint(ctx, etcdHTTPKey)
glog.Infof("Removing our presence in %v", etcdMetricsKey)
metricsManager.DeleteEndpoint(ctx, etcdMetricsKey)
}()
} else if strings.Contains(*rpcBackend, ",") {
// This should probably not be used in production. Either use etcd or a gRPC
Expand Down

0 comments on commit f8c02bd

Please sign in to comment.