Skip to content

Conversation

@amuntean-godaddy
Copy link

Summary

#779

Adds support for filtering to consul loader based on https://developer.hashicorp.com/consul/api-docs/features/filtering.

@amuntean-godaddy
Copy link
Author

The solution needs more work. When two services blocks that share the same name but differ only by filter, the first block always wins; the watcher’s filter doesn’t matter because the conversion step has no idea which definition produced the service entry.

Comment on lines -409 to +424
SRV:
for _, sd := range c.cfg.Services {
// match service name
if se.Service.Service != sd.Name {
continue
}
if se.Service.Service != sd.Name {
return nil, fmt.Errorf("service entry name %q mismatches definition %q", se.Service.Service, sd.Name)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amuntean-godaddy I think this is where you should handle the case of same serviceName with different filters.
If the service name does not match continue with the next service, if they match compare the filters. If the filters match continue with building the target config, otherwise continue with the next service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants