Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/12163.txt
@@ -0,0 +1,3 @@
```release-note:improvement
serviceregistration: add `external-source: "vault"` metadata value for Consul registration.
```
7 changes: 7 additions & 0 deletions serviceregistration/consul/consul_service_registration.go
Expand Up @@ -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])$`)
Expand Down Expand Up @@ -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
Expand Down