Commit 44ca3ea5 authored by Yifan Gu's avatar Yifan Gu

CRI: Add dns option, rename DNSOption to DNSConfig.

parent 1e5e4fdb
......@@ -73,12 +73,15 @@ message VersionResponse {
optional string runtime_api_version = 4;
}
// DNSOption specifies the DNS servers and search domains.
message DNSOption {
// DNSConfig specifies the DNS servers and search domains.
message DNSConfig {
// List of DNS servers of the cluster.
repeated string servers = 1;
// List of DNS search domains of the cluster.
repeated string searches = 2;
// List of DNS options. See https://linux.die.net/man/5/resolv.conf
// for all available options.
repeated string options = 3;
}
enum Protocol {
......@@ -177,8 +180,8 @@ message PodSandboxConfig {
// https://issues.k8s.io/24677. There *may* be future change of direction
// for logging as the discussion carries on.
optional string log_directory = 3;
// The DNS options for the sandbox.
optional DNSOption dns_options = 4;
// The DNS config for the sandbox.
optional DNSConfig dns_config = 4;
// The port mappings for the sandbox.
repeated PortMapping port_mappings = 5;
// Labels are key value pairs that may be used to scope and select individual resources.
......
......@@ -243,9 +243,10 @@ func makeSandboxDockerConfig(c *runtimeApi.PodSandboxConfig, image string) *dock
hc.PortBindings = portBindings
// Set DNS options.
if dnsOpts := c.GetDnsOptions(); dnsOpts != nil {
hc.DNS = dnsOpts.GetServers()
hc.DNSSearch = dnsOpts.GetSearches()
if dnsConfig := c.GetDnsConfig(); dnsConfig != nil {
hc.DNS = dnsConfig.GetServers()
hc.DNSSearch = dnsConfig.GetSearches()
hc.DNSOptions = dnsConfig.GetOptions()
}
// Apply resource options.
......
......@@ -37,6 +37,11 @@ const (
minQuotaPeriod = 1000
)
var (
// The default dns opt strings
defaultDNSOptions = []string{"ndots:5"}
)
type podsByID []*kubecontainer.Pod
func (b podsByID) Len() int { return len(b) }
......
......@@ -69,9 +69,10 @@ func (m *kubeGenericRuntimeManager) generatePodSandboxConfig(pod *api.Pod, attem
if err != nil {
return nil, err
}
podSandboxConfig.DnsOptions = &runtimeApi.DNSOption{
podSandboxConfig.DnsConfig = &runtimeApi.DNSConfig{
Servers: dnsServers,
Searches: dnsSearches,
Options: defaultDNSOptions,
}
// TODO: Add domain support in new runtime interface
hostname, _, err := m.runtimeHelper.GeneratePodHostNameAndDomain(pod)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment