Windows: Add runtime DNS and del bug fix
This adds the dns capability for supplying a runtime dnsConfig from a CRI. It also includes a bug fix for removing an endpoint when no IPAM is supplied. Adds version dependency of 0.3.0. Mild updates to windows READMEs.
This commit is contained in:
@ -32,12 +32,11 @@ const (
|
||||
|
||||
type EndpointInfo struct {
|
||||
EndpointName string
|
||||
DnsSearch []string
|
||||
DNS types.DNS
|
||||
NetworkName string
|
||||
NetworkId string
|
||||
Gateway net.IP
|
||||
IpAddress net.IP
|
||||
Nameservers []string
|
||||
}
|
||||
|
||||
// GetSandboxContainerID returns the sandbox ID of this pod
|
||||
@ -82,8 +81,8 @@ func GenerateHnsEndpoint(epInfo *EndpointInfo, n *NetConf) (*hcsshim.HNSEndpoint
|
||||
hnsEndpoint = &hcsshim.HNSEndpoint{
|
||||
Name: epInfo.EndpointName,
|
||||
VirtualNetwork: epInfo.NetworkId,
|
||||
DNSServerList: strings.Join(epInfo.Nameservers, ","),
|
||||
DNSSuffix: strings.Join(epInfo.DnsSearch, ","),
|
||||
DNSServerList: strings.Join(epInfo.DNS.Nameservers, ","),
|
||||
DNSSuffix: strings.Join(epInfo.DNS.Search, ","),
|
||||
GatewayAddress: GetIpString(&epInfo.Gateway),
|
||||
IPAddress: epInfo.IpAddress,
|
||||
Policies: n.MarshalPolicies(),
|
||||
@ -130,8 +129,8 @@ func GenerateHcnEndpoint(epInfo *EndpointInfo, n *NetConf) (*hcn.HostComputeEndp
|
||||
}
|
||||
|
||||
hcnDns := hcn.Dns{
|
||||
Search: epInfo.DnsSearch,
|
||||
ServerList: epInfo.Nameservers,
|
||||
Search: epInfo.DNS.Search,
|
||||
ServerList: epInfo.DNS.Nameservers,
|
||||
}
|
||||
|
||||
hcnIpConfig := hcn.IpConfig{
|
||||
|
@ -28,6 +28,16 @@ type NetConf struct {
|
||||
types.NetConf
|
||||
HcnPolicyArgs []hcn.EndpointPolicy `json:"HcnPolicyArgs,omitempty"`
|
||||
Policies []policy `json:"policies,omitempty"`
|
||||
RuntimeConfig RuntimeConfig `json:"runtimeConfig"`
|
||||
}
|
||||
|
||||
type RuntimeDNS struct {
|
||||
Nameservers []string `json:"servers,omitempty"`
|
||||
Search []string `json:"searches,omitempty"`
|
||||
}
|
||||
|
||||
type RuntimeConfig struct {
|
||||
DNS RuntimeDNS `json:"dns"`
|
||||
}
|
||||
|
||||
type policy struct {
|
||||
@ -35,6 +45,18 @@ type policy struct {
|
||||
Value json.RawMessage `json:"value"`
|
||||
}
|
||||
|
||||
// If runtime dns values are there use that else use cni conf supplied dns
|
||||
func (n *NetConf) GetDNS() types.DNS {
|
||||
dnsResult := n.DNS
|
||||
if len(n.RuntimeConfig.DNS.Nameservers) > 0 {
|
||||
dnsResult.Nameservers = n.RuntimeConfig.DNS.Nameservers
|
||||
}
|
||||
if len(n.RuntimeConfig.DNS.Search) > 0 {
|
||||
dnsResult.Search = n.RuntimeConfig.DNS.Search
|
||||
}
|
||||
return dnsResult
|
||||
}
|
||||
|
||||
// MarshalPolicies converts the Endpoint policies in Policies
|
||||
// to HNS specific policies as Json raw bytes
|
||||
func (n *NetConf) MarshalPolicies() []json.RawMessage {
|
||||
|
Reference in New Issue
Block a user