Consul Filtering Implementation#782
Open
amuntean-godaddy wants to merge 1 commit intoopenconfig:mainfrom
Open
Conversation
Contributor
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. |
karimra
reviewed
Dec 24, 2025
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) | ||
| } |
Collaborator
There was a problem hiding this comment.
@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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#779
Adds support for filtering to consul loader based on https://developer.hashicorp.com/consul/api-docs/features/filtering.