-
Notifications
You must be signed in to change notification settings - Fork 782
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
[NET-7571] Ensure services function uses specified Consul namespace #1874
Conversation
- bug fix for SeatGeek: Services function in CT (consul-template) does not update the namespace for each services API call - opts should be defaulted to the opts at query creation. - then they should be merged with the opts present in Fetch. - currently the merge was the other way around. - ENT test support is not there, so no test cases added as of now.
- bug fix for SeatGeek: Services function in CT (consul-template) does not update the namespace for each services API call - opts should be defaulted to the opts at query creation. - then they should be merged with the opts present in Fetch. - currently the merge was the other way around. - ENT test support is not there, so no test cases added as of now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I see that other functions are using the opts.Merge(&QueryOptions{
way. Would we need to update some of them as well?
dependency/catalog_services.go
Outdated
// see bug [https://github.com/hashicorp/consul-template/pull/1842#issuecomment-1915723565] | ||
// it should be other way around. | ||
// default to the query params present while creating NewCatalogServicesQuery | ||
// and then merge with the query params present in the query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have this comment here as the updated code will not have reference of what was used earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, some of the other functions have that problem too.
that's why I want to enable ENT and write proper tests for them before touching them.
- bug fix for SeatGeek: Services function in CT (consul-template) does not update the namespace for each services API call - opts should be defaulted to the opts at query creation. - then they should be merged with the opts present in Fetch. - currently the merge was the other way around. - ENT test support is not there, so no test cases added as of now.
- bug fix for SeatGeek: Services function in CT (consul-template) does not update the namespace for each services API call - opts should be defaulted to the opts at query creation. - then they should be merged with the opts present in Fetch. - currently the merge was the other way around. - ENT test support is not there, so no test cases added as of now.
- bug fix for SeatGeek: Services function in CT (consul-template) does not update the namespace for each services API call - opts should be defaulted to the opts at query creation. - then they should be merged with the opts present in Fetch. - currently the merge was the other way around. - ENT test support is not there, so no test cases added as of now.
- updating comments
Unfortunately this is also not complete implementation. I tested it locally and you need to change:
to
This way you are actually watching different |
|
@@ -71,11 +71,17 @@ func (d *CatalogServicesQuery) Fetch(clients *ClientSet, opts *QueryOptions) (in | |||
default: | |||
} | |||
|
|||
opts = opts.Merge(&QueryOptions{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this was the problem, I think it was the String() function not being unique for different ns/partition queries. I think this function is only ever called here: https://github.com/hashicorp/consul-template/blob/main/watch/view.go#L218-L222 and so there's no issue with the merge order.
How I've tested this PR
How I expect reviewers to test this PR
Checklist