Skip to content
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

consul/connect: support for proxy upstreams opaque config #15761

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Jan 11, 2023

This PR adds support for configuring proxy.upstreams[].config for
Consul Connect upstreams. This is an opaque config value to Nomad -
the data is passed directly to Consul and is unknown to Nomad.

Closes #11392

This PR adds support for configuring `proxy.upstreams[].config` for
Consul Connect upstreams. This is an opaque config value to Nomad -
the data is passed directly to Consul and is unknown to Nomad.
@shoenig
Copy link
Member Author

shoenig commented Jan 11, 2023

Spot check

modified countdash example
job "countdash" {
  datacenters = ["dc1"]

  group "api" {
    network {
      mode = "bridge"
    }

    service {
      name = "count-api"
      port = "9001"

      connect {
        sidecar_service {}
      }
    }

    task "web" {
      driver = "docker"

      config {
        image          = "hashicorpdev/counter-api:v3"
        auth_soft_fail = true
      }
    }
  }

  group "dashboard" {
    network {
      mode = "bridge"

      port "http" {
        static = 9002
        to     = 9002
      }
    }

    service {
      name = "count-dashboard"
      port = "9002"

      connect {
        sidecar_service {
          proxy {
            upstreams {
              destination_name = "count-api"
              local_bind_port  = 8080
              config { # new
                connect_timeout_ms = 9999
              }
            }
          }
        }
      }
    }

    task "dashboard" {
      driver = "docker"

      env {
        COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
      }

      config {
        image          = "hashicorpdev/counter-dashboard:v3"
        auth_soft_fail = true
      }
    }
  }
}

Inspect service in Consul (contains upstream.config.connect_timeout_ms)

➜ curl -s localhost:8500/v1/agent/services | jq -r '.[] | select(.Service=="count-dashboard-sidecar-proxy") | .Proxy.Upstreams'
[
  {
    "DestinationType": "service",
    "DestinationName": "count-api",
    "LocalBindPort": 8080,
    "Config": {
      "connect_timeout_ms": 9999
    },
    "MeshGateway": {}
  }
]

@shoenig shoenig added this to the 1.5.0 milestone Jan 11, 2023
@shoenig shoenig marked this pull request as ready for review January 11, 2023 19:51
Copy link
Member

@gulducat gulducat left a comment

Choose a reason for hiding this comment

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

Assuming this is the extent of the required plumbing, LGTM!

Just a bit of food for thought and a clarifying question.

api/consul.go Show resolved Hide resolved
@shoenig shoenig merged commit 4698d8d into main Jan 12, 2023
@shoenig shoenig deleted the f-connect-proxy-upstreams-config branch January 12, 2023 14:20
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support sidecar upstreams config
2 participants