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

Update static DNS HLD with minigraph changes #1322

Merged
merged 2 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/static-dns/images/static_dns_containers_update.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 22 additions & 2 deletions doc/static-dns/static_dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ between programs that supply nameserver information and applications that use th
- Provide a possibility to configure static DNS entries via Config DB.
- The default behavior should be preserved if no static DNS entries are configured.
- New CLI command for static DNS configuration.
- DNS configuration should be updated in the host OS and all existing docker containers.

### Architecture Design

1. CLI is responsible for putting DNS static configuration to Config DB.
2. hostcfgd should be extended to handle static DNS configuration by listening to Config DB change.
3. A new resolv-config.service systemd service should be added to control recolvconf framework.
4. A new resolv.conf.j2 template file should be added to generate resolv.conf file with static DNS configuration.
4. A new resolv.conf.j2 template file should be added to generate resolv.conf file with static DNS configuration.
5. A new resolvconf plugin ("update-containers") should be added to update the DNS configuration inside each existing docker container.

#### CLI flow

Expand All @@ -60,7 +62,10 @@ between programs that supply nameserver information and applications that use th
![static_dns_init_hostcfgd](/doc/static-dns/images/static_dns_init_hostcfgd.svg)
#### Runtime configuration changes
![static_dns_runtime_config](/doc/static-dns/images/static_dns_runtime_config.svg)
#### Containers configuration update
`resolvconf` will call the `update-containers` plugin after the DNS configuration update, to notify about the configuration change. `update-containers` plugin will update the DNS configuration in each docker container by copying `/etc/resolv.conf` file into the container filesystem. The plugin will be called regardless if the information was received dynamically from the DHCP server or configured manually by the user via config command.

![static_dns_containers_update](/doc/static-dns/images/static_dns_containers_update.svg)
### High-Level Design

Changes should be added to sonic-buildimage and sonic-utilities repositories. CLI changes of sonic-utilities will be covered in the chapter "Configuration and management".
Expand Down Expand Up @@ -159,7 +164,21 @@ Config DB will be extended with the following table:
},
}
```


#### Minigraph Config Enhancements

A new "DnsNameserverResources" property will be added to the Minigraph

```xml
<a:DeviceProperty>
<a:Name>DnsNameserverResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>"IP addresses list"</a:Value>
</a:DeviceProperty>
```

`sonic-cfggen` will be extended to translate configuration specified in "DnsNameserverResources" property into "DNS_NAMESERVER" Config DB table.

### Warmboot and Fastboot Design Impact
The feature has no impact on the warmboot and fastboot.

Expand All @@ -176,6 +195,7 @@ The feature doesn't require special handling during the config migration.
2. Verify command "config dns nameserver del"
3. Verify command "show dns nameserver"
4. Verify the configuration generated by resolv.conf.j2 template
5. Verify the configuration generated from minigraph

#### System Test cases
System test cases should be implemented in sonic-mgmt. A few new test cases should be added:
Expand Down