From db5d86a956273d59738dd0c2c6a61f01522ae7cb Mon Sep 17 00:00:00 2001 From: Anders Bruun Olsen Date: Tue, 13 Mar 2018 13:59:11 +0100 Subject: [PATCH 1/2] Auto-detect google-project if provider is Google and no project is supplied. --- provider/google.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/provider/google.go b/provider/google.go index c1b6b2b8d9..e7a2a93409 100644 --- a/provider/google.go +++ b/provider/google.go @@ -21,6 +21,7 @@ import ( "sort" "strings" + "cloud.google.com/go/compute/metadata" "github.com/linki/instrumented_http" log "github.com/sirupsen/logrus" @@ -133,6 +134,14 @@ func NewGoogleProvider(project string, domainFilter DomainFilter, zoneIDFilter Z return nil, err } + if project == "" { + mProject, mErr := metadata.ProjectID() + if mErr == nil { + log.Infof("Google project auto-detected: %s", mProject) + project = mProject + } + } + provider := &GoogleProvider{ project: project, domainFilter: domainFilter, From 0b86ddb98a2bbd8fd8294f6c2c82ea844ab02a6e Mon Sep 17 00:00:00 2001 From: Anders Bruun Olsen Date: Tue, 13 Mar 2018 17:40:43 +0100 Subject: [PATCH 2/2] Add changelog entry. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66015e361e..76cdd0369c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ + - Google Provider: Add auto-detection of Google Project when running on GCP (#492) @drzero42 - Add custom TTL support for DNSimple (#477) @jbowes - Fix docker build and delete vendor files which were not deleted (#473) @njuettner - DigitalOcean: DigitalOcean creates entries with host in them twice (#459) @njuettner