-
Notifications
You must be signed in to change notification settings - Fork 62
DNS servers should have NS and SOA records #8047
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
Conversation
plus rustfmt, clippy
842455b to
f349290
Compare
f349290 to
fa47ab1
Compare
| impl From<Srv> for DnsRecord { | ||
| fn from(srv: Srv) -> Self { | ||
| DnsRecord::Srv(srv) | ||
| } | ||
| } | ||
|
|
||
| #[derive( | ||
| Clone, | ||
| Debug, | ||
| Serialize, | ||
| Deserialize, | ||
| JsonSchema, | ||
| PartialEq, | ||
| Eq, | ||
| PartialOrd, | ||
| Ord, | ||
| )] | ||
| pub struct Srv { | ||
| pub prio: u16, | ||
| pub weight: u16, | ||
| pub port: u16, | ||
| pub target: String, | ||
| } | ||
|
|
||
| impl From<v1::config::Srv> for Srv { | ||
| fn from(other: v1::config::Srv) -> Self { | ||
| Srv { | ||
| prio: other.prio, | ||
| weight: other.weight, | ||
| port: other.port, | ||
| target: other.target, | ||
| } | ||
| } | ||
| } |
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.
the other option here is to use the v1::config::Srv type directly in v2, because it really has not changed. weaving the V1/V2 types together seems more difficult to think about generally, but i'm very open to the duplication being more confusing if folks feel that way.
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 would probably use the v1 types directly but I can see going either way.
davepacheco
left a comment
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.
Nice -- this is looking pretty good! I don't think anything here is a real blocker but it would be good to cleanup if we can.
dev-tools/reconfigurator-cli/tests/input/cmds-expunge-newly-added-internal-dns.txt
Outdated
Show resolved
Hide resolved
| zones: vec![dns_zone_blueprint], | ||
| time_created: chrono::Utc::now(), | ||
| generation: blueprint_generation.next(), | ||
| serial: new_dns_generation.as_u64().try_into().map_err(|_| { |
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 see -- it looks like you split the difference here. The configuration distinguishes between "serial" and "generation", but this is the only place that sets them, and it always makes them the same. So we don't have to worry about maintaining a serial in lockstep with the generation when we update the database.
This seems fine.
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.
yeah, i really like the status quo that there is not a DnsConfigParams which can result in the DNS server failing to serve records. to maintain that either DnsConfigParams::generation should become a u32 (seems very wrong), or serial ends up a distinct u32.
internal-dns/types/src/v2/config.rs
Outdated
| #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] | ||
| pub struct DnsConfigZone { | ||
| pub zone_name: String, | ||
| pub names: HashMap<String, Vec<DnsRecord>>, |
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.
super nitty and unimportant, but: I feel like records was more accurate. I guess I expect maps to be named either by what each key-value pair represents or what the value represents, not what the key represents. But now I wonder how universal that is!
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 suppose i was thinking about this as: a "name" is the pair of a label and a collection of records, and we often happen to call the label a "name". that's not totally accurate, since the key here could be multiple labels anyway. but i agree with your instinct and this is why it didn't strike me as confusing at first :)
this was a simple change, i'll probably revert it and add a few comments on the relevant test asserts instead.
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.
You could be right if people read "DNS name" to refer to the (label, records) pair. I tend to use that interchangeably with "label" but maybe that's wrong.
Anyway, not a big deal either way, though there's something to be said for not having different names for the same thing in two different API versions. Then again, we can probably remove API version 1 in the next release anyway.
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.
already reverted it! i expect i'm the outlier here, and either way it ends up ambiguous in some circumstances.
Co-authored-by: David Pacheco <[email protected]>
confusing name options abound. "names" is ambiguous with the keys, "records" is ambiguous with the values, maybe it would be better to call this "subdomains"???? but for now stick with what we've got and add some clarifying comments. This reverts commit ff63ea1.
* incorrect comments around the internal DNS expunge test * internal DNS config does not need to track external DNS separately
89ea63f to
7de2cc1
Compare
davepacheco
left a comment
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 think there were two items going to be done as follow-ups:
- remove unneeded
service_namearguments from some of the DnsConfigBuilder methods - use named constants for the API versions where we're defining the dropshot dynamic version policy
This reverts commit 3e68262. The change in 3e68262 does not handle upgrade sufficiently: when internal DNS starts it tries to parse a `CurrentConfig` from a json blob describing the previous server version's config. As Angela found on dogfood, this means internal DNS will fail to start with an error about "missing field `serial` at line 1 column ..." We're reverting this to unblock dogfood, but will add this back in with additional logic to handle this case.
This reverts commit 3e68262. The change in 3e68262 does not handle upgrade sufficiently: when internal DNS starts it tries to parse a `CurrentConfig` from a json blob describing the previous server version's config. As Angela found on dogfood, this means internal DNS will fail to start with an error about "missing field `serial` at line 1 column ..." We're reverting this to unblock dogfood, but will add this back in with additional logic to handle this case.
PR #8047 comes with an unfortunate upgrade-only bug: before an upgrade, a system's DNS servers would write out a configuration without the new `serial` field added in 8047. When upgraded, the DNS servers would then try to load that config, see it is missing a `serial` field, and error for every query. We expect to replace the previous-format configuration immediately after upgrade by regenerating a blueprint for the current system and executing it. But we should be able to use the previous-format configuration anyway, so that DNS functions enough to get a control plane capable of planning and executing that blueprint.
PR #8047 comes with an unfortunate upgrade-only bug: before an upgrade, a system's DNS servers would write out a configuration without the new `serial` field added in 8047. When upgraded, the DNS servers would then try to load that config, see it is missing a `serial` field, and error for every query. We expect to replace the previous-format configuration immediately after upgrade by regenerating a blueprint for the current system and executing it. But we should be able to use the previous-format configuration anyway, so that DNS functions enough to get a control plane capable of planning and executing that blueprint.
this is probably the more exciting part of the issues outlined in #6944. the changes here get us to the point that for both internal and external DNS, we have:
ns1.<zone>,ns2.<zone>, ...)ns*.<zone>described aboveoxide.internal(for internal DNS) and$delegated_domain(for external DNS)we do not support zone transfers here. i believe the SOA record here would be reasonable to guide zone transfers if we did, but obviously that's not something i've tested.
SOA fields
the SOA record's
RNAMEis hardcoded toadmin@<zone_name>. this is out of expediency to provide something, but it's probably wrong most of the time. there's no way to get an MX record installed for<zone_name>in the rack's external DNS servers, so barring DNS hijinks in the deployed environment, this will be a dead address. problems here are:it seems like the best answer here is to allow configuration of the rack's delegated domain and zone after initial setup, and being able to update an administrative email would fit in pretty naturally there. but we don't have that right now, so
admin@it is. configuration of external DNS is probably more important in the context of zone transfers and permitting a list of remote addresses to whom we're willing to permit zone transfers. so it feels like this is in the API's future at some point.bonus
one minorly interesting observation along the way is that external DNS servers in particular are reachable at a few addresses - whichever public address they get in the rack's internal address range, and whichever address they get in the external address range. the public address is what's used for A/AAAA records. so, if you're looking around from inside a DNS zone you can get odd-looking answers like: