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

Backport of Document that DNS lookups can target cluster peers into release/1.15.x #18025

Conversation

hc-github-team-consul-core
Copy link
Contributor

Backport

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

🚨

Warning automatic cherry-pick of commits failed. If the first commit failed,
you will see a blank no-op commit below. If at least one commit succeeded, you
will see the cherry-picked commits up to, not including, the commit where
the merge conflict occurred.

The person who merged in the original PR is:
@david-yu
This person should manually cherry-pick the original PR into a new backport PR,
and close this one when the manual backport PR is merged in.

merge conflict error: unable to process merge commit: "22de906da45acb705ca130bad950448306fb2216", automatic backport requires rebase workflow

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


Description

Static DNS lookups, in addition to explicitly targeting a datacenter, can target a cluster peer. This was added in 95dc0c7 (1.15.0) but didn't make the documentation.

The driving function for the behavior change is parseLocality here:

consul/agent/dns_oss.go

Lines 25 to 44 in 0b1299c

func (d *DNSServer) parseLocality(labels []string, cfg *dnsConfig) (queryLocality, bool) {
locality := queryLocality{
EnterpriseMeta: d.defaultEnterpriseMeta,
}
switch len(labels) {
case 2, 4:
// Support the following formats:
// - [.<datacenter>.dc]
// - [.<peer>.peer]
for i := 0; i < len(labels); i += 2 {
switch labels[i+1] {
case "dc":
locality.datacenter = labels[i]
case "peer":
locality.peer = labels[i]
default:
return queryLocality{}, false
}
}

The biggest documentation change I've proposed is to adjust the standard lookup syntax to tie .<datacenter> to .dc as required-together, and to append in the similar .<cluster-peer>.peer optional argument, both to A record and SRV record lookups. This more matches my understanding of how to show that they have to be added as pairs for the directed lookups to work.

Testing & Reproduction steps

Documentation-only

Links

parseLocality function:

func (d *DNSServer) parseLocality(labels []string, cfg *dnsConfig) (queryLocality, bool) {

Exported Services docs: https://developer.hashicorp.com/consul/docs/connect/config-entries/exported-services

Cluster Peering overview: https://developer.hashicorp.com/consul/docs/connect/cluster-peering

PR Checklist

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

Overview of commits

Copy link

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

@github-actions github-actions bot added the type/docs Documentation needs to be created/updated/clarified label Jul 5, 2023
@david-yu david-yu marked this pull request as ready for review July 5, 2023 22:04
@david-yu david-yu requested a review from a team as a code owner July 5, 2023 22:04
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging July 5, 2023 22:07 Inactive
@vercel vercel bot temporarily deployed to Preview – consul July 5, 2023 22:13 Inactive
@david-yu david-yu merged commit e1b6f23 into release/1.15.x Jul 5, 2023
@david-yu david-yu deleted the backport/document-dns-peer-queries/truly-capable-foxhound branch July 5, 2023 22:24
@jira jira bot mentioned this pull request Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/docs Documentation needs to be created/updated/clarified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants