Skip to content

Backport of Include RequestTimeout in marshal/unmarshal of ServiceResolverConfigE… into release/1.14.x#19032

Merged
hc-github-team-consul-core merged 2 commits intorelease/1.14.xfrom
backport/cthain/fix-service-resolver-config-entry/slowly-exciting-leopard
Sep 29, 2023
Merged

Backport of Include RequestTimeout in marshal/unmarshal of ServiceResolverConfigE… into release/1.14.x#19032
hc-github-team-consul-core merged 2 commits intorelease/1.14.xfrom
backport/cthain/fix-service-resolver-config-entry/slowly-exciting-leopard

Conversation

@hc-github-team-consul-core
Copy link
Collaborator

@hc-github-team-consul-core hc-github-team-consul-core commented Sep 29, 2023

Backport

This PR is auto-generated from #19031 to be assessed for backporting due to the inclusion of the label backport/1.14.

The below text is copied from the body of the original PR.


Description

This PR fixes a bug where we’re missing the custom JSON marshal and unmarshal for the ServiceResolverConfigEntry.RequestTimeout field. This has the effect that the config entry can be written successfully to Consul but it cannot be read back through the API.

Testing & Reproduction steps

Before the changes proposed in this PR:

$ consul agent -dev &> /dev/null &
$ consul config write -
Kind      = "service-resolver"
Name      = "frontend-se"
ConnectTimeout = "10s"
RequestTimeout = "15s"
Subsets = {
 v1 = {
   OnlyPassing = true
 }
 v2  = {
   OnlyPassing = true
 }
}^D
Config entry written: service-resolver/frontend-se
$ consul config read -kind service-resolver -name frontend-se
Error reading config entry service-resolver/frontend-se: json: cannot unmarshal string into Go struct field .RequestTimeout of type time.Duration

After these changes:

# setup as above
consul config read -kind service-resolver -name frontend-se
{
    "ConnectTimeout": "10s",
    "RequestTimeout": "15s",
    "Kind": "service-resolver",
    "Name": "frontend-se",
    "Partition": "default",
    "Namespace": "default",
    "Subsets": {
        "v1": {
            "OnlyPassing": true
        },
        "v2": {
            "OnlyPassing": true
        }
    },
    "CreateIndex": 22,
    "ModifyIndex": 22
}

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

Overview of commits

@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/cthain/fix-service-resolver-config-entry/slowly-exciting-leopard branch from a7e7353 to f4af3b8 Compare September 29, 2023 17:40
@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/cthain/fix-service-resolver-config-entry/slowly-exciting-leopard branch from d7102f6 to a3126b4 Compare September 29, 2023 17:40
@github-actions github-actions bot added the theme/api Relating to the HTTP API interface label Sep 29, 2023
Copy link
Collaborator

Choose a reason for hiding this comment

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

Auto approved Consul Bot automated PR

@vercel vercel bot temporarily deployed to Preview – consul September 29, 2023 17:45 Inactive
@hc-github-team-consul-core hc-github-team-consul-core merged commit 96441fe into release/1.14.x Sep 29, 2023
@hc-github-team-consul-core hc-github-team-consul-core deleted the backport/cthain/fix-service-resolver-config-entry/slowly-exciting-leopard branch September 29, 2023 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme/api Relating to the HTTP API interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants