serviceregistration: add external-source meta value (#12163)

* serviceregistration: add external-source meta value

* add changelog file
This commit is contained in:
Calvin Leung Huang 2021-08-03 09:31:01 -07:00 committed by GitHub
parent 034f09c373
commit c35044010e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

3
changelog/12163.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
serviceregistration: add `external-source: "vault"` metadata value for Consul registration.
```

View File

@ -49,6 +49,10 @@ const (
// reconcileTimeout is how often Vault should query Consul to detect
// and fix any state drift.
reconcileTimeout = 60 * time.Second
// metaExternalSource is a metadata value for external-source that can be
// used by the Consul UI.
metaExternalSource = "vault"
)
var hostnameRegex = regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$`)
@ -503,6 +507,9 @@ func (c *serviceRegistration) reconcileConsul(registeredServiceID string) (servi
Port: int(c.redirectPort),
Address: serviceAddress,
EnableTagOverride: false,
Meta: map[string]string{
"external-source": metaExternalSource,
},
}
checkStatus := api.HealthCritical