Skip to content

Commit

Permalink
Add option to name K8s Node in Consul (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
adilyse authored Sep 9, 2020
1 parent 6fc94bb commit a7e4a97
Show file tree
Hide file tree
Showing 13 changed files with 449 additions and 105 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## UNRELEASED

IMPROVEMENTS:

* Add an ability to configure the synthetic Consul node name where catalog sync registers services. [[GH-312](https://github.com/hashicorp/consul-k8s/pull/312)]
* Sync: Add `-consul-node-name` flag to the `sync-catalog` command to configure the Consul node name for syncing services to Consul.
* ACLs: Add `-sync-consul-node-name` flag to the server-acl-init command so that it can create correct policy for the sync catalog.

## 0.18.1 (August 10, 2020)

BUG FIXES:
Expand Down
5 changes: 4 additions & 1 deletion catalog/to-consul/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ type ServiceResource struct {
// `k8s-default` namespace.
K8SNSMirroringPrefix string

// The Consul node name to register service with.
ConsulNodeName string

// serviceLock must be held for any read/write to these maps.
serviceLock sync.RWMutex

Expand Down Expand Up @@ -332,7 +335,7 @@ func (t *ServiceResource) generateRegistrations(key string) {
// shallow copied for each instance.
baseNode := consulapi.CatalogRegistration{
SkipNodeUpdate: true,
Node: ConsulSyncNodeName,
Node: t.ConsulNodeName,
Address: "127.0.0.1",
NodeMeta: map[string]string{
ConsulSourceKey: ConsulSourceValue,
Expand Down
Loading

0 comments on commit a7e4a97

Please sign in to comment.