-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Consul Transaction API does not properly handle Service TaggedAddresses and Check Type fields. #22180
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
Comments
Hello, #22220 addressed the first issue, we can now register service However the Golang Consul API library itself still doesn't work with the Transaction API as mentioned in the second point. You can reproduce this by adding Line 39 in d299ad0
Can also add a new write transaction test case
Both of these will give the error The root issue is that on the Consul server side, it return a structs.TxnResponse object which contains the Service result as a NodeService. On the Golang client side, it tries to decode the TxnResponse as an api.TxnResponse which contain the Service result as a CatalogService. The default JsonDecoder cannot decode the serialized |
Overview
Consul Transaction API does not register the
TaggedAddresses
field in theAgentService
struct that is sent from the client. Same with theType
field in theHealthCheck
struct. It appears those fields are missed when converting from API objects to internal objects. https://github.com/hashicorp/consul/blob/v1.20.3/agent/txn_endpoint.go#L201The Golang Consul API package fails to unmarshall the
TxnResponse
object when it contains a service withTaggedAddresses
.It appears the
ServiceResult
in the internalTxnResponse
object does not get converted to the APITxnResponse
object properly https://github.com/hashicorp/consul/blob/v1.20.3/api/txn.go#L237.Reproduction steps
From Unit Tests:
TestTxnEndpoint_UpdateCheck
comparison fails when adding checkType
to input and expected.https://github.com/hashicorp/consul/blob/v1.20.3/agent/txn_endpoint_test.go#L521
TestTxnEndpoint_NodeService
comparison fails when adding serviceTaggedAddresses
to input and expected.https://github.com/hashicorp/consul/blob/v1.20.3/agent/txn_endpoint_test.go#L691
TestAPI_ClientTxn
fails to unmarshall data structure when adding serviceTaggedAddresses
to the catalog registration.https://github.com/hashicorp/consul/blob/v1.20.3/api/txn_test.go#L37
From HTTP API:
txn.json
TaggedAddresses
and CheckType
are not registered.The text was updated successfully, but these errors were encountered: