diff --git a/.travis.yml b/.travis.yml index 6304a13..bef1b15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: required language: go go: - - 1.8 + - 1.11 services: - docker diff --git a/backend/consul/writer.go b/backend/consul/writer.go index bf42d1a..0fe28b5 100644 --- a/backend/consul/writer.go +++ b/backend/consul/writer.go @@ -17,6 +17,7 @@ func (b *Backend) WriteService(service *config.Service) { Port: service.ServicePort, Service: service.ServiceName, Tags: service.ServiceTags, + Meta: service.ServiceMeta, }, Check: &api.AgentCheck{ CheckID: service.CheckID, diff --git a/config/struct.go b/config/struct.go index 028f09c..3eda819 100644 --- a/config/struct.go +++ b/config/struct.go @@ -46,6 +46,7 @@ type Service struct { ServiceAddress string ServicePort int ServiceTags []string + ServiceMeta map[string]string CheckID string CheckNode string CheckNotes string diff --git a/service/rds/writer.go b/service/rds/writer.go index e7a39e9..1622486 100644 --- a/service/rds/writer.go +++ b/service/rds/writer.go @@ -1,14 +1,13 @@ package rds import ( + "fmt" + "os" + "reflect" "regexp" "strings" "time" - "fmt" - - "os" - "github.com/aws/aws-sdk-go/aws" observer "github.com/imkira/go-observer" "github.com/seatgeek/aws-dynamic-consul-catalog/config" @@ -169,6 +168,13 @@ func (r *RDS) writeBackendCatalog(instance *config.DBInstance, logger *log.Entry CheckOutput: fmt.Sprintf("Pending tasks: %s\n\nAddr: %s\n\nmanaged by aws-dynamic-consul-catalog", instance.PendingModifiedValues.GoString(), addr), } + service.ServiceMeta = make(map[string]string) + service.ServiceMeta["Engine"] = aws.StringValue(instance.Engine) + service.ServiceMeta["EngineVersion"] = aws.StringValue(instance.EngineVersion) + service.ServiceMeta["DBName"] = aws.StringValue(instance.DBName) + service.ServiceMeta["DBInstanceClass"] = aws.StringValue(instance.DBInstanceClass) + service.ServiceMeta["DBInstanceIdentifier"] = aws.StringValue(instance.DBInstanceIdentifier) + if stringInSlice(service.ServiceID, seen.Services) { logger.Errorf("Found duplicate Service ID %s - possible duplicate 'consul_service_name' RDS tag with same Replication Role", service.ServiceID) if r.onDuplicate == "quit" { @@ -252,6 +258,10 @@ func (r *RDS) identicalService(a, b *config.Service) bool { return false } + if !reflect.DeepEqual(a.ServiceMeta, b.ServiceMeta) { + return false + } + if removeUpdatedTimeRegexp.ReplaceAllLiteralString(a.CheckOutput, "") != removeUpdatedTimeRegexp.ReplaceAllLiteralString(b.CheckOutput, "") { return false } diff --git a/vendor/vendor.json b/vendor/vendor.json index 9654eea..37f0c7e 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -177,10 +177,12 @@ "revisionTime": "2017-05-19T02:37:13Z" }, { - "checksumSHA1": "iGAHizBUN43QlmYmn1bPLlNN9pw=", + "checksumSHA1": "cZw5u6BGWe3gjJxmXT6J0Tfn6Mw=", "path": "github.com/hashicorp/consul/api", - "revision": "b36f56dc8eb13fede357dc18fe5e130350ce0b06", - "revisionTime": "2017-05-22T04:29:27Z" + "revision": "5174058f0d2bda63fa5198ab96c33d9a909c58ed", + "revisionTime": "2018-05-11T18:57:42Z", + "version": "v1.1.0", + "versionExact": "v1.1.0" }, { "checksumSHA1": "b8F628srIitj5p7Y130xc9k0QWs=",